Bug 615379 - g_new macros crash if sizeof(struct_type) == 0

This commit is contained in:
Behdad Esfahbod 2010-04-22 19:48:13 -04:00
parent 7b43d2d299
commit 00a7c2e635

View File

@ -88,7 +88,7 @@ gpointer g_try_realloc_n (gpointer mem,
if (__s == 1) \
__p = g_##func (__n); \
else if (__builtin_constant_p (__n) && \
__n <= G_MAXSIZE / __s) \
(__s == 0 || __n <= G_MAXSIZE / __s)) \
__p = g_##func (__n * __s); \
else \
__p = g_##func##_n (__n, __s); \
@ -102,7 +102,7 @@ gpointer g_try_realloc_n (gpointer mem,
if (__s == 1) \
__p = g_##func (__p, __n); \
else if (__builtin_constant_p (__n) && \
__n <= G_MAXSIZE / __s) \
(__s == 0 || __n <= G_MAXSIZE / __s)) \
__p = g_##func (__p, __n * __s); \
else \
__p = g_##func##_n (__p, __n, __s); \