diff options
author | Tim Janik <timj@src.gnome.org> | 1998-09-19 01:12:06 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-09-19 01:12:06 +0000 |
commit | eeb971d1b95d5894bff1629c4c15a916646bc5d3 (patch) | |
tree | 81554be4ea78f7e7d102c14b5a57c99b914c01fd /gstrfuncs.c | |
parent | 0dbf1d8cc4d24c1c1f552a627cf7fcb865ba775b (diff) | |
download | glib-eeb971d1b95d5894bff1629c4c15a916646bc5d3.tar.gz |
minor g_memdup() fixups
Diffstat (limited to 'gstrfuncs.c')
-rw-r--r-- | gstrfuncs.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gstrfuncs.c b/gstrfuncs.c index d4777368c..721509bbf 100644 --- a/gstrfuncs.c +++ b/gstrfuncs.c @@ -43,13 +43,21 @@ g_strdup (const gchar *str) return new_str; } -guint8* -g_memdup (const guint8 *mem, - guint len) +gpointer +g_memdup (gconstpointer mem, + guint byte_size) { - guint8* mem2 = g_malloc (len); - memcpy (mem2, mem, len); - return mem2; + gpointer new_mem; + + if (mem) + { + new_mem = g_malloc (byte_size); + memcpy (new_mem, mem, byte_size); + } + else + new_mem = NULL; + + return new_mem; } gchar* |