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:
Don't imply that it's okay to unconditionally change
buffer data or buffer metadata in a pad probe callback,
{
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));
}
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];
};
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);
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;
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;
}