gstreamer: plugin: avoid some relocations
Tim Müller
tpm at kemper.freedesktop.org
Sun Apr 29 12:10:23 PDT 2012
Module: gstreamer
Branch: master
Commit: f5918f760588b63f3cbc2ef6c4bb86f280129478
URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=f5918f760588b63f3cbc2ef6c4bb86f280129478
Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date: Sun Apr 29 20:06:38 2012 +0100
plugin: avoid some relocations
---
gst/gstplugin.c | 32 ++++++++++++++------------------
1 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/gst/gstplugin.c b/gst/gstplugin.c
index 3f7c314..a7542fc 100644
--- a/gst/gstplugin.c
+++ b/gst/gstplugin.c
@@ -90,18 +90,17 @@ static char *_gst_plugin_fault_handler_filename = NULL;
* MIT/X11: http://www.opensource.org/licenses/mit-license.php
* 3-clause BSD: http://www.opensource.org/licenses/bsd-license.php
*/
-static const gchar *const valid_licenses[] = {
- "LGPL", /* GNU Lesser General Public License */
- "GPL", /* GNU General Public License */
- "QPL", /* Trolltech Qt Public License */
- "GPL/QPL", /* Combi-license of GPL + QPL */
- "MPL", /* MPL 1.1 license */
- "BSD", /* 3-clause BSD license */
- "MIT/X11", /* MIT/X11 license */
- "Proprietary", /* Proprietary license */
- GST_LICENSE_UNKNOWN, /* some other license */
- NULL
-};
+static const gchar valid_licenses[] = "LGPL\000" /* GNU Lesser General Public License */
+ "GPL\000" /* GNU General Public License */
+ "QPL\000" /* Trolltech Qt Public License */
+ "GPL/QPL\000" /* Combi-license of GPL + QPL */
+ "MPL\000" /* MPL 1.1 license */
+ "BSD\000" /* 3-clause BSD license */
+ "MIT/X11\000" /* MIT/X11 license */
+ "Proprietary\000" /* Proprietary license */
+ GST_LICENSE_UNKNOWN; /* some other license */
+
+static const guint8 valid_licenses_idx[] = { 0, 5, 9, 13, 21, 25, 29, 37, 49 };
static GstPlugin *gst_plugin_register_func (GstPlugin * plugin,
const GstPluginDesc * desc, gpointer user_data);
@@ -460,14 +459,11 @@ priv_gst_plugin_loading_get_whitelist_hash (void)
static gboolean
gst_plugin_check_license (const gchar * license)
{
- const gchar *const *check_license = valid_licenses;
+ gint i;
- g_assert (check_license);
-
- while (*check_license) {
- if (strcmp (license, *check_license) == 0)
+ for (i = 0; i < G_N_ELEMENTS (valid_licenses_idx); ++i) {
+ if (strcmp (license, valid_licenses + valid_licenses_idx[i]) == 0)
return TRUE;
- check_license++;
}
return FALSE;
}
More information about the gstreamer-commits
mailing list