Added g_return_if_fail

Original commit message from CVS:
Added g_return_if_fail
This commit is contained in:
Wim Taymans 2002-11-22 23:15:14 +00:00
parent a003b87f10
commit b7ee3bebf5
3 changed files with 33 additions and 2 deletions

View file

@ -107,6 +107,8 @@ _gst_buffer_sub_free (GstBuffer *buffer)
void
gst_buffer_default_free (GstBuffer *buffer)
{
g_return_if_fail (buffer != NULL);
/* free our data */
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE) && GST_BUFFER_DATA (buffer))
g_free (GST_BUFFER_DATA (buffer));
@ -141,6 +143,8 @@ gst_buffer_default_copy (GstBuffer *buffer)
{
GstBuffer *copy;
g_return_val_if_fail (buffer != NULL, NULL);
/* create a fresh new buffer */
copy = gst_buffer_new ();
@ -317,6 +321,7 @@ GstBuffer*
gst_buffer_merge (GstBuffer *buf1, GstBuffer *buf2)
{
GstBuffer *result;
/* we're just a specific case of the more general gst_buffer_span() */
result = gst_buffer_span (buf1, 0, buf2, buf1->size + buf2->size);
@ -337,6 +342,7 @@ gst_buffer_merge (GstBuffer *buf1, GstBuffer *buf2)
gboolean
gst_buffer_is_span_fast (GstBuffer *buf1, GstBuffer *buf2)
{
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, FALSE);
g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf1) > 0, FALSE);
g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf2) > 0, FALSE);
@ -372,6 +378,7 @@ gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len)
{
GstBuffer *newbuf;
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, FALSE);
g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf1) > 0, NULL);
g_return_val_if_fail (GST_BUFFER_REFCOUNT_VALUE (buf2) > 0, NULL);
g_return_val_if_fail (len > 0, NULL);
@ -409,6 +416,8 @@ gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len)
void
gst_buffer_pool_default_free (GstBufferPool *pool)
{
g_return_if_fail (pool != NULL);
_GST_DATA_DISPOSE (GST_DATA (pool));
g_free (pool);
_gst_buffer_pool_live--;
@ -475,6 +484,8 @@ gst_buffer_pool_new (GstDataFreeFunction free,
gboolean
gst_buffer_pool_is_active (GstBufferPool *pool)
{
g_return_val_if_fail (pool != NULL, FALSE);
return pool->active;
}
@ -489,6 +500,8 @@ gst_buffer_pool_is_active (GstBufferPool *pool)
void
gst_buffer_pool_set_active (GstBufferPool *pool, gboolean active)
{
g_return_if_fail (pool != NULL);
pool->active = active;
}
@ -502,6 +515,8 @@ gst_buffer_pool_set_active (GstBufferPool *pool, gboolean active)
void
gst_buffer_pool_set_user_data (GstBufferPool *pool, gpointer user_data)
{
g_return_if_fail (pool != NULL);
pool->user_data = user_data;
}
@ -516,6 +531,8 @@ gst_buffer_pool_set_user_data (GstBufferPool *pool, gpointer user_data)
gpointer
gst_buffer_pool_get_user_data (GstBufferPool *pool)
{
g_return_val_if_fail (pool != NULL, NULL);
return pool->user_data;
}

View file

@ -42,6 +42,8 @@
void
gst_data_init (GstData *data, GType type, guint16 flags, GstDataFreeFunction free, GstDataCopyFunction copy)
{
g_return_if_fail (data != NULL);
_GST_DATA_INIT (data, type, flags, free, copy);
}
@ -57,6 +59,7 @@ gst_data_init (GstData *data, GType type, guint16 flags, GstDataFreeFunction fre
void
gst_data_copy_into (const GstData *data, GstData *target)
{
g_return_if_fail (data != NULL);
}
/**
@ -69,6 +72,8 @@ gst_data_copy_into (const GstData *data, GstData *target)
void
gst_data_dispose (GstData *data)
{
g_return_if_fail (data != NULL);
_GST_DATA_DISPOSE (data);
}
@ -86,6 +91,8 @@ gst_data_dispose (GstData *data)
GstData*
gst_data_copy (const GstData *data)
{
g_return_val_if_fail (data != NULL, NULL);
if (data->copy)
return data->copy (data);
@ -104,6 +111,8 @@ gst_data_needs_copy_on_write (GstData *data)
{
gint refcount;
g_return_val_if_fail (data != NULL, FALSE);
GST_ATOMIC_INT_READ (&data->refcount, &refcount);
if (refcount == 1 && !GST_DATA_FLAG_IS_SET (data, GST_DATA_READONLY))
@ -130,6 +139,8 @@ gst_data_copy_on_write (GstData *data)
{
gint refcount;
g_return_val_if_fail (data != NULL, NULL);
GST_ATOMIC_INT_READ (&data->refcount, &refcount);
if (refcount == 1 && !GST_DATA_FLAG_IS_SET (data, GST_DATA_READONLY))
@ -154,6 +165,9 @@ gst_data_copy_on_write (GstData *data)
void
gst_data_free (GstData *data)
{
if (!data)
return;
if (data->free)
data->free (data);
}

View file

@ -194,8 +194,8 @@ gst_event_discont_get_value (GstEvent *event, GstFormat format, gint64 *value)
{
gint i, n;
g_return_val_if_fail (event, FALSE);
g_return_val_if_fail (value, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (value != NULL, FALSE);
n = GST_EVENT_DISCONT_OFFSET_LEN (event);