Commit 3ef229fd authored by Peter Bloomfield's avatar Peter Bloomfield

gconvert: Use a pointer array in extract_uris

Use a GPtrArray instead of a GSList in g_uri_list_extract_uris().
parent 3bc9f57f
...@@ -1806,12 +1806,10 @@ g_filename_to_uri (const gchar *filename, ...@@ -1806,12 +1806,10 @@ g_filename_to_uri (const gchar *filename,
gchar ** gchar **
g_uri_list_extract_uris (const gchar *uri_list) g_uri_list_extract_uris (const gchar *uri_list)
{ {
GSList *uris, *u; GPtrArray *uris;
const gchar *p, *q; const gchar *p, *q;
gchar **result;
gint n_uris = 0;
uris = NULL; uris = g_ptr_array_new ();
p = uri_list; p = uri_list;
...@@ -1840,26 +1838,17 @@ g_uri_list_extract_uris (const gchar *uri_list) ...@@ -1840,26 +1838,17 @@ g_uri_list_extract_uris (const gchar *uri_list)
q--; q--;
if (q > p) if (q > p)
{ g_ptr_array_add (uris, g_strndup (p, q - p + 1));
uris = g_slist_prepend (uris, g_strndup (p, q - p + 1)); }
n_uris++; }
}
}
}
p = strchr (p, '\n'); p = strchr (p, '\n');
if (p) if (p)
p++; p++;
} }
result = g_new (gchar *, n_uris + 1); g_ptr_array_add (uris, NULL);
result[n_uris--] = NULL;
for (u = uris; u; u = u->next)
result[n_uris--] = u->data;
g_slist_free (uris); return (gchar **) g_ptr_array_free (uris, FALSE);
return result;
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment