As outlined in the API documentation, g_list_append() iterates over the whole
list, which can quickly introduce performance issues when the list becomes very
big, such as for data URIs for instance.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1909>
for (next_elem = split_str; *next_elem; next_elem += 1) {
gchar *elem = *next_elem;
if (*elem == '\0') {
- new_list = g_list_append (new_list, NULL);
+ new_list = g_list_prepend (new_list, NULL);
} else {
if (convert && !unescape) {
gchar *next_sep;
g_free (elem);
elem = *next_elem;
}
- new_list = g_list_append (new_list, g_strdup (elem));
+ new_list = g_list_prepend (new_list, g_strdup (elem));
}
}
}
g_free (pct_sep);
}
- return new_list;
+ return g_list_reverse (new_list);
}
static GHashTable *