parse: fix compiler warning
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 7 Apr 2010 11:24:14 +0000 (12:24 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 7 Apr 2010 18:09:23 +0000 (19:09 +0100)
Fix 'grammar.y:668: passing argument 1 of ‘g_free’ discards qualifiers
from pointer target type' compiler warning.

gst/parse/grammar.y

index 5bcb1e2..cd900cf 100644 (file)
@@ -207,7 +207,13 @@ YYPRINTF(const char *format, ...)
           g_list_append ((graph)->ctx->missing_elements, g_strdup (name));  \
     } } G_STMT_END
 
-#define GST_BIN_MAKE(res, type, chainval, assign, free_string) \
+static void
+no_free (gconstpointer foo)
+{
+  /* do nothing */
+}
+
+#define GST_BIN_MAKE(res, type, chainval, assign, type_string_free_func) \
 G_STMT_START { \
   chain_t *chain = chainval; \
   GSList *walk; \
@@ -218,8 +224,7 @@ G_STMT_START { \
     g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
     g_slist_free (assign); \
     gst_object_unref (bin); \
-    if (free_string) \
-      gst_parse_strfree (type); /* Need to clean up the string */ \
+    type_string_free_func (type); /* Need to clean up the string */ \
     YYERROR; \
   } else if (!bin) { \
     ADD_MISSING_ELEMENT(graph, type); \
@@ -665,14 +670,14 @@ element:  IDENTIFIER                    { $$ = gst_element_factory_make ($1, NULL);
 assignments:   /* NOP */                     { $$ = NULL; }
        |       assignments ASSIGNMENT        { $$ = g_slist_prepend ($1, $2); }
        ;               
-bin:           '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2, FALSE); }
-        |       BINREF assignments chain ')'  { GST_BIN_MAKE ($$, $1, $3, $2, TRUE); 
+bin:           '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2, no_free); }
+        |       BINREF assignments chain ')'  { GST_BIN_MAKE ($$, $1, $3, $2, gst_parse_strfree);
                                                gst_parse_strfree ($1);
                                              }
-        |       BINREF assignments ')'       { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE); 
+        |       BINREF assignments ')'       { GST_BIN_MAKE ($$, $1, NULL, $2, gst_parse_strfree);
                                                gst_parse_strfree ($1);
                                              }
-        |       BINREF assignments error ')'  { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE); 
+        |       BINREF assignments error ')'  { GST_BIN_MAKE ($$, $1, NULL, $2, gst_parse_strfree);
                                                gst_parse_strfree ($1);
                                              }
        ;