summaryrefslogtreecommitdiff
path: root/giscanner/scannerparser.y
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2018-12-09 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2018-12-09 14:44:16 +0100
commit51f7cb11a4f0a247381be9f69d432cc182d8ffda (patch)
tree5030ee6885c9b47647c795aca1baf0ca32a58dab /giscanner/scannerparser.y
parentf6f32926106587b7969d53d86cf6412b26a0625e (diff)
downloadgobject-introspection-51f7cb11a4f0a247381be9f69d432cc182d8ffda.tar.gz
Replace linked lists with arrays in source scanner
Reduce total number of memory allocations and increase data locality.
Diffstat (limited to 'giscanner/scannerparser.y')
-rw-r--r--giscanner/scannerparser.y6
1 files changed, 3 insertions, 3 deletions
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y
index 72c17ec3..182c69d3 100644
--- a/giscanner/scannerparser.y
+++ b/giscanner/scannerparser.y
@@ -166,7 +166,7 @@ pop_conditional (GISourceScanner *scanner)
{
gchar *filename = g_file_get_path (scanner->current_file);
gchar *error = g_strdup_printf ("%s:%d: mismatched %s", filename, lineno, yytext);
- scanner->errors = g_slist_prepend (scanner->errors, error);
+ g_ptr_array_add (scanner->errors, error);
g_free (filename);
}
@@ -183,7 +183,7 @@ warn_if_cond_has_gi_scanner (GISourceScanner *scanner,
gchar *filename = g_file_get_path (scanner->current_file);
gchar *error = g_strdup_printf ("%s:%d: the __GI_SCANNER__ constant should only be used with simple #ifdef or #endif: %s",
filename, lineno, text);
- scanner->errors = g_slist_prepend (scanner->errors, error);
+ g_ptr_array_add (scanner->errors, error);
g_free (filename);
}
}
@@ -1571,7 +1571,7 @@ yyerror (GISourceScanner *scanner, const char *s)
{
gchar *error = g_strdup_printf ("%s:%d: %s in '%s' at '%s'",
g_file_get_parse_name (scanner->current_file), lineno, s, linebuf, yytext);
- scanner->errors = g_slist_prepend (scanner->errors, error);
+ g_ptr_array_add (scanner->errors, error);
}
}