Mercurial > hg > xemacs-beta
comparison src/lisp.h @ 438:84b14dcb0985 r21-2-27
Import from CVS: tag r21-2-27
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:32:25 +0200 |
parents | 080151679be2 |
children | 8de8e3f6228a |
comparison
equal
deleted
inserted
replaced
437:e2a4e8b94b82 | 438:84b14dcb0985 |
---|---|
114 void *xmalloc (size_t size); | 114 void *xmalloc (size_t size); |
115 void *xmalloc_and_zero (size_t size); | 115 void *xmalloc_and_zero (size_t size); |
116 void *xrealloc (void *, size_t size); | 116 void *xrealloc (void *, size_t size); |
117 char *xstrdup (CONST char *); | 117 char *xstrdup (CONST char *); |
118 /* generally useful */ | 118 /* generally useful */ |
119 #define countof(x) ((int) (sizeof(x)/sizeof(x[0]))) | 119 #define countof(x) ((int) (sizeof(x)/sizeof((x)[0]))) |
120 #define slot_offset(type, slot_name) \ | |
121 ((unsigned) (((char *) (&(((type *)0)->slot_name))) - ((char *)0))) | |
122 #define xnew(type) ((type *) xmalloc (sizeof (type))) | 120 #define xnew(type) ((type *) xmalloc (sizeof (type))) |
123 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type))) | 121 #define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type))) |
124 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type))) | 122 #define xnew_and_zero(type) ((type *) xmalloc_and_zero (sizeof (type))) |
125 #define xzero(lvalue) ((void) memset (&(lvalue), 0, sizeof (lvalue))) | 123 #define xzero(lvalue) ((void) memset (&(lvalue), '\0', sizeof (lvalue))) |
126 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type))) | 124 #define xnew_array_and_zero(type, len) ((type *) xmalloc_and_zero ((len) * sizeof (type))) |
127 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type)))) | 125 #define XREALLOC_ARRAY(ptr, type, len) ((void) (ptr = (type *) xrealloc (ptr, (len) * sizeof (type)))) |
128 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type))) | 126 #define alloca_array(type, len) ((type *) alloca ((len) * sizeof (type))) |
129 | 127 |
130 /* also generally useful if you want to avoid arbitrary size limits | 128 /* also generally useful if you want to avoid arbitrary size limits |
154 xfree_1 (*xfree_ptr); \ | 152 xfree_1 (*xfree_ptr); \ |
155 *xfree_ptr = (void *) 0xDEADBEEF; \ | 153 *xfree_ptr = (void *) 0xDEADBEEF; \ |
156 } while (0) | 154 } while (0) |
157 #else | 155 #else |
158 void xfree (void *); | 156 void xfree (void *); |
159 #define xfree_1 xfree | |
160 #endif /* ERROR_CHECK_MALLOC */ | 157 #endif /* ERROR_CHECK_MALLOC */ |
161 | 158 |
162 #ifndef PRINTF_ARGS | 159 #ifndef PRINTF_ARGS |
163 # if defined (__GNUC__) && (__GNUC__ >= 2) | 160 # if defined (__GNUC__) && (__GNUC__ >= 2) |
164 # define PRINTF_ARGS(string_index,first_to_check) \ | 161 # define PRINTF_ARGS(string_index,first_to_check) \ |
193 # endif /* GNUC */ | 190 # endif /* GNUC */ |
194 #endif | 191 #endif |
195 | 192 |
196 #ifndef ALIGNOF | 193 #ifndef ALIGNOF |
197 # if defined (__GNUC__) && (__GNUC__ >= 2) | 194 # if defined (__GNUC__) && (__GNUC__ >= 2) |
198 # define ALIGNOF(x) __alignof (x) | 195 # define ALIGNOF(x) __alignof__ (x) |
199 # else | 196 # else |
200 # define ALIGNOF(x) sizeof (x) | 197 # define ALIGNOF(x) sizeof (x) |
201 # endif | 198 # endif |
202 #endif | 199 #endif |
203 | 200 |