changeset 4556:332d2992e04c

Use gsize and g_realloc in smart_realloc().
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 18 May 2008 21:11:14 +0300
parents 961906c766e4
children 2eee464379dc
files src/audacious/util.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/util.c	Sun May 18 16:54:22 2008 +0200
+++ b/src/audacious/util.c	Sun May 18 21:11:14 2008 +0300
@@ -1036,10 +1036,8 @@
 gpointer
 smart_realloc(gpointer ptr, gsize *size)
 {
-    *size = (size_t)pow(2, ceil(log(*size) / log(2)) + 1);
-    if (ptr != NULL) free(ptr);
-    ptr = malloc(*size);
-    return ptr;
+    *size = (gsize)pow(2, ceil(log(*size) / log(2)) + 1);
+    return g_realloc(ptr, *size);
 }
 
 void