aboutsummaryrefslogtreecommitdiff
path: root/array.h
diff options
context:
space:
mode:
Diffstat (limited to 'array.h')
-rw-r--r--array.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/array.h b/array.h
index 42ac2258..c9d6512b 100644
--- a/array.h
+++ b/array.h
@@ -1,4 +1,4 @@
-/* $Id: array.h,v 1.4 2008-06-18 16:35:26 nicm Exp $ */
+/* $Id: array.h,v 1.5 2008-06-20 08:36:20 nicm Exp $ */
/*
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -54,6 +54,15 @@
(a)->list[(a)->num] = s; \
(a)->num++; \
} while (0)
+#define ARRAY_INSERT(a, i, s) do { \
+ ENSURE_SIZE2((a)->list, (a)->space, (a)->num + 1, ARRAY_ITEMSIZE(a)); \
+ if ((i) < (a)->num) { \
+ memmove((a)->list + (i) + 1, (a)->list + (i), \
+ ARRAY_ITEMSIZE(a) * ((a)->num - (i))); \
+ } \
+ (a)->list[i] = s; \
+ (a)->num++; \
+} while (0)
#define ARRAY_REMOVE(a, i) do { \
if ((i) < (a)->num - 1) { \
memmove((a)->list + (i), (a)->list + (i) + 1, \