[glib] Cosmetic
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Cosmetic
- Date: Mon, 8 Mar 2010 19:33:46 +0000 (UTC)
commit c69e6fd837cb92d0c7050d8ea2d0f98b6f70fbe8
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Mar 8 14:28:23 2010 -0500
Cosmetic
glib/gmem.h | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/glib/gmem.h b/glib/gmem.h
index 78950d5..2fef766 100644
--- a/glib/gmem.h
+++ b/glib/gmem.h
@@ -83,27 +83,29 @@ gpointer g_try_realloc_n (gpointer mem,
# define _G_NEW(struct_type, n_structs, func) \
(struct_type *) (__extension__ ({ \
gsize __n = (gsize) (n_structs); \
+ gsize __s = sizeof (struct_type); \
gpointer __p; \
- if (sizeof (struct_type) == 1) \
+ if (__s == 1) \
__p = g_##func (__n); \
else if (__builtin_constant_p (__n) && \
- __n <= G_MAXSIZE / sizeof (struct_type)) \
- __p = g_##func (__n * sizeof (struct_type)); \
+ __n <= G_MAXSIZE / __s) \
+ __p = g_##func (__n * __s); \
else \
- __p = g_##func##_n (__n, sizeof (struct_type)); \
+ __p = g_##func##_n (__n, __s); \
__p; \
}))
# define _G_RENEW(struct_type, mem, n_structs, func) \
(struct_type *) (__extension__ ({ \
gsize __n = (gsize) (n_structs); \
+ gsize __s = sizeof (struct_type); \
gpointer __p = (gpointer) (mem); \
- if (sizeof (struct_type) == 1) \
+ if (__s == 1) \
__p = g_##func (__p, __n); \
else if (__builtin_constant_p (__n) && \
- __n <= G_MAXSIZE / sizeof (struct_type)) \
- __p = g_##func (__p, __n * sizeof (struct_type)); \
+ __n <= G_MAXSIZE / __s) \
+ __p = g_##func (__p, __n * __s); \
else \
- __p = g_##func##_n (__p, __n, sizeof (struct_type));\
+ __p = g_##func##_n (__p, __n, __s); \
__p; \
}))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]