builderparser: Don't needlessly copy requested object names

This commit is contained in:
Timm Bäder 2016-09-12 21:39:33 +02:00
parent f415a8bc84
commit e3a3a66370
2 changed files with 5 additions and 12 deletions

View File

@ -221,11 +221,11 @@ static gboolean
is_requested_object (const gchar *object,
ParserData *data)
{
GSList *l;
int i;
for (l = data->requested_objects; l; l = l->next)
for (i = 0; data->requested_objects[i]; ++i)
{
if (g_strcmp0 (l->data, object) == 0)
if (g_strcmp0 (data->requested_objects[i], object) == 0)
return TRUE;
}
@ -1238,14 +1238,8 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
if (requested_objs)
{
gint i;
data.inside_requested_object = FALSE;
for (i = 0; requested_objs[i]; ++i)
{
data.requested_objects = g_slist_prepend (data.requested_objects,
g_strdup (requested_objs[i]));
}
data.requested_objects = requested_objs;
}
else
{
@ -1295,7 +1289,6 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
g_slist_free_full (data.stack, (GDestroyNotify)free_info);
g_slist_free_full (data.custom_finalizers, (GDestroyNotify)free_subparser);
g_slist_free (data.finalizers);
g_slist_free_full (data.requested_objects, g_free);
g_free (data.domain);
g_hash_table_destroy (data.object_ids);
g_markup_parse_context_free (data.ctx);

View File

@ -118,7 +118,7 @@ typedef struct {
GSList *finalizers;
GSList *custom_finalizers;
GSList *requested_objects; /* NULL if all the objects are requested */
char **requested_objects; /* NULL if all the objects are requested */
gboolean inside_requested_object;
gint requested_object_level;
gint cur_object_level;