diff options
author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2018-02-13 00:00:00 +0000 |
---|---|---|
committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2018-02-13 14:11:27 +0100 |
commit | 75fed99356bbfef17847bc765e916c2d629af956 (patch) | |
tree | f4d1c2e1a61b27e3b9f4867a99608049ca65e9b2 /giscanner | |
parent | e8e567546282d714729df55d10ca26ec35c71416 (diff) | |
download | gobject-introspection-75fed99356bbfef17847bc765e916c2d629af956.tar.gz |
Create a new symbol instead of changing its identifier in place.
Also free memory associated with macro name when it is unused.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/scannerparser.y | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y index db3aef1f..abfbe065 100644 --- a/giscanner/scannerparser.y +++ b/giscanner/scannerparser.y @@ -1508,8 +1508,14 @@ object_macro_define : object_macro constant_expression { if ($2->const_int_set || $2->const_boolean_set || $2->const_double_set || $2->const_string != NULL) { - $2->ident = $1; - gi_source_scanner_add_symbol (scanner, $2); + GISourceSymbol *macro = gi_source_symbol_copy ($2); + g_free (macro->ident); + macro->ident = $1; + gi_source_scanner_add_symbol (scanner, macro); + gi_source_symbol_unref (macro); + gi_source_symbol_unref ($2); + } else { + g_free ($1); gi_source_symbol_unref ($2); } } |