gst/: constify quark registration strings. Fixes #344115
authorStefan Kost <ensonic@sonicpulse.de>
Mon, 12 Jun 2006 09:28:35 +0000 (09:28 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 12 Jun 2006 09:28:35 +0000 (09:28 +0000)
Original commit message from CVS:
Patch by: Stefan Kost <ensonic at sonicpulse dot de>
* gst/gstevent.c: (gst_event_get_type):
* gst/gstmessage.c:
* gst/gstpad.c: (gst_pad_chain_unchecked), (gst_pad_chain),
(gst_pad_push):
constify quark registration strings. Fixes #344115
Avoid unneeded type checking is _pad_push() by internally
calling gst_pad_chain_unchecked().

ChangeLog
gst/gstevent.c
gst/gstmessage.c
gst/gstpad.c

index 727c7c3..049925a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2006-06-12  Wim Taymans  <wim@fluendo.com>
 
+       Patch by: Stefan Kost <ensonic at sonicpulse dot de>
+
+       * gst/gstevent.c: (gst_event_get_type):
+       * gst/gstmessage.c:
+       * gst/gstpad.c: (gst_pad_chain_unchecked), (gst_pad_chain),
+       (gst_pad_push):
+       constify quark registration strings. Fixes #344115
+       Avoid unneeded type checking is _pad_push() by internally
+       calling gst_pad_chain_unchecked().
+
+2006-06-12  Wim Taymans  <wim@fluendo.com>
+
        * gst/gstbuffer.c: (gst_buffer_get_type), (gst_buffer_finalize),
        (_gst_buffer_copy), (gst_buffer_is_metadata_writable),
        (gst_subbuffer_finalize), (gst_buffer_create_sub),
index d1ff909..a7df269 100644 (file)
@@ -99,8 +99,8 @@ _gst_event_initialize (void)
 
 typedef struct
 {
-  gint type;
-  gchar *name;
+  const gint type;
+  const gchar *name;
   GQuark quark;
 } GstEventQuarks;
 
@@ -185,7 +185,7 @@ gst_event_type_get_flags (GstEventType type)
 GType
 gst_event_get_type (void)
 {
-  static GType _gst_event_type;
+  static GType _gst_event_type = 0;
   int i;
 
   if (G_UNLIKELY (_gst_event_type == 0)) {
index bc4c7f4..85941d7 100644 (file)
@@ -82,8 +82,8 @@ _gst_message_initialize (void)
 
 typedef struct
 {
-  gint type;
-  gchar *name;
+  const gint type;
+  const gchar *name;
   GQuark quark;
 } GstMessageQuarks;
 
index 3b6dcd1..eca4098 100644 (file)
@@ -124,8 +124,8 @@ static GQuark event_quark;
 
 typedef struct
 {
-  gint ret;
-  gchar *name;
+  const gint ret;
+  const gchar *name;
   GQuark quark;
 } GstFlowQuarks;
 
@@ -3165,19 +3165,8 @@ gst_pad_emit_have_data_signal (GstPad * pad, GstMiniObject * obj)
   return res;
 }
 
-/**
- * gst_pad_chain:
- * @pad: a sink #GstPad.
- * @buffer: the #GstBuffer to send.
- *
- * Chain a buffer to @pad.
- *
- * Returns: a #GstFlowReturn from the pad.
- *
- * MT safe.
- */
-GstFlowReturn
-gst_pad_chain (GstPad * pad, GstBuffer * buffer)
+static inline GstFlowReturn
+gst_pad_chain_unchecked (GstPad * pad, GstBuffer * buffer)
 {
   GstCaps *caps;
   gboolean caps_changed;
@@ -3185,12 +3174,6 @@ gst_pad_chain (GstPad * pad, GstBuffer * buffer)
   GstFlowReturn ret;
   gboolean emit_signal;
 
-  g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
-  g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK,
-      GST_FLOW_ERROR);
-  g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
-  g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
-
   GST_PAD_STREAM_LOCK (pad);
 
   GST_OBJECT_LOCK (pad);
@@ -3279,6 +3262,29 @@ no_function:
 }
 
 /**
+ * gst_pad_chain:
+ * @pad: a sink #GstPad.
+ * @buffer: the #GstBuffer to send.
+ *
+ * Chain a buffer to @pad.
+ *
+ * Returns: a #GstFlowReturn from the pad.
+ *
+ * MT safe.
+ */
+GstFlowReturn
+gst_pad_chain (GstPad * pad, GstBuffer * buffer)
+{
+  g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
+  g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SINK,
+      GST_FLOW_ERROR);
+  g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
+  g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
+
+  return gst_pad_chain_unchecked (pad, buffer);
+}
+
+/**
  * gst_pad_push:
  * @pad: a source #GstPad.
  * @buffer: the #GstBuffer to push.
@@ -3345,7 +3351,7 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
       goto not_negotiated;
   }
 
-  ret = gst_pad_chain (peer, buffer);
+  ret = gst_pad_chain_unchecked (peer, buffer);
 
   gst_object_unref (peer);