From afe132eb10575c31e856b7339942d9259f55d315 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 25 Feb 2009 15:33:04 -0800 Subject: Remove DYNARRAY for the stack (wasn't buying much). --- dynarray.h | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 dynarray.h (limited to 'dynarray.h') diff --git a/dynarray.h b/dynarray.h deleted file mode 100644 index 9ff1289..0000000 --- a/dynarray.h +++ /dev/null @@ -1,32 +0,0 @@ - -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MIN(a, b) ((a) < (b) ? (a) : (b)) - -#define DEFINE_DYNARRAY(name, type) \ - type *name; \ - int name ## _len; \ - int name ## _size; - -#define RESIZE_DYNARRAY(name, desired_len) { \ - int orig_size = name ## _size; \ - while(name ## _size < (desired_len)) \ - name ## _size *= 2; \ - /* don't bother shrinking for now. when/if we do, we'll want to bake in \ - * some kind of hysteresis so that we don't shrink until we've been under \ - * for a while. */ \ - if(name ## _size != orig_size) \ - name = realloc(name, name ## _size * sizeof(*name)); \ - name ## _len = desired_len; \ -} - -#define INIT_DYNARRAY(name, initial_len, initial_size) \ - name ## _len = initial_len; \ - name ## _size = initial_size; \ - name = realloc(NULL, name ## _size * sizeof(*name)) - -#define FREE_DYNARRAY(name) \ - free(name); - -#define DYNARRAY_GET_TOP(name) \ - (&name[name ## _len - 1]) - -- cgit v1.2.3