mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
gst/: Put more strings into the GLib quark table. No need to keep a hundred-something copies of identical version str...
Original commit message from CVS: * gst/gstplugin.c: * gst/gstplugin.h: * gst/gstregistrybinary.c: * gst/gstregistryxml.c: Put more strings into the GLib quark table. No need to keep a hundred-something copies of identical version strings, license strings, package name strings and package origin strings around.
This commit is contained in:
parent
c3a2e0699f
commit
a90dc9f01a
5 changed files with 36 additions and 31 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-10-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/gstplugin.c:
|
||||
* gst/gstplugin.h:
|
||||
* gst/gstregistrybinary.c:
|
||||
* gst/gstregistryxml.c:
|
||||
Put more strings into the GLib quark table. No need to keep
|
||||
a hundred-something copies of identical version strings,
|
||||
license strings, package name strings and package origin
|
||||
strings around.
|
||||
|
||||
2007-10-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* docs/manual/advanced-dataaccess.xml:
|
||||
|
|
|
@ -495,28 +495,22 @@ gst_plugin_desc_copy (GstPluginDesc * dest, const GstPluginDesc * src)
|
|||
{
|
||||
dest->major_version = src->major_version;
|
||||
dest->minor_version = src->minor_version;
|
||||
dest->name = g_strdup (src->name);
|
||||
dest->name = g_intern_string (src->name);
|
||||
/* maybe intern the description too, just for convenience? */
|
||||
dest->description = g_strdup (src->description);
|
||||
dest->plugin_init = src->plugin_init;
|
||||
dest->version = g_strdup (src->version);
|
||||
dest->license = g_strdup (src->license);
|
||||
dest->source = g_strdup (src->source);
|
||||
dest->package = g_strdup (src->package);
|
||||
dest->origin = g_strdup (src->origin);
|
||||
dest->version = g_intern_string (src->version);
|
||||
dest->license = g_intern_string (src->license);
|
||||
dest->source = g_intern_string (src->source);
|
||||
dest->package = g_intern_string (src->package);
|
||||
dest->origin = g_intern_string (src->origin);
|
||||
}
|
||||
|
||||
/* unused */
|
||||
static void
|
||||
gst_plugin_desc_free (GstPluginDesc * desc)
|
||||
{
|
||||
g_free (desc->name);
|
||||
g_free (desc->description);
|
||||
g_free (desc->version);
|
||||
g_free (desc->license);
|
||||
g_free (desc->source);
|
||||
g_free (desc->package);
|
||||
g_free (desc->origin);
|
||||
|
||||
memset (desc, 0, sizeof (GstPluginDesc));
|
||||
}
|
||||
|
||||
|
|
|
@ -110,14 +110,14 @@ typedef gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
|
|||
struct _GstPluginDesc {
|
||||
gint major_version;
|
||||
gint minor_version;
|
||||
gchar *name;
|
||||
const gchar *name;
|
||||
gchar *description;
|
||||
GstPluginInitFunc plugin_init;
|
||||
gchar *version;
|
||||
gchar *license;
|
||||
gchar *source;
|
||||
gchar *package;
|
||||
gchar *origin;
|
||||
const gchar *version;
|
||||
const gchar *license;
|
||||
const gchar *source;
|
||||
const gchar *package;
|
||||
const gchar *origin;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
|
|
@ -823,14 +823,14 @@ gst_registry_binary_load_plugin (GstRegistry * registry, gchar ** in)
|
|||
plugin->file_size = pe->file_size;
|
||||
|
||||
/* unpack plugin element strings */
|
||||
unpack_string (*in, plugin->desc.name);
|
||||
unpack_const_string (*in, plugin->desc.name);
|
||||
unpack_string (*in, plugin->desc.description);
|
||||
unpack_string (*in, plugin->filename);
|
||||
unpack_string (*in, plugin->desc.version);
|
||||
unpack_string (*in, plugin->desc.license);
|
||||
unpack_string (*in, plugin->desc.source);
|
||||
unpack_string (*in, plugin->desc.package);
|
||||
unpack_string (*in, plugin->desc.origin);
|
||||
unpack_const_string (*in, plugin->desc.version);
|
||||
unpack_const_string (*in, plugin->desc.license);
|
||||
unpack_const_string (*in, plugin->desc.source);
|
||||
unpack_const_string (*in, plugin->desc.package);
|
||||
unpack_const_string (*in, plugin->desc.origin);
|
||||
GST_LOG ("read strings for '%s'", plugin->desc.name);
|
||||
|
||||
plugin->basename = g_path_get_basename (plugin->filename);
|
||||
|
|
|
@ -404,7 +404,7 @@ load_plugin (xmlTextReaderPtr reader, GList ** feature_list)
|
|||
if (g_str_equal (tag, "name")) {
|
||||
int ret;
|
||||
|
||||
ret = read_string (reader, &plugin->desc.name, FALSE);
|
||||
ret = read_const_interned_string (reader, &plugin->desc.name, FALSE);
|
||||
GST_LOG ("name ret=%d, name=%s", ret, plugin->desc.name);
|
||||
if (!ret)
|
||||
break;
|
||||
|
@ -422,31 +422,31 @@ load_plugin (xmlTextReaderPtr reader, GList ** feature_list)
|
|||
GST_LOG ("filename %s", plugin->filename);
|
||||
plugin->basename = g_path_get_basename (plugin->filename);
|
||||
} else if (g_str_equal (tag, "version")) {
|
||||
if (!read_string (reader, &plugin->desc.version, TRUE)) {
|
||||
if (!read_const_interned_string (reader, &plugin->desc.version, TRUE)) {
|
||||
GST_WARNING ("version field was invalid in registry");
|
||||
break;
|
||||
}
|
||||
GST_LOG ("version %s", plugin->desc.version);
|
||||
} else if (g_str_equal (tag, "license")) {
|
||||
if (!read_string (reader, &plugin->desc.license, TRUE)) {
|
||||
if (!read_const_interned_string (reader, &plugin->desc.license, TRUE)) {
|
||||
GST_WARNING ("license field was invalid in registry");
|
||||
break;
|
||||
}
|
||||
GST_LOG ("license %s", plugin->desc.license);
|
||||
} else if (g_str_equal (tag, "source")) {
|
||||
if (!read_string (reader, &plugin->desc.source, TRUE)) {
|
||||
if (!read_const_interned_string (reader, &plugin->desc.source, TRUE)) {
|
||||
GST_WARNING ("source field was invalid in registry");
|
||||
break;
|
||||
}
|
||||
GST_LOG ("source %s", plugin->desc.source);
|
||||
} else if (g_str_equal (tag, "package")) {
|
||||
if (!read_string (reader, &plugin->desc.package, TRUE)) {
|
||||
if (!read_const_interned_string (reader, &plugin->desc.package, TRUE)) {
|
||||
GST_WARNING ("package field was invalid in registry");
|
||||
break;
|
||||
}
|
||||
GST_LOG ("package %s", plugin->desc.package);
|
||||
} else if (g_str_equal (tag, "origin")) {
|
||||
if (!read_string (reader, &plugin->desc.origin, TRUE)) {
|
||||
if (!read_const_interned_string (reader, &plugin->desc.origin, TRUE)) {
|
||||
GST_WARNING ("failed to read origin");
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue