Bug 608196 - Overflow-safe g_new family

Remove the macros for the g_malloc_n family -- calls directly to those
functions now always go directly to those functions.

Reimplement the macros for g_new and friends.

Remove the branch that checked for calling g_new() with a constant
n_structs == 1.  With the struct size always known this case will now be
caught under the case that does the inline multiplication and the
multiplication by 1 will be optimised away.
This commit is contained in:
Ryan Lortie
2010-03-06 23:21:27 -05:00
parent 01ef92178b
commit a1b9743e18
2 changed files with 36 additions and 57 deletions

View File

@@ -37,14 +37,6 @@
#include "glib.h"
#include "gthreadprivate.h"
/* Undef the macros before including galias.h */
#undef g_malloc_n
#undef g_malloc0_n
#undef g_realloc_n
#undef g_try_malloc_n
#undef g_try_malloc0_n
#undef g_try_realloc_n
#include "galias.h"
#define MEM_PROFILE_TABLE_SIZE 4096