forked from AuroraMiddleware/gtk
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:
parent
eb3e74cae9
commit
2abec112dc
@ -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...
|
||||
|
67
glib/glib.h
67
glib/glib.h
@ -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.
|
||||
*/
|
||||
#ifndef NULL
|
||||
#define NULL ((void*) 0)
|
||||
#endif
|
||||
|
||||
#undef NULL
|
||||
#define NULL ((void*) 0)
|
||||
#ifndef FALSE
|
||||
#define FALSE (0)
|
||||
#endif
|
||||
|
||||
#undef FALSE
|
||||
#define FALSE 0
|
||||
|
||||
#undef TRUE
|
||||
#define TRUE 1
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
@ -118,7 +123,7 @@
|
||||
* if (x) G_STMT_START { ... } G_STMT_END; else ...
|
||||
*
|
||||
* For gcc we will wrap the statements within `({' and `})' braces.
|
||||
* For SunOS they will be wrapped within `if (1)' and `else (void)0',
|
||||
* For SunOS they will be wrapped within `if (1)' and `else (void) 0',
|
||||
* and otherwise within `do' and `while (0)'.
|
||||
*/
|
||||
#if !(defined (G_STMT_START) && defined (G_STMT_END))
|
||||
@ -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 ) \
|
||||
@ -145,28 +150,28 @@
|
||||
__attribute__((format (scanf, format_idx, arg_idx)))
|
||||
#define G_GNUC_FORMAT( arg_idx ) \
|
||||
__attribute__((format_arg (arg_idx)))
|
||||
#define G_GNUC_NORETURN \
|
||||
#define G_GNUC_NORETURN \
|
||||
__attribute__((noreturn))
|
||||
#define G_GNUC_CONST \
|
||||
#define G_GNUC_CONST \
|
||||
__attribute__((const))
|
||||
#else /* !__GNUC__ */
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx )
|
||||
#define G_GNUC_SCANF( format_idx, arg_idx )
|
||||
#define G_GNUC_FORMAT( arg_idx )
|
||||
#define G_GNUC_NORETURN
|
||||
#define G_GNUC_CONST
|
||||
#define G_GNUC_FORMAT( arg_idx )
|
||||
#define G_GNUC_NORETURN
|
||||
#define G_GNUC_CONST
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/* Wrap the __PRETTY_FUNCTION__ and __FUNCTION__ variables with macros,
|
||||
* so we can refer to them as strings unconditionally.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define G_GNUC_FUNCTION (__FUNCTION__)
|
||||
#define G_GNUC_PRETTY_FUNCTION (__PRETTY_FUNCTION__)
|
||||
#else /* !__GNUC__ */
|
||||
#define G_GNUC_FUNCTION ("")
|
||||
#define G_GNUC_PRETTY_FUNCTION ("")
|
||||
#endif /* !__GNUC__ */
|
||||
#ifdef __GNUC__
|
||||
#define G_GNUC_FUNCTION (__FUNCTION__)
|
||||
#define G_GNUC_PRETTY_FUNCTION (__PRETTY_FUNCTION__)
|
||||
#else /* !__GNUC__ */
|
||||
#define G_GNUC_FUNCTION ("")
|
||||
#define G_GNUC_PRETTY_FUNCTION ("")
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
|
||||
#ifndef ATEXIT
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user