Split DO_ARRAY in two parts.

This commit is contained in:
Pierre Habouzit 2008-06-23 16:31:24 +02:00
parent 100f62c4b9
commit ef4eae17c4
1 changed files with 7 additions and 3 deletions

View File

@ -25,12 +25,13 @@
#include <assert.h> #include <assert.h>
#include "common/util.h" #include "common/util.h"
#define DO_ARRAY(type_t, pfx, dtor) \ #define ARRAY_TYPE(type_t, pfx) \
typedef struct pfx##_array_t { \ typedef struct pfx##_array_t { \
type_t *tab; \ type_t *tab; \
int len, size; \ int len, size; \
} pfx##_array_t; \ } pfx##_array_t
\
#define ARRAY_FUNCS(type_t, pfx, dtor) \
static inline pfx##_array_t * pfx##_array_new(void) { \ static inline pfx##_array_t * pfx##_array_new(void) { \
return p_new(pfx##_array_t, 1); \ return p_new(pfx##_array_t, 1); \
} \ } \
@ -79,5 +80,8 @@
pfx##_array_splice(arr, arr->len, 0, &e, 1); \ pfx##_array_splice(arr, arr->len, 0, &e, 1); \
} }
#define DO_ARRAY(type_t, pfx, dtor) \
ARRAY_TYPE(type_t, pfx); ARRAY_FUNCS(type_t, pfx, dtor)
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80