summaryrefslogtreecommitdiff
path: root/giscanner/sourcescanner.c
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-02-16 00:43:36 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2013-02-16 00:48:59 -0500
commitfa8e95cd172769c337a5945cfaa4f0aeb1d128ca (patch)
tree812dbcc5fdfeb267327661b7a4016d1b228d48d5 /giscanner/sourcescanner.c
parenta21f3238c8701f79f98486101123c6de01e439ea (diff)
downloadgobject-introspection-fa8e95cd172769c337a5945cfaa4f0aeb1d128ca.tar.gz
sourcescanner: Fix symbolic references in enum members
We need to copy the source symbols, otherwise we'll overwrite their values. This isn't good. https://bugzilla.gnome.org/show_bug.cgi?id=693939
Diffstat (limited to 'giscanner/sourcescanner.c')
-rw-r--r--giscanner/sourcescanner.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c
index 1b775b46..339bd897 100644
--- a/giscanner/sourcescanner.c
+++ b/giscanner/sourcescanner.c
@@ -45,6 +45,26 @@ ctype_free (GISourceType * type)
}
GISourceSymbol *
+gi_source_symbol_copy (GISourceSymbol * symbol)
+{
+ GISourceSymbol *new_symbol = gi_source_symbol_new (symbol->type,
+ symbol->source_filename,
+ symbol->line);
+ new_symbol->ident = g_strdup (symbol->ident);
+
+ if (symbol->base_type)
+ new_symbol->base_type = gi_source_type_copy (symbol->base_type);
+ if (symbol->const_int_set)
+ new_symbol->const_int = symbol->const_int;
+ else if (symbol->const_double_set)
+ new_symbol->const_double = symbol->const_double_set;
+ else if (symbol->const_string != NULL)
+ new_symbol->const_string = g_strdup (symbol->const_string);
+
+ return new_symbol;
+}
+
+GISourceSymbol *
gi_source_symbol_ref (GISourceSymbol * symbol)
{
symbol->ref_count++;