Avoid variable length arrays in clutter-backend-x11

There was an array whose length was define by a static const int
variable. GCC seems to consider this a variable-length array so it
will cause warnings now that -Wvla is enabled. We might as well make
this constant a #define instead to avoid the warning.
This commit is contained in:
Neil Roberts 2010-10-25 13:07:50 +01:00
parent c3f47fa7d0
commit 8e3674dcc1

View File

@ -84,7 +84,7 @@ static const gchar *atom_names[] = {
"UTF8_STRING", "UTF8_STRING",
}; };
static const guint n_atom_names = G_N_ELEMENTS (atom_names); #define N_ATOM_NAMES G_N_ELEMENTS (atom_names)
/* singleton object */ /* singleton object */
static ClutterBackendX11 *backend_singleton = NULL; static ClutterBackendX11 *backend_singleton = NULL;
@ -289,7 +289,7 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
if (backend_x11->xdpy) if (backend_x11->xdpy)
{ {
ClutterSettings *settings; ClutterSettings *settings;
Atom atoms[n_atom_names]; Atom atoms[N_ATOM_NAMES];
double dpi; double dpi;
CLUTTER_NOTE (BACKEND, "Getting the X screen"); CLUTTER_NOTE (BACKEND, "Getting the X screen");
@ -343,7 +343,7 @@ clutter_backend_x11_post_parse (ClutterBackend *backend,
XSynchronize (backend_x11->xdpy, True); XSynchronize (backend_x11->xdpy, True);
XInternAtoms (backend_x11->xdpy, XInternAtoms (backend_x11->xdpy,
(char **) atom_names, n_atom_names, (char **) atom_names, N_ATOM_NAMES,
False, atoms); False, atoms);
backend_x11->atom_NET_WM_PID = atoms[0]; backend_x11->atom_NET_WM_PID = atoms[0];