Mercurial > audlegacy
comparison src/audacious/util.c @ 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 | 8f36cce36fef |
children | a7392e85d4c6 |
comparison
equal
deleted
inserted
replaced
4554:961906c766e4 | 4556:332d2992e04c |
---|---|
1034 * XXX: what's so smart about this?? seems wasteful and silly. --nenolod | 1034 * XXX: what's so smart about this?? seems wasteful and silly. --nenolod |
1035 */ | 1035 */ |
1036 gpointer | 1036 gpointer |
1037 smart_realloc(gpointer ptr, gsize *size) | 1037 smart_realloc(gpointer ptr, gsize *size) |
1038 { | 1038 { |
1039 *size = (size_t)pow(2, ceil(log(*size) / log(2)) + 1); | 1039 *size = (gsize)pow(2, ceil(log(*size) / log(2)) + 1); |
1040 if (ptr != NULL) free(ptr); | 1040 return g_realloc(ptr, *size); |
1041 ptr = malloc(*size); | |
1042 return ptr; | |
1043 } | 1041 } |
1044 | 1042 |
1045 void | 1043 void |
1046 make_directory(const gchar * path, mode_t mode) | 1044 make_directory(const gchar * path, mode_t mode) |
1047 { | 1045 { |