summaryrefslogtreecommitdiff
authorEdward Hervey <bilboed@bilboed.com>2009-06-29 09:24:25 (GMT)
committer Edward Hervey <bilboed@bilboed.com>2009-06-30 14:30:07 (GMT)
commitb50ba091642b48a04d54d3b063db08b3629f463f (patch) (side-by-side diff)
treec6e1d698235761700f84470bf6a3ea328a7378b5
parent3c21f2d86c72fa2d8c8d6b8d5087599497c2673c (diff)
downloadgstreamer-b50ba091642b48a04d54d3b063db08b3629f463f.zip
gstreamer-b50ba091642b48a04d54d3b063db08b3629f463f.tar.gz
binaryregistry: Use local values in while/for loops, use branch prediction macros
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gst/gstregistrybinary.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c
index 222e749..78b90e1 100644
--- a/gst/gstregistrybinary.c
+++ b/gst/gstregistrybinary.c
@@ -942,6 +942,7 @@ gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
if (GST_IS_ELEMENT_FACTORY (feature)) {
GstBinaryElementFactory *ef;
+ guint n;
GstElementFactory *factory = GST_ELEMENT_FACTORY_CAST (feature);
align (*in);
@@ -954,38 +955,43 @@ gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in,
unpack_string (*in, factory->details.klass, end, fail);
unpack_string (*in, factory->details.description, end, fail);
unpack_string (*in, factory->details.author, end, fail);
+ n = ef->npadtemplates;
GST_DEBUG ("Element factory : '%s' with npadtemplates=%d",
- factory->details.longname, ef->npadtemplates);
+ factory->details.longname, n);
/* load pad templates */
- for (i = 0; i < ef->npadtemplates; i++) {
- if (!gst_registry_binary_load_pad_template (factory, in, end)) {
+ for (i = 0; i < n; i++) {
+ if (G_UNLIKELY (!gst_registry_binary_load_pad_template (factory, in,
+ end))) {
GST_ERROR ("Error while loading binary pad template");
goto fail;
}
}
/* load uritypes */
- if (ef->nuriprotocols) {
- GST_DEBUG ("Reading %d UriTypes at address %p", ef->nuriprotocols, *in);
+ if (G_UNLIKELY ((n = ef->nuriprotocols))) {
+ GST_DEBUG ("Reading %d UriTypes at address %p", n, *in);
align (*in);
factory->uri_type = *((guint *) * in);
*in += sizeof (factory->uri_type);
/*unpack_element(*in, &factory->uri_type, factory->uri_type, end, fail); */
- factory->uri_protocols = g_new0 (gchar *, ef->nuriprotocols + 1);
- for (i = 0; i < ef->nuriprotocols; i++) {
+ factory->uri_protocols = g_new0 (gchar *, n + 1);
+ for (i = 0; i < n; i++) {
unpack_string (*in, str, end, fail);
factory->uri_protocols[i] = str;
}
}
+
/* load interfaces */
- GST_DEBUG ("Reading %d Interfaces at address %p", ef->ninterfaces, *in);
- for (i = 0; i < ef->ninterfaces; i++) {
- unpack_string (*in, str, end, fail);
- __gst_element_factory_add_interface (factory, str);
- g_free (str);
+ if (G_UNLIKELY ((n = ef->ninterfaces))) {
+ GST_DEBUG ("Reading %d Interfaces at address %p", n, *in);
+ for (i = 0; i < n; i++) {
+ unpack_string (*in, str, end, fail);
+ __gst_element_factory_add_interface (factory, str);
+ g_free (str);
+ }
}
} else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
GstBinaryTypeFindFactory *tff;