giscanner: Fix pointer parsing.
authorKrzesimir Nowak <qdlacz@gmail.com>
Wed, 4 Jul 2012 20:44:02 +0000 (22:44 +0200)
committerColin Walters <walters@verbum.org>
Fri, 6 Jul 2012 14:35:11 +0000 (10:35 -0400)
They were parsed in wrong order resulting in having wrong pointer
being const. For example - g_settings_list_schemas return type is
normally 'const gchar *const *', but parsing result was
'const gchar ** const'.

This was unnoticed, because pointer constness information is rather
not used by gobject-introspection now.

https://bugzilla.gnome.org/show_bug.cgi?id=656445

giscanner/scannerparser.y

index 65ac5946dbbc0ddbd852f1ef9b512ba5fb7baab2..48e3c132bf0599272bc716796a9f97950eeb459d 100644 (file)
@@ -1088,12 +1088,24 @@ pointer
          }
        | '*' type_qualifier_list pointer
          {
-               $$ = gi_source_pointer_new ($3);
-               $$->type_qualifier = $2;
+               GISourceType **base = &($3->base_type);
+
+               while (*base != NULL) {
+                       base = &((*base)->base_type);
+               }
+               *base = gi_source_pointer_new (NULL);
+               (*base)->type_qualifier = $2;
+               $$ = $3;
          }
        | '*' pointer
          {
-               $$ = gi_source_pointer_new ($2);
+               GISourceType **base = &($2->base_type);
+
+               while (*base != NULL) {
+                       base = &((*base)->base_type);
+               }
+               *base = gi_source_pointer_new (NULL);
+               $$ = $2;
          }
        ;