[gobject-introspection] Create a new symbol instead of changing its identifier in place.
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Create a new symbol instead of changing its identifier in place.
- Date: Tue, 13 Feb 2018 13:21:29 +0000 (UTC)
commit 75fed99356bbfef17847bc765e916c2d629af956
Author: Tomasz MiÄ…sko <tomasz miasko gmail com>
Date: Tue Feb 13 00:00:00 2018 +0000
Create a new symbol instead of changing its identifier in place.
Also free memory associated with macro name when it is unused.
giscanner/scannerparser.y | 10 ++++++++--
tests/scanner/regress.h | 7 +++++++
2 files changed, 15 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);
}
}
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index cf0059e4..e1c995a6 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -423,6 +423,13 @@ typedef enum
REGRESS_TEST_EVALUE3 = '0'
} RegressTestEnumNoGEnum;
+/**
+ * REGRESS_TEST_EVALUE_DEPRECATED:
+ *
+ * Scanner used to replace %REGRESS_TEST_EVALUE1 with %REGRESS_TEST_EVALUE_DEPRECATED.
+ */
+#define REGRESS_TEST_EVALUE_DEPRECATED REGRESS_TEST_EVALUE1
+
_GI_TEST_EXTERN
const gchar * regress_test_enum_param(RegressTestEnum e);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]