From: <tp...@ke...> - 2007-10-09 14:18:50
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: tpm Date: Tue Oct 09 2007 14:18:53 UTC Log message: * 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. Modified files: . : ChangeLog gst : gstplugin.c gstplugin.h gstregistrybinary.c gstregistryxml.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.3463&r2=1.3464 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstplugin.c.diff?r1=1.178&r2=1.179 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstplugin.h.diff?r1=1.67&r2=1.68 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstregistrybinary.c.diff?r1=1.14&r2=1.15 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstregistryxml.c.diff?r1=1.36&r2=1.37 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.3463 retrieving revision 1.3464 diff -u -d -r1.3463 -r1.3464 --- ChangeLog 9 Oct 2007 10:41:39 -0000 1.3463 +++ ChangeLog 9 Oct 2007 14:18:36 -0000 1.3464 @@ -1,5 +1,16 @@ 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, Index: gstplugin.c RCS file: /cvs/gstreamer/gstreamer/gst/gstplugin.c,v retrieving revision 1.178 retrieving revision 1.179 diff -u -d -r1.178 -r1.179 --- gstplugin.c 3 Oct 2007 11:36:14 -0000 1.178 +++ gstplugin.c 9 Oct 2007 14:18:38 -0000 1.179 @@ -495,28 +495,22 @@ { 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)); Index: gstplugin.h RCS file: /cvs/gstreamer/gstreamer/gst/gstplugin.h,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- gstplugin.h 24 Sep 2007 17:41:25 -0000 1.67 +++ gstplugin.h 9 Oct 2007 14:18:38 -0000 1.68 @@ -110,14 +110,14 @@ 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]; }; Index: gstregistrybinary.c RCS file: /cvs/gstreamer/gstreamer/gst/gstregistrybinary.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- gstregistrybinary.c 19 Sep 2007 13:28:40 -0000 1.14 +++ gstregistrybinary.c 9 Oct 2007 14:18:39 -0000 1.15 @@ -823,14 +823,14 @@ 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); Index: gstregistryxml.c RCS file: /cvs/gstreamer/gstreamer/gst/gstregistryxml.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- gstregistryxml.c 26 Sep 2007 18:04:42 -0000 1.36 +++ gstregistryxml.c 9 Oct 2007 14:18:39 -0000 1.37 @@ -404,7 +404,7 @@ 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 @@ 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"); } 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"); 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"); 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"); 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"); |