[farsight2/master] Allocation FsCodec using GSlice
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:22:30 PST 2008
---
gst-libs/gst/farsight/fs-codec.c | 18 +++++++++---------
gst/fsrtpconference/fs-rtp-codec-cache.c | 2 +-
gst/fsrtpconference/fs-rtp-discover-codecs.c | 2 +-
python/pyfarsight.override | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index 94e396a..ef84268 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -94,7 +94,7 @@ FsCodec *
fs_codec_new (int id, const char *encoding_name,
FsMediaType media_type, guint clock_rate)
{
- FsCodec *codec = g_new0 (FsCodec, 1);
+ FsCodec *codec = g_slice_new0 (FsCodec);
codec->id = id;
codec->encoding_name = g_strdup (encoding_name);
@@ -125,12 +125,12 @@ fs_codec_destroy (FsCodec * codec)
optional_param = (FsCodecParameter *) lp->data;
g_free (optional_param->name);
g_free (optional_param->value);
- g_free (optional_param);
+ g_slice_free (FsCodecParameter, optional_param);
}
g_list_free (codec->optional_params);
}
- g_free (codec);
+ g_slice_free (FsCodec, codec);
}
/**
@@ -149,7 +149,7 @@ fs_codec_copy (const FsCodec * codec)
if (codec == NULL)
return NULL;
- copy = g_new0 (FsCodec, 1);
+ copy = g_slice_new0 (FsCodec);
copy->id = codec->id;
copy->media_type = codec->media_type;
@@ -166,7 +166,7 @@ fs_codec_copy (const FsCodec * codec)
FsCodecParameter *param_copy;
for (lp = codec->optional_params; lp; lp = g_list_next (lp)) {
- param_copy = g_new0(FsCodecParameter,1);
+ param_copy = g_slice_new (FsCodecParameter);
param = (FsCodecParameter *) lp->data;
param_copy->name = g_strdup (param->name);
param_copy->value = g_strdup (param->value);
@@ -274,7 +274,7 @@ fs_codec_list_from_keyfile (const gchar *filename, GError **error)
goto out;
for (i=0; i < groups_count && groups[i]; i++) {
- FsCodec *codec = g_new0 (FsCodec, 1);
+ FsCodec *codec = g_slice_new0 (FsCodec);
gchar **keys = NULL;
gsize keys_count;
int j;
@@ -360,7 +360,7 @@ fs_codec_list_from_keyfile (const gchar *filename, GError **error)
}
} else {
- FsCodecParameter *param = g_new0 (FsCodecParameter, 1);
+ FsCodecParameter *param = g_slice_new (FsCodecParameter);
param->name = g_strdup (keys[j]);
param->value = g_key_file_get_string (keyfile, groups[i], keys[j],
@@ -368,14 +368,14 @@ fs_codec_list_from_keyfile (const gchar *filename, GError **error)
if (gerror) {
g_free (param->name);
g_free (param->value);
- g_free (param);
+ g_slice_free (FsCodecParameter, param);
goto keyerror;
}
if (!param->name || !param->value) {
g_free (param->name);
g_free (param->value);
- g_free (param);
+ g_slice_free (FsCodecParameter, param);
} else {
codec->optional_params = g_list_append (codec->optional_params,
param);
diff --git a/gst/fsrtpconference/fs-rtp-codec-cache.c b/gst/fsrtpconference/fs-rtp-codec-cache.c
index 066d4bb..e08d829 100644
--- a/gst/fsrtpconference/fs-rtp-codec-cache.c
+++ b/gst/fsrtpconference/fs-rtp-codec-cache.c
@@ -168,7 +168,7 @@ load_codec_blueprint (FsMediaType media_type, gchar **in, gsize *size) {
gint tmp_size;
int i;
- codec_blueprint->codec = g_new0 (FsCodec, 1);
+ codec_blueprint->codec = g_slice_new0 (FsCodec);
codec_blueprint->codec->media_type = media_type;
READ_CHECK (read_codec_blueprint_int
diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.c b/gst/fsrtpconference/fs-rtp-discover-codecs.c
index 6a34c77..899ab11 100644
--- a/gst/fsrtpconference/fs-rtp-discover-codecs.c
+++ b/gst/fsrtpconference/fs-rtp-discover-codecs.c
@@ -506,7 +506,7 @@ parse_codec_cap_list (GList *list, FsMediaType media_type)
{
codec_cap = (CodecCap *)(walk->data);
- codec = g_new0 (FsCodec, 1);
+ codec = g_slice_new0 (FsCodec);
codec->id = FS_CODEC_ID_ANY;
codec->clock_rate = 0;
diff --git a/python/pyfarsight.override b/python/pyfarsight.override
index a476ed6..10d8a10 100644
--- a/python/pyfarsight.override
+++ b/python/pyfarsight.override
@@ -378,7 +378,7 @@ _wrap_fs_codec_tp_setattr(PyObject *self, char *attr, PyObject *value)
FsCodecParameter *param = p->data;
g_free (param->name);
g_free (param->value);
- g_free (p->data);
+ g_slice_free (FsCodecParameter, p->data);
}
g_list_free (codec->optional_params);
--
1.5.6.5
More information about the farsight-commits
mailing list