gst: Use GSlice instead of normal g_malloc in more places

This commit is contained in:
Sebastian Dröge 2010-03-28 18:05:36 +02:00
parent 3f4954e42d
commit fd68dbc08f
18 changed files with 105 additions and 81 deletions

View file

@ -2662,7 +2662,7 @@ gst_bin_continue_func (BinContinueData * data)
GST_STATE_UNLOCK (bin);
GST_DEBUG_OBJECT (bin, "state continue done");
gst_object_unref (bin);
g_free (data);
g_slice_free (BinContinueData, data);
return;
interrupted:
@ -2671,7 +2671,7 @@ interrupted:
GST_STATE_UNLOCK (bin);
GST_DEBUG_OBJECT (bin, "state continue aborted due to intervening change");
gst_object_unref (bin);
g_free (data);
g_slice_free (BinContinueData, data);
return;
}
}
@ -2864,7 +2864,7 @@ bin_handle_async_done (GstBin * bin, GstStateChangeReturn ret,
"continue state change, pending %s",
gst_element_state_get_name (pending));
cont = g_new0 (BinContinueData, 1);
cont = g_slice_new (BinContinueData);
/* ref to the bin */
cont->bin = gst_object_ref (bin);

View file

@ -969,7 +969,7 @@ poll_destroy (GstBusPollData * poll_data, gpointer unused)
poll_data->source_running = FALSE;
if (!poll_data->timeout_id) {
g_main_loop_unref (poll_data->loop);
g_free (poll_data);
g_slice_free (GstBusPollData, poll_data);
}
}
@ -979,7 +979,7 @@ poll_destroy_timeout (GstBusPollData * poll_data)
poll_data->timeout_id = 0;
if (!poll_data->source_running) {
g_main_loop_unref (poll_data->loop);
g_free (poll_data);
g_slice_free (GstBusPollData, poll_data);
}
}
@ -1034,7 +1034,7 @@ gst_bus_poll (GstBus * bus, GstMessageType events, GstClockTimeDiff timeout)
GstMessage *ret;
gulong id;
poll_data = g_new0 (GstBusPollData, 1);
poll_data = g_slice_new (GstBusPollData);
poll_data->source_running = TRUE;
poll_data->loop = g_main_loop_new (NULL, FALSE);
poll_data->events = events;

View file

@ -284,7 +284,8 @@ gst_element_init (GstElement * element)
GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING;
GST_STATE_RETURN (element) = GST_STATE_CHANGE_SUCCESS;
element->state_lock = g_new0 (GStaticRecMutex, 1);
/* FIXME 0.11: Store this directly in the instance struct */
element->state_lock = g_slice_new (GStaticRecMutex);
g_static_rec_mutex_init (element->state_lock);
element->state_cond = g_cond_new ();
}
@ -2894,7 +2895,7 @@ gst_element_finalize (GObject * object)
element->state_cond = NULL;
GST_STATE_UNLOCK (element);
g_static_rec_mutex_free (element->state_lock);
g_free (element->state_lock);
g_slice_free (GStaticRecMutex, element->state_lock);
element->state_lock = NULL;
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize parent");

View file

@ -177,7 +177,7 @@ gst_element_factory_cleanup (GstElementFactory * factory)
g_ptr_array_free (caps->structs, TRUE);
caps->refcount = 0;
}
g_free (templ);
g_slice_free (GstStaticPadTemplate, templ);
}
g_list_free (factory->staticpadtemplates);
factory->staticpadtemplates = NULL;
@ -259,10 +259,11 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
GstPadTemplate *templ = item->data;
GstStaticPadTemplate *newt;
newt = g_new0 (GstStaticPadTemplate, 1);
newt = g_slice_new (GstStaticPadTemplate);
newt->name_template = g_intern_string (templ->name_template);
newt->direction = templ->direction;
newt->presence = templ->presence;
newt->static_caps.caps.refcount = 0;
newt->static_caps.string = gst_caps_to_string (templ->caps);
factory->staticpadtemplates =
g_list_append (factory->staticpadtemplates, newt);

