mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
registry: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
This commit is contained in:
parent
e675519a2c
commit
ade83c8355
7 changed files with 41 additions and 41 deletions
|
@ -163,7 +163,7 @@ gst_element_factory_cleanup (GstElementFactory * factory)
|
|||
GstStaticPadTemplate *templ = item->data;
|
||||
|
||||
gst_static_caps_cleanup (&templ->static_caps);
|
||||
g_slice_free (GstStaticPadTemplate, templ);
|
||||
g_free (templ);
|
||||
}
|
||||
g_list_free (factory->staticpadtemplates);
|
||||
factory->staticpadtemplates = NULL;
|
||||
|
@ -257,7 +257,7 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
GstStaticPadTemplate *newt;
|
||||
gchar *caps_string = gst_caps_to_string (templ->caps);
|
||||
|
||||
newt = g_slice_new (GstStaticPadTemplate);
|
||||
newt = g_new (GstStaticPadTemplate, 1);
|
||||
newt->name_template = g_intern_string (templ->name_template);
|
||||
newt->direction = templ->direction;
|
||||
newt->presence = templ->presence;
|
||||
|
|
|
@ -1881,7 +1881,7 @@ gst_plugin_ext_dep_free (GstPluginDep * dep)
|
|||
g_strfreev (dep->env_vars);
|
||||
g_strfreev (dep->paths);
|
||||
g_strfreev (dep->names);
|
||||
g_slice_free (GstPluginDep, dep);
|
||||
g_free (dep);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1960,7 +1960,7 @@ gst_plugin_add_dependency (GstPlugin * plugin, const gchar ** env_vars,
|
|||
}
|
||||
}
|
||||
|
||||
dep = g_slice_new (GstPluginDep);
|
||||
dep = g_new (GstPluginDep, 1);
|
||||
|
||||
dep->env_vars = g_strdupv ((gchar **) env_vars);
|
||||
dep->paths = g_strdupv ((gchar **) paths);
|
||||
|
|
|
@ -147,7 +147,7 @@ static gboolean plugin_loader_sync_with_child (GstPluginLoader * l);
|
|||
static GstPluginLoader *
|
||||
plugin_loader_new (GstRegistry * registry)
|
||||
{
|
||||
GstPluginLoader *l = g_slice_new0 (GstPluginLoader);
|
||||
GstPluginLoader *l = g_new0 (GstPluginLoader, 1);
|
||||
|
||||
if (registry)
|
||||
l->registry = gst_object_ref (registry);
|
||||
|
@ -211,12 +211,12 @@ plugin_loader_free (GstPluginLoader * loader)
|
|||
while (cur) {
|
||||
PendingPluginEntry *entry = (PendingPluginEntry *) (cur->data);
|
||||
g_free (entry->filename);
|
||||
g_slice_free (PendingPluginEntry, entry);
|
||||
g_free (entry);
|
||||
|
||||
cur = g_list_delete_link (cur, cur);
|
||||
}
|
||||
|
||||
g_slice_free (GstPluginLoader, loader);
|
||||
g_free (loader);
|
||||
|
||||
return got_plugin_details;
|
||||
}
|
||||
|
@ -235,7 +235,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_slice_new (PendingPluginEntry);
|
||||
entry = g_new (PendingPluginEntry, 1);
|
||||
entry->tag = loader->next_tag++;
|
||||
entry->filename = g_strdup (filename);
|
||||
entry->file_size = file_size;
|
||||
|
@ -283,7 +283,7 @@ restart:
|
|||
/* Now remove this crashy plugin from the head of the list */
|
||||
l->pending_plugins = g_list_delete_link (cur, cur);
|
||||
g_free (entry->filename);
|
||||
g_slice_free (PendingPluginEntry, entry);
|
||||
g_free (entry);
|
||||
if (l->pending_plugins == NULL)
|
||||
l->pending_plugins_tail = NULL;
|
||||
if (!gst_plugin_loader_spawn (l))
|
||||
|
@ -982,7 +982,7 @@ handle_rx_packet (GstPluginLoader * l,
|
|||
} else {
|
||||
cur = g_list_delete_link (cur, cur);
|
||||
g_free (e->filename);
|
||||
g_slice_free (PendingPluginEntry, e);
|
||||
g_free (e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1016,7 +1016,7 @@ handle_rx_packet (GstPluginLoader * l,
|
|||
|
||||
if (entry != NULL) {
|
||||
g_free (entry->filename);
|
||||
g_slice_free (PendingPluginEntry, entry);
|
||||
g_free (entry);
|
||||
}
|
||||
|
||||
/* Remove the plugin entry we just loaded */
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef struct BinaryRegistryCache
|
|||
static BinaryRegistryCache *
|
||||
gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
|
||||
{
|
||||
BinaryRegistryCache *cache = g_slice_new0 (BinaryRegistryCache);
|
||||
BinaryRegistryCache *cache = g_new0 (BinaryRegistryCache, 1);
|
||||
cache->location = location;
|
||||
return cache;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
|
|||
}
|
||||
|
||||
g_free (cache->mem);
|
||||
g_slice_free (BinaryRegistryCache, cache);
|
||||
g_free (cache);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ typedef struct BinaryRegistryCache
|
|||
static BinaryRegistryCache *
|
||||
gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
|
||||
{
|
||||
BinaryRegistryCache *cache = g_slice_new0 (BinaryRegistryCache);
|
||||
BinaryRegistryCache *cache = g_new0 (BinaryRegistryCache, 1);
|
||||
int fd;
|
||||
|
||||
cache->location = location;
|
||||
|
@ -203,7 +203,7 @@ gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
|
|||
if (fd == -1) {
|
||||
GST_DEBUG ("g_mkstemp() failed: %s", g_strerror (errno));
|
||||
g_free (cache->tmp_location);
|
||||
g_slice_free (BinaryRegistryCache, cache);
|
||||
g_free (cache);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ gst_registry_binary_cache_init (GstRegistry * registry, const char *location)
|
|||
GST_DEBUG ("fdopen() failed: %s", g_strerror (errno));
|
||||
close (fd);
|
||||
g_free (cache->tmp_location);
|
||||
g_slice_free (BinaryRegistryCache, cache);
|
||||
g_free (cache);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ gst_registry_binary_cache_finish (BinaryRegistryCache * cache, gboolean success)
|
|||
}
|
||||
|
||||
g_free (cache->tmp_location);
|
||||
g_slice_free (BinaryRegistryCache, cache);
|
||||
g_free (cache);
|
||||
GST_INFO ("Wrote binary registry cache");
|
||||
return TRUE;
|
||||
|
||||
|
@ -324,7 +324,7 @@ fail_after_fclose:
|
|||
{
|
||||
g_unlink (cache->tmp_location);
|
||||
g_free (cache->tmp_location);
|
||||
g_slice_free (BinaryRegistryCache, cache);
|
||||
g_free (cache);
|
||||
return FALSE;
|
||||
}
|
||||
fflush_failed:
|
||||
|
|
|
@ -119,9 +119,9 @@ _priv_gst_registry_chunk_free (GstRegistryChunk * chunk)
|
|||
if ((chunk->flags & GST_REGISTRY_CHUNK_FLAG_MALLOC))
|
||||
g_free (chunk->data);
|
||||
else
|
||||
g_slice_free1 (chunk->size, chunk->data);
|
||||
g_free (chunk->data);
|
||||
}
|
||||
g_slice_free (GstRegistryChunk, chunk);
|
||||
g_free (chunk);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -141,7 +141,7 @@ gst_registry_chunks_save_const_string (GList ** list, const gchar * str)
|
|||
str = "";
|
||||
}
|
||||
|
||||
chunk = g_slice_new (GstRegistryChunk);
|
||||
chunk = g_new (GstRegistryChunk, 1);
|
||||
chunk->data = (gpointer) str;
|
||||
chunk->size = strlen ((gchar *) chunk->data) + 1;
|
||||
chunk->flags = GST_REGISTRY_CHUNK_FLAG_CONST;
|
||||
|
@ -162,7 +162,7 @@ gst_registry_chunks_save_string (GList ** list, gchar * str)
|
|||
{
|
||||
GstRegistryChunk *chunk;
|
||||
|
||||
chunk = g_slice_new (GstRegistryChunk);
|
||||
chunk = g_new (GstRegistryChunk, 1);
|
||||
chunk->data = str;
|
||||
chunk->size = strlen ((gchar *) chunk->data) + 1;
|
||||
chunk->flags = GST_REGISTRY_CHUNK_FLAG_MALLOC;
|
||||
|
@ -183,7 +183,7 @@ gst_registry_chunks_make_data (gpointer data, gulong size)
|
|||
{
|
||||
GstRegistryChunk *chunk;
|
||||
|
||||
chunk = g_slice_new (GstRegistryChunk);
|
||||
chunk = g_new (GstRegistryChunk, 1);
|
||||
chunk->data = data;
|
||||
chunk->size = size;
|
||||
chunk->flags = GST_REGISTRY_CHUNK_FLAG_NONE;
|
||||
|
@ -206,7 +206,7 @@ gst_registry_chunks_save_pad_template (GList ** list,
|
|||
GstRegistryChunkPadTemplate *pt;
|
||||
GstRegistryChunk *chk;
|
||||
|
||||
pt = g_slice_new (GstRegistryChunkPadTemplate);
|
||||
pt = g_new (GstRegistryChunkPadTemplate, 1);
|
||||
chk =
|
||||
gst_registry_chunks_make_data (pt, sizeof (GstRegistryChunkPadTemplate));
|
||||
|
||||
|
@ -251,7 +251,7 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
|
|||
/* Initialize with zeroes because of struct padding and
|
||||
* valgrind complaining about copying uninitialized memory
|
||||
*/
|
||||
ef = g_slice_new0 (GstRegistryChunkElementFactory);
|
||||
ef = g_new0 (GstRegistryChunkElementFactory, 1);
|
||||
pf_size = sizeof (GstRegistryChunkElementFactory);
|
||||
chk = gst_registry_chunks_make_data (ef, pf_size);
|
||||
ef->npadtemplates = ef->ninterfaces = ef->nuriprotocols = 0;
|
||||
|
@ -311,7 +311,7 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
|
|||
/* Initialize with zeroes because of struct padding and
|
||||
* valgrind complaining about copying uninitialized memory
|
||||
*/
|
||||
tff = g_slice_new0 (GstRegistryChunkTypeFindFactory);
|
||||
tff = g_new0 (GstRegistryChunkTypeFindFactory, 1);
|
||||
pf_size = sizeof (GstRegistryChunkTypeFindFactory);
|
||||
chk = gst_registry_chunks_make_data (tff, pf_size);
|
||||
tff->nextensions = 0;
|
||||
|
@ -345,7 +345,7 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
|
|||
/* Initialize with zeroes because of struct padding and
|
||||
* valgrind complaining about copying uninitialized memory
|
||||
*/
|
||||
tff = g_slice_new0 (GstRegistryChunkDeviceProviderFactory);
|
||||
tff = g_new0 (GstRegistryChunkDeviceProviderFactory, 1);
|
||||
chk =
|
||||
gst_registry_chunks_make_data (tff,
|
||||
sizeof (GstRegistryChunkDeviceProviderFactory));
|
||||
|
@ -359,13 +359,13 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
|
|||
/* Initialize with zeroes because of struct padding and
|
||||
* valgrind complaining about copying uninitialized memory
|
||||
*/
|
||||
pf = g_slice_new0 (GstRegistryChunkPluginFeature);
|
||||
pf = g_new0 (GstRegistryChunkPluginFeature, 1);
|
||||
pf_size = sizeof (GstRegistryChunkPluginFeature);
|
||||
chk = gst_registry_chunks_make_data (pf, pf_size);
|
||||
} else if (GST_IS_DYNAMIC_TYPE_FACTORY (feature)) {
|
||||
GstRegistryChunkDynamicTypeFactory *tmp;
|
||||
|
||||
tmp = g_slice_new0 (GstRegistryChunkDynamicTypeFactory);
|
||||
tmp = g_new0 (GstRegistryChunkDynamicTypeFactory, 1);
|
||||
chk =
|
||||
gst_registry_chunks_make_data (tmp,
|
||||
sizeof (GstRegistryChunkDynamicTypeFactory));
|
||||
|
@ -387,8 +387,8 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
|
|||
|
||||
/* Errors */
|
||||
fail:
|
||||
g_slice_free (GstRegistryChunk, chk);
|
||||
g_slice_free1 (pf_size, pf);
|
||||
g_free (chk);
|
||||
g_free (pf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ gst_registry_chunks_save_plugin_dep (GList ** list, GstPluginDep * dep)
|
|||
GstRegistryChunk *chk;
|
||||
gchar **s;
|
||||
|
||||
ed = g_slice_new (GstRegistryChunkDep);
|
||||
ed = g_new (GstRegistryChunkDep, 1);
|
||||
chk = gst_registry_chunks_make_data (ed, sizeof (GstRegistryChunkDep));
|
||||
|
||||
ed->flags = dep->flags;
|
||||
|
@ -441,7 +441,7 @@ _priv_gst_registry_chunks_save_plugin (GList ** list, GstRegistry * registry,
|
|||
GList *plugin_features = NULL;
|
||||
GList *walk;
|
||||
|
||||
pe = g_slice_new (GstRegistryChunkPluginElement);
|
||||
pe = g_new (GstRegistryChunkPluginElement, 1);
|
||||
chk =
|
||||
gst_registry_chunks_make_data (pe,
|
||||
sizeof (GstRegistryChunkPluginElement));
|
||||
|
@ -502,8 +502,8 @@ _priv_gst_registry_chunks_save_plugin (GList ** list, GstRegistry * registry,
|
|||
/* Errors */
|
||||
fail:
|
||||
gst_plugin_feature_list_free (plugin_features);
|
||||
g_slice_free (GstRegistryChunk, chk);
|
||||
g_slice_free (GstRegistryChunkPluginElement, pe);
|
||||
g_free (chk);
|
||||
g_free (pe);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ gst_registry_chunks_load_pad_template (GstElementFactory * factory, gchar ** in,
|
|||
*in);
|
||||
unpack_element (*in, pt, GstRegistryChunkPadTemplate, end, fail);
|
||||
|
||||
template = g_slice_new (GstStaticPadTemplate);
|
||||
template = g_new (GstStaticPadTemplate, 1);
|
||||
template->presence = pt->presence;
|
||||
template->direction = (GstPadDirection) pt->direction;
|
||||
template->static_caps.caps = NULL;
|
||||
|
@ -543,7 +543,7 @@ gst_registry_chunks_load_pad_template (GstElementFactory * factory, gchar ** in,
|
|||
fail:
|
||||
GST_INFO ("Reading pad template failed");
|
||||
if (template)
|
||||
g_slice_free (GstStaticPadTemplate, template);
|
||||
g_free (template);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,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_slice_new (GstPluginDep);
|
||||
dep = g_new (GstPluginDep, 1);
|
||||
|
||||
dep->env_hash = d->env_hash;
|
||||
dep->stat_hash = d->stat_hash;
|
||||
|
@ -926,7 +926,7 @@ _priv_gst_registry_chunks_save_global_header (GList ** list,
|
|||
GstRegistryChunkGlobalHeader *hdr;
|
||||
GstRegistryChunk *chk;
|
||||
|
||||
hdr = g_slice_new (GstRegistryChunkGlobalHeader);
|
||||
hdr = g_new (GstRegistryChunkGlobalHeader, 1);
|
||||
chk = gst_registry_chunks_make_data (hdr,
|
||||
sizeof (GstRegistryChunkGlobalHeader));
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
/*
|
||||
* we reference strings directly from the plugins and in this case set CONST to
|
||||
* avoid freeing them. If g_free() should be used, the MALLOC flag is set,
|
||||
* otherwise g_slice_free1() will be used!
|
||||
* otherwise g_free() will also be used. (FIXME: don't need MALLOC flag any more)
|
||||
*/
|
||||
enum {
|
||||
GST_REGISTRY_CHUNK_FLAG_NONE = 0,
|
||||
|
|
|
@ -39,7 +39,7 @@ setup_pad_template (GstElementFactory * factory, GstStaticPadTemplate * tmpl)
|
|||
{
|
||||
GstStaticPadTemplate *template;
|
||||
|
||||
template = g_slice_dup (GstStaticPadTemplate, tmpl);
|
||||
template = g_memdup2 (tmpl, sizeof (GstStaticPadTemplate));
|
||||
factory->staticpadtemplates = g_list_append (factory->staticpadtemplates,
|
||||
template);
|
||||
factory->numpadtemplates++;
|
||||
|
|
Loading…
Reference in a new issue