ahc: use g_slice_new instead of g_slice_new0

In many cases, we use g_slice_new0 and then immediately overwrite the
allocated memory. This is inefficient. Since we're going to immediately
overwrite it, we might as well use plain g_slice_new.

https://bugzilla.gnome.org/show_bug.cgi?id=763998
This commit is contained in:
Martin Kelly 2016-03-15 16:22:59 -07:00 committed by Sebastian Dröge
parent 66bac3eb86
commit d6a17cd3cc
2 changed files with 4 additions and 5 deletions

View file

@ -2606,7 +2606,7 @@ gst_ah_camera_unlock (GstAHCamera * self)
GstAHCSize *
gst_ahc_size_new (gint width, gint height)
{
GstAHCSize *self = g_slice_new0 (GstAHCSize);
GstAHCSize *self = g_slice_new (GstAHCSize);
self->width = width;
self->height = height;
@ -3374,8 +3374,7 @@ gst_ahc_parameters_get_preview_size (GstAHCParameters * self)
goto done;
}
size = g_slice_new0 (GstAHCSize);
size = g_slice_new (GstAHCSize);
size->width = (*env)->GetIntField (env, jsize,
android_hardware_camera_size.width);
if ((*env)->ExceptionCheck (env)) {

View file

@ -2125,7 +2125,7 @@ gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data)
GST_DEBUG_OBJECT (self, "Received data buffer %p", array);
malloc_data = g_slice_new0 (FreeFuncBuffer);
malloc_data = g_slice_new (FreeFuncBuffer);
malloc_data->self = gst_object_ref (self);
malloc_data->array = (*env)->NewGlobalRef (env, array);
malloc_data->data = (*env)->GetByteArrayElements (env, array, NULL);
@ -2140,7 +2140,7 @@ gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data)
GST_DEBUG_OBJECT (self, "creating wrapped buffer (size: %d)",
self->buffer_size);
item = g_slice_new0 (GstDataQueueItem);
item = g_slice_new (GstDataQueueItem);
item->object = GST_MINI_OBJECT (buffer);
item->size = gst_buffer_get_size (buffer);
item->duration = GST_BUFFER_DURATION (buffer);