Avoid variable length arrays in clutter-backend-x11
authorNeil Roberts <neil@linux.intel.com>
Mon, 25 Oct 2010 12:07:50 +0000 (13:07 +0100)
committerNeil Roberts <neil@linux.intel.com>
Mon, 25 Oct 2010 12:18:25 +0000 (13:18 +0100)
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.

clutter/x11/clutter-backend-x11.c

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