View file

@ -152,7 +152,7 @@ gst_format_register (const gchar * nick, const gchar * description)
return query;
g_static_mutex_lock (&mutex);
format = g_new0 (GstFormatDefinition, 1);
format = g_slice_new (GstFormatDefinition);
format->value = _n_values;
format->nick = g_strdup (nick);
format->description = g_strdup (description);

View file

@ -66,6 +66,7 @@ static void gst_index_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstIndexGroup *gst_index_group_new (guint groupnum);
static void gst_index_group_free (GstIndexGroup * group);
static gboolean gst_index_path_resolver (GstIndex * index, GstObject * writer,
gchar ** writer_string, gpointer data);
@ -196,7 +197,7 @@ gst_index_finalize (GObject * object)
GstIndex *index = GST_INDEX (object);
if (index->groups) {
g_list_foreach (index->groups, (GFunc) g_free, NULL);
g_list_foreach (index->groups, (GFunc) gst_index_group_free, NULL);
g_list_free (index->groups);
index->groups = NULL;
}
@ -257,7 +258,7 @@ gst_index_get_property (GObject * object, guint prop_id,
static GstIndexGroup *
gst_index_group_new (guint groupnum)
{
GstIndexGroup *indexgroup = g_new (GstIndexGroup, 1);
GstIndexGroup *indexgroup = g_slice_new (GstIndexGroup);
indexgroup->groupnum = groupnum;
indexgroup->entries = NULL;
@ -269,6 +270,12 @@ gst_index_group_new (guint groupnum)
return indexgroup;
}
static void
gst_index_group_free (GstIndexGroup * group)
{
g_slice_free (GstIndexGroup, group);
}
/**
* gst_index_new:
*
@ -499,7 +506,10 @@ gst_index_set_resolver_full (GstIndex * index, GstIndexResolver resolver,
GstIndexEntry *
gst_index_entry_copy (GstIndexEntry * entry)
{
return g_memdup (entry, sizeof (*entry));
GstIndexEntry *new_entry = g_slice_new (GstIndexEntry);
memcpy (new_entry, entry, sizeof (GstIndexEntry));
return new_entry;
}
/**
@ -530,7 +540,7 @@ gst_index_entry_free (GstIndexEntry * entry)
break;
}
g_free (entry);
g_slice_free (GstIndexEntry, entry);
}
/**
@ -557,7 +567,7 @@ gst_index_add_format (GstIndex * index, gint id, GstFormat format)
if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
return NULL;
entry = g_new0 (GstIndexEntry, 1);
entry = g_slice_new (GstIndexEntry);
entry->type = GST_INDEX_ENTRY_FORMAT;
entry->id = id;
entry->data.format.format = format;
@ -591,7 +601,7 @@ gst_index_add_id (GstIndex * index, gint id, gchar * description)
if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
return NULL;
entry = g_new0 (GstIndexEntry, 1);
entry = g_slice_new (GstIndexEntry);
entry->type = GST_INDEX_ENTRY_ID;
entry->id = id;
entry->data.id.description = description;
@ -699,7 +709,7 @@ gst_index_get_writer_id (GstIndex * index, GstObject * writer, gint * id)
if (!entry) {
/* index is probably not writable, make an entry anyway
* to keep it in our cache */
entry = g_new0 (GstIndexEntry, 1);
entry = g_slice_new (GstIndexEntry);
entry->type = GST_INDEX_ENTRY_ID;
entry->id = *id;
entry->data.id.description = writer_string;
@ -751,7 +761,7 @@ gst_index_add_associationv (GstIndex * index, gint id, GstAssocFlags flags,
if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
return NULL;
entry = g_malloc (sizeof (GstIndexEntry));
entry = g_slice_new (GstIndexEntry);
entry->type = GST_INDEX_ENTRY_ASSOCIATION;
entry->id = id;

View file

@ -1016,7 +1016,7 @@ gst_debug_add_log_function (GstLogFunction func, gpointer data)
g_return_if_fail (func != NULL);
entry = g_new (LogFuncEntry, 1);
entry = g_slice_new (LogFuncEntry);
entry->func = func;
entry->user_data = data;
/* FIXME: we leak the old list here - other threads might access it right now
@ -1066,7 +1066,7 @@ gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
new = g_slist_copy (new);
continue;
}
g_free (found->data);
g_slice_free (LogFuncEntry, found->data);
new = g_slist_delete_link (new, found);
removals++;
}
@ -1272,7 +1272,7 @@ gst_debug_set_threshold_for_name (const gchar * name, GstDebugLevel level)
g_return_if_fail (name != NULL);
pat = g_pattern_spec_new (name);
entry = g_new (LevelNameEntry, 1);
entry = g_slice_new (LevelNameEntry);
entry->pat = pat;
entry->level = level;
g_static_mutex_lock (&__level_name_mutex);
@ -1307,7 +1307,7 @@ gst_debug_unset_threshold_for_name (const gchar * name)
if (g_pattern_spec_equal (entry->pat, pat)) {
__level_name = g_slist_remove_link (__level_name, walk);
g_pattern_spec_free (entry->pat);
g_free (entry);
g_slice_free (LevelNameEntry, entry);
g_slist_free_1 (walk);
walk = __level_name;
}
@ -1325,7 +1325,7 @@ _gst_debug_category_new (const gchar * name, guint color,
g_return_val_if_fail (name != NULL, NULL);
cat = g_new (GstDebugCategory, 1);
cat = g_slice_new (GstDebugCategory);
cat->name = g_strdup (name);
cat->color = color;
if (description != NULL) {
@ -1363,7 +1363,7 @@ gst_debug_category_free (GstDebugCategory * category)
g_free ((gpointer) category->name);
g_free ((gpointer) category->description);
g_free (category);
g_slice_free (GstDebugCategory, category);
}
/**

View file

@ -241,7 +241,8 @@ gst_object_class_init (GstObjectClass * klass)
G_TYPE_PARAM);
klass->path_string_separator = "/";
klass->lock = g_new0 (GStaticRecMutex, 1);
/* FIXME 0.11: Store this directly in the class struct */
klass->lock = g_slice_new (GStaticRecMutex);
g_static_rec_mutex_init (klass->lock);
klass->signal_object = g_object_newv (gst_signal_object_get_type (), 0, NULL);

View file

@ -375,7 +375,8 @@ gst_pad_init (GstPad * pad)
pad->preroll_lock = g_mutex_new ();
pad->preroll_cond = g_cond_new ();
pad->stream_rec_lock = g_new (GStaticRecMutex, 1);
/* FIXME 0.11: Store this directly in the instance struct */
pad->stream_rec_lock = g_slice_new (GStaticRecMutex);
g_static_rec_mutex_init (pad->stream_rec_lock);
pad->block_cond = g_cond_new ();
@ -430,7 +431,7 @@ gst_pad_finalize (GObject * object)
if (pad->stream_rec_lock) {
g_static_rec_mutex_free (pad->stream_rec_lock);
g_free (pad->stream_rec_lock);
g_slice_free (GStaticRecMutex, pad->stream_rec_lock);
pad->stream_rec_lock = NULL;
}
if (pad->preroll_lock) {
@ -3131,7 +3132,7 @@ static void
int_link_iter_data_free (IntLinkIterData * data)
{
g_list_free (data->list);
g_free (data);
g_slice_free (IntLinkIterData, data);
}
#endif
@ -3185,7 +3186,7 @@ gst_pad_iterate_internal_links_default (GstPad * pad)
* INTLINKFUNC() returned a different list but then this would only work if
* two concurrent iterators were used and the last iterator would still be
* thread-unsafe. Just don't use this method anymore. */
data = g_new0 (IntLinkIterData, 1);
data = g_slice_new (IntLinkIterData);
data->list = GST_PAD_INTLINKFUNC (pad) (pad);
data->cookie = 0;

View file

@ -1531,7 +1531,7 @@ gst_plugin_ext_dep_free (GstPluginDep * dep)
g_strfreev (dep->env_vars);
g_strfreev (dep->paths);
g_strfreev (dep->names);
g_free (dep);
g_slice_free (GstPluginDep, dep);
}
static gboolean
@ -1612,7 +1612,7 @@ gst_plugin_add_dependency (GstPlugin * plugin, const gchar ** env_vars,
}
}
dep = g_new0 (GstPluginDep, 1);
dep = g_slice_new (GstPluginDep);
dep->env_vars = g_strdupv ((gchar **) env_vars);
dep->paths = g_strdupv ((gchar **) paths);

View file

@ -135,7 +135,7 @@ static gboolean plugin_loader_sync_with_child (GstPluginLoader * l);
static GstPluginLoader *
plugin_loader_new (GstRegistry * registry)
{
GstPluginLoader *l = g_new0 (GstPluginLoader, 1);
GstPluginLoader *l = g_slice_new0 (GstPluginLoader);
if (registry)
l->registry = gst_object_ref (registry);
@ -196,12 +196,12 @@ plugin_loader_free (GstPluginLoader * loader)
while (cur) {
PendingPluginEntry *entry = (PendingPluginEntry *) (cur->data);
g_free (entry->filename);
g_free (entry);
g_slice_free (PendingPluginEntry, entry);
cur = g_list_delete_link (cur, cur);
}
g_free (loader);
g_slice_free (GstPluginLoader, loader);
return got_plugin_details;
}
@ -220,7 +220,7 @@ plugin_loader_load (GstPluginLoader * loader, const gchar * filename,
GST_LOG_OBJECT (loader->registry,
"Sending file %s to child. tag %u", filename, loader->next_tag);
entry = g_new (PendingPluginEntry, 1);
entry = g_slice_new (PendingPluginEntry);
entry->tag = loader->next_tag++;
entry->filename = g_strdup (filename);
entry->file_size = file_size;
@ -644,9 +644,7 @@ do_plugin_load (GstPluginLoader * l, const gchar * filename, guint tag)
GstRegistryChunk *cur = walk->data;
put_chunk (l, cur, &offset);
if (!(cur->flags & GST_REGISTRY_CHUNK_FLAG_CONST))
g_free (cur->data);
g_free (cur);
_priv_gst_registry_chunk_free (cur);
}
g_list_free (chunks);
@ -677,9 +675,7 @@ fail:
for (walk = chunks; walk; walk = g_list_next (walk)) {
GstRegistryChunk *cur = walk->data;
if (!(cur->flags & GST_REGISTRY_CHUNK_FLAG_CONST))
g_free (cur->data);
g_free (cur);
_priv_gst_registry_chunk_free (cur);
}
g_list_free (chunks);
@ -764,7 +760,7 @@ handle_rx_packet (GstPluginLoader * l,
} else {
cur = g_list_delete_link (cur, cur);
g_free (e->filename);
g_free (e);
g_slice_free (PendingPluginEntry, e);
}
}
@ -798,7 +794,7 @@ handle_rx_packet (GstPluginLoader * l,
if (entry != NULL) {
g_free (entry->filename);
g_free (entry);
g_slice_free (PendingPluginEntry, entry);
}
/* Remove the plugin entry we just loaded */

View file

@ -238,7 +238,7 @@ gst_query_type_register (const gchar * nick, const gchar * description)
if (lookup != GST_QUERY_NONE)
return lookup;
query = g_new0 (GstQueryTypeDefinition, 1);
query = g_slice_new (GstQueryTypeDefinition);
query->value = _n_values;
query->nick = g_strdup (nick);
query->description = g_strdup (description);

View file

@ -101,7 +101,7 @@ typedef struct BinaryRegistryCache
static BinaryRegistryCache *
gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
{
BinaryRegistryCache *cache = g_new0 (BinaryRegistryCache, 1);
BinaryRegistryCache *cache = g_slice_new0 (BinaryRegistryCache);
cache->location = location;
return cache;
}
@ -155,7 +155,7 @@ gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
}
g_free (cache->mem);
g_free (cache);
g_slice_free (BinaryRegistryCache, cache);
return ret;
}
@ -171,7 +171,7 @@ typedef struct BinaryRegistryCache
static BinaryRegistryCache *
gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
{
BinaryRegistryCache *cache = g_new0 (BinaryRegistryCache, 1);
BinaryRegistryCache *cache = g_slice_new0 (BinaryRegistryCache);
cache->location = location;
cache->tmp_location = g_strconcat (location, ".tmpXXXXXX", NULL);
@ -192,7 +192,7 @@ gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
if (cache->cache_fd == -1) {
GST_DEBUG ("g_mkstemp() failed: %s", g_strerror (errno));
g_free (cache->tmp_location);
g_free (cache);
g_slice_free (BinaryRegistryCache, cache);
return NULL;
}
}
@ -241,7 +241,7 @@ gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
}
g_free (cache->tmp_location);
g_free (cache);
g_slice_free (BinaryRegistryCache, cache);
GST_INFO ("Wrote binary registry cache");
return TRUE;
@ -250,7 +250,7 @@ fail_after_close:
{
g_unlink (cache->tmp_location);
g_free (cache->tmp_location);
g_free (cache);
g_slice_free (BinaryRegistryCache, cache);
return FALSE;
}
fsync_failed:
@ -398,9 +398,8 @@ gst_registry_binary_write_cache (GstRegistry * registry, const char *location)
gboolean res;
res = gst_registry_binary_write_chunk (cache, cur, &file_position);
if (!(cur->flags & GST_REGISTRY_CHUNK_FLAG_CONST))
g_free (cur->data);
g_free (cur);
_priv_gst_registry_chunk_free (cur);
walk->data = NULL;
if (!res)
goto fail_free_list;
@ -418,11 +417,8 @@ fail_free_list:
for (walk = to_write; walk; walk = g_list_next (walk)) {
GstRegistryChunk *cur = walk->data;
if (cur) {
if (!(cur->flags & GST_REGISTRY_CHUNK_FLAG_CONST))
g_free (cur->data);
g_free (cur);
}
if (cur)
_priv_gst_registry_chunk_free (cur);
}
g_list_free (to_write);

