diff options
author | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2015-09-18 15:15:18 +0000 |
---|---|---|
committer | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2015-09-18 15:15:18 +0000 |
commit | 8b2630a82fbecfd57fa38aebb397a755936690e5 (patch) | |
tree | a9cfcd7bb5bea87d63fc8ef81c8456a130a249bc /src/array-static.h | |
parent | e57c8295ebe92b58ca3e68fa8ea8f70d4b0b4cee (diff) | |
download | lighttpd-master.tar.gz |
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@3041 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/array-static.h')
-rw-r--r-- | src/array-static.h | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/array-static.h b/src/array-static.h deleted file mode 100644 index fdeebf63..00000000 --- a/src/array-static.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _ARRAY_STATIC_H_ -#define _ARRAY_STATIC_H_ - -/* define a generic array of <type> - * */ - -#define ARRAY_STATIC_DEF(name, type, extra) \ -typedef struct { \ - type **ptr; \ - size_t used; \ - size_t size; \ - extra\ -} name - -/* all append operations need a 'resize' for the +1 */ - -#define ARRAY_STATIC_PREPARE_APPEND(a) \ - if (a->size == 0) { \ - a->size = 16; \ - a->ptr = malloc(a->size * sizeof(*(a->ptr))); \ - } else if (a->size == a->used) { \ - a->size += 16; \ - a->ptr = realloc(a->ptr, a->size * sizeof(*(a->ptr))); \ - } - -#define FOREACH(array, type, element, func) \ -do { size_t _i; for (_i = 0; _i < array->used; _i++) { type *element = array->ptr[_i]; func; } } while(0); - -#define STRUCT_INIT(type, var) \ - type *var;\ - var = calloc(1, sizeof(*var)) - -#define ARRAY_STATIC_FREE(array, type, element, func) \ - FOREACH(array, type, element, func); \ - if(array->ptr) free(array->ptr); \ - array->ptr = NULL; - -#endif |