xmptag: More efficient GSList usage

Instead of constantly appending (which gets more and more expensive), just
prepend to the list (O(1)) and reverse the list before usage.

https://bugzilla.gnome.org/show_bug.cgi?id=702545
This commit is contained in:
Edward Hervey 2013-06-19 09:22:50 +02:00
parent 4dd5c5b808
commit 420dacb2d5

View file

@ -1338,7 +1338,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
ptag->xmp_tag = xmp_tag;
ptag->str = g_strdup (v);
pending_tags = g_slist_append (pending_tags, ptag);
pending_tags = g_slist_prepend (pending_tags, ptag);
}
}
/* restore chars overwritten by '\0' */
@ -1431,7 +1431,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
ptag->xmp_tag = last_xmp_tag;
ptag->str = g_strdup (part);
pending_tags = g_slist_append (pending_tags, ptag);
pending_tags = g_slist_prepend (pending_tags, ptag);
}
}
}
@ -1442,6 +1442,10 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
}
}
pending_tags = g_slist_reverse (pending_tags);
GST_DEBUG ("Done accumulating tags, now handling them");
while (pending_tags) {
PendingXmpTag *ptag = (PendingXmpTag *) pending_tags->data;