View file

@ -96,6 +96,18 @@ _strnlen (const gchar * str, gint maxlen)
#define alignment(_address) (gsize)_address%ALIGNMENT
#define align(_ptr) _ptr += (( alignment(_ptr) == 0) ? 0 : ALIGNMENT-alignment(_ptr))
void
_priv_gst_registry_chunk_free (GstRegistryChunk * chunk)
{
if (!(chunk->flags & GST_REGISTRY_CHUNK_FLAG_CONST)) {
if ((chunk->flags & GST_REGISTRY_CHUNK_FLAG_MALLOC))
g_free (chunk->data);
else
g_slice_free1 (chunk->size, chunk->data);
}
g_slice_free (GstRegistryChunk, chunk);
}
/*
* gst_registry_chunks_save_const_string:
*
@ -113,7 +125,7 @@ gst_registry_chunks_save_const_string (GList ** list, const gchar * str)
str = "";
}
chunk = g_malloc (sizeof (GstRegistryChunk));
chunk = g_slice_new (GstRegistryChunk);
chunk->data = (gpointer) str;
chunk->size = strlen ((gchar *) chunk->data) + 1;
chunk->flags = GST_REGISTRY_CHUNK_FLAG_CONST;
@ -134,10 +146,10 @@ gst_registry_chunks_save_string (GList ** list, gchar * str)
{
GstRegistryChunk *chunk;
chunk = g_malloc (sizeof (GstRegistryChunk));
chunk = g_slice_new (GstRegistryChunk);
chunk->data = str;
chunk->size = strlen ((gchar *) chunk->data) + 1;
chunk->flags = GST_REGISTRY_CHUNK_FLAG_NONE;
chunk->flags = GST_REGISTRY_CHUNK_FLAG_MALLOC;
chunk->align = FALSE;
*list = g_list_prepend (*list, chunk);
return TRUE;
@ -155,7 +167,7 @@ gst_registry_chunks_make_data (gpointer data, gulong size)
{
GstRegistryChunk *chunk;
chunk = g_malloc (sizeof (GstRegistryChunk));
chunk = g_slice_new (GstRegistryChunk);
chunk->data = data;
chunk->size = size;
chunk->flags = GST_REGISTRY_CHUNK_FLAG_NONE;
@ -178,7 +190,7 @@ gst_registry_chunks_save_pad_template (GList ** list,
GstRegistryChunkPadTemplate *pt;
GstRegistryChunk *chk;
pt = g_malloc0 (sizeof (GstRegistryChunkPadTemplate));
pt = g_slice_new (GstRegistryChunkPadTemplate);
chk =
gst_registry_chunks_make_data (pt, sizeof (GstRegistryChunkPadTemplate));
@ -219,7 +231,7 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
GstRegistryChunkElementFactory *ef;
GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
ef = g_malloc0 (sizeof (GstRegistryChunkElementFactory));
ef = g_slice_new (GstRegistryChunkElementFactory);
chk =
gst_registry_chunks_make_data (ef,
sizeof (GstRegistryChunkElementFactory));
@ -279,7 +291,7 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
gchar *str;
tff = g_malloc0 (sizeof (GstRegistryChunkTypeFindFactory));
tff = g_slice_new (GstRegistryChunkTypeFindFactory);
chk =
gst_registry_chunks_make_data (tff,
sizeof (GstRegistryChunkTypeFindFactory));
@ -309,11 +321,10 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
} else if (GST_IS_INDEX_FACTORY (feature)) {
GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
pf = g_malloc0 (sizeof (GstRegistryChunkPluginFeature));
pf = g_slice_new (GstRegistryChunkPluginFeature);
chk =
gst_registry_chunks_make_data (pf,
sizeof (GstRegistryChunkPluginFeature));
pf->rank = feature->rank;
/* pack element factory strings */
gst_registry_chunks_save_const_string (list, factory->longdesc);
@ -346,7 +357,7 @@ gst_registry_chunks_save_plugin_dep (GList ** list, GstPluginDep * dep)
GstRegistryChunk *chk;
gchar **s;
ed = g_malloc0 (sizeof (GstRegistryChunkDep));
ed = g_slice_new (GstRegistryChunkDep);
chk = gst_registry_chunks_make_data (ed, sizeof (GstRegistryChunkDep));
ed->flags = dep->flags;
@ -388,7 +399,7 @@ _priv_gst_registry_chunks_save_plugin (GList ** list, GstRegistry * registry,
GList *plugin_features = NULL;
GList *walk;
pe = g_malloc0 (sizeof (GstRegistryChunkPluginElement));
pe = g_slice_new (GstRegistryChunkPluginElement);
chk =
gst_registry_chunks_make_data (pe,
sizeof (GstRegistryChunkPluginElement));
@ -473,9 +484,10 @@ gst_registry_chunks_load_pad_template (GstElementFactory * factory, gchar ** in,
*in);
unpack_element (*in, pt, GstRegistryChunkPadTemplate, end, fail);
template = g_new0 (GstStaticPadTemplate, 1);
template = g_slice_new (GstStaticPadTemplate);
template->presence = pt->presence;
template->direction = pt->direction;
template->static_caps.caps.refcount = 0;
/* unpack pad template strings */
unpack_const_string (*in, template->name_template, end, fail);
@ -487,7 +499,8 @@ gst_registry_chunks_load_pad_template (GstElementFactory * factory, gchar ** in,
return TRUE;
fail:
GST_INFO ("Reading pad template failed");
g_free (template);
if (template)
g_slice_free (GstStaticPadTemplate, template);
return FALSE;
}
@ -690,7 +703,7 @@ gst_registry_chunks_load_plugin_dep (GstPlugin * plugin, gchar ** in,
GST_LOG_OBJECT (plugin, "Unpacking GstRegistryChunkDep from %p", *in);
unpack_element (*in, d, GstRegistryChunkDep, end, fail);
dep = g_malloc0 (sizeof (GstPluginDep));
dep = g_slice_new (GstPluginDep);
dep->env_hash = d->env_hash;
dep->stat_hash = d->stat_hash;

View file

@ -28,11 +28,13 @@
/*
* we reference strings directly from the plugins and in this case set CONST to
* avoid freeing them
* avoid freeing them. If g_free() should be used, the MALLOC flag is set,
* otherwise g_slice_free1() will be used!
*/
enum {
GST_REGISTRY_CHUNK_FLAG_NONE = 0,
GST_REGISTRY_CHUNK_FLAG_CONST = 1
GST_REGISTRY_CHUNK_FLAG_CONST = 1,
GST_REGISTRY_CHUNK_FLAG_MALLOC = 2,
};
/*
@ -145,6 +147,9 @@ gboolean
_priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
gchar *end, GstPlugin **out_plugin);
void
_priv_gst_registry_chunk_free (GstRegistryChunk *chunk);
G_END_DECLS
#endif /* __GST_REGISTRYCHUNKS_H__ */

View file

@ -439,7 +439,7 @@ gst_tag_register (const gchar * name, GstTagFlag flag, GType type,
return;
}
info = g_new (GstTagInfo, 1);
info = g_slice_new (GstTagInfo);
info->flag = flag;
info->type = type;
info->nick = g_strdup (nick);

View file

@ -130,7 +130,7 @@ gst_tag_data_free (gpointer p)
if (data->list)
gst_tag_list_free (data->list);
g_free (data);
g_slice_free (GstTagData, data);
}
static GstTagData *
@ -140,7 +140,7 @@ gst_tag_setter_get_data (GstTagSetter * setter)
data = g_object_get_qdata (G_OBJECT (setter), gst_tag_key);
if (!data) {
data = g_new (GstTagData, 1);
data = g_slice_new (GstTagData);
data->list = NULL;
data->mode = GST_TAG_MERGE_KEEP;
g_object_set_qdata_full (G_OBJECT (setter), gst_tag_key, data,

View file

@ -113,7 +113,7 @@ gint _gst_trace_on = 1;
GstTrace *
gst_trace_new (const gchar * filename, gint size)
{
GstTrace *trace = g_malloc (sizeof (GstTrace));
GstTrace *trace = g_slice_new (GstTrace);
g_return_val_if_fail (trace != NULL, NULL);
trace->filename = g_strdup (filename);
@ -152,7 +152,7 @@ gst_trace_destroy (GstTrace * trace)
gst_trace_flush (trace);
close (trace->fd);
g_free (trace->buf);
g_free (trace);
g_slice_free (GstTrace, trace);
}
/**
@ -285,7 +285,7 @@ _gst_alloc_trace_register (const gchar * name)
g_return_val_if_fail (name, NULL);
trace = g_new0 (GstAllocTrace, 1);
trace = g_slice_new (GstAllocTrace);
trace->name = g_strdup (name);
trace->live = 0;
trace->mem_live = NULL;