Commit f42d7e6a authored by David Schleef's avatar David Schleef

Added gst_data_needs_copy_on_write()

Original commit message from CVS:
Added gst_data_needs_copy_on_write()
parent edd2819c
......@@ -92,6 +92,26 @@ gst_data_copy (const GstData *data)
return NULL;
* gst_data_needs_copy_on_write:
* @data: a #GstData to copy
* Returns: TRUE if the given #GstData is potentially shared and needs to
* be copied before it can be modified safely.
gst_data_needs_copy_on_write (GstData *data)
gint refcount;
GST_ATOMIC_INT_READ (&data->refcount, &refcount);
if (refcount == 1 && !GST_DATA_FLAG_IS_SET (data, GST_DATA_READONLY))
return FALSE;
return TRUE;
* gst_data_copy_on_write:
* @data: a #GstData to copy
......@@ -87,6 +87,7 @@ void gst_data_copy_into (const GstData *data, GstData *target);
/* basic operations on data */
GstData* gst_data_copy (const GstData *data);
gboolean gst_data_needs_copy_on_write (GstData *data);
GstData* gst_data_copy_on_write (GstData *data);
void gst_data_free (GstData *data);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment