conditionally define NULL, FALSE and TRUE. (g_mem_chunk_create): new

Wed May 20 05:02:26 1998  Tim Janik  <timj@gtk.org>

        * glib.h: conditionally define NULL, FALSE and TRUE.
        (g_mem_chunk_create): new convenience macro as a short hand for
        g_mem_chunk_new().
        (g_chunk_free): new convenience macro to be consistent with g_chunk_new.
This commit is contained in:
Tim Janik 1998-05-20 03:31:30 +00:00 committed by Tim Janik
parent eb3e74cae9
commit 2abec112dc
2 changed files with 46 additions and 28 deletions

View File

@ -1,3 +1,10 @@
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
* glib.h: conditionally define NULL, FALSE and TRUE.
(g_mem_chunk_create): new convenience macro as a short hand for
g_mem_chunk_new().
(g_chunk_free): new convenience macro to be consistent with g_chunk_new.
Tue, 19 May 1998 09:00:02 +0200 §Paolo Molaro <lupus@debian.org>
* gcompletion.c: generic functions for com<TAB>pletion...

View File

@ -89,16 +89,21 @@
/* Provide definitions for some commonly used macros.
* Some of them are only provided if they haven't already
* been defined. It is assumed that if they are already
* defined then the current definition is correct.
*/
#undef NULL
#ifndef NULL
#define NULL ((void*) 0)
#endif
#undef FALSE
#define FALSE 0
#ifndef FALSE
#define FALSE (0)
#endif
#undef TRUE
#define TRUE 1
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#undef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
@ -136,7 +141,7 @@
# endif
#endif
/* Provide macros to feature GCC function attributes.
/* Provide macros to feature the GCC function attribute.
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
@ -196,15 +201,22 @@
((type *) g_malloc0 ((unsigned) sizeof (type) * (count)))
#endif /* __DMALLOC_H__ */
#define g_chunk_new(type, chunk) \
((type *) g_mem_chunk_alloc (chunk))
#define g_mem_chunk_create(type, pre_alloc, alloc_type) ( \
g_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \
sizeof (type), \
sizeof (type) * (pre_alloc), \
(alloc_type)) \
)
#define g_chunk_new(type, chunk) ( \
(type *) g_mem_chunk_alloc (chunk) \
)
#define g_chunk_free(mem, mem_chunk) G_STMT_START { \
g_mem_chunk_free ((mem_chunk), (mem)); \
} G_STMT_END
#define g_string(x) #x
/* Provide macros for error handling. The "assert" macros will
* exit on failure. The "return" macros will exit the current
* function. Two different definitions are given for the macros
@ -310,7 +322,6 @@
#endif /* G_DISABLE_CHECKS */
#ifdef __cplusplus
extern "C" {
#pragma }
@ -857,7 +868,7 @@ guint g_str_hash (const gpointer v);
guint g_direct_hash (gpointer key);
/* Associated Data
/* Location Associated Data
*/
void g_dataset_destroy (const gpointer dataset_location);
guint g_dataset_try_key (const gchar *key);