diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-09-17 10:12:36 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-09-17 10:12:36 +0000 |
commit | a4b0c31e64ec3e836d7c351269c4de716a0e7c66 (patch) | |
tree | 6574f903524f7b47ede4dd914dbd392f21ddc7c8 /usr.bin/make/garray.h | |
parent | ee89fbc00a9f91fdcac93f7160e2cc914f366667 (diff) |
reindent garray.h, add new function, to be used later
Diffstat (limited to 'usr.bin/make/garray.h')
-rw-r--r-- | usr.bin/make/garray.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/usr.bin/make/garray.h b/usr.bin/make/garray.h index 0e934800d85..7cc3562b4b4 100644 --- a/usr.bin/make/garray.h +++ b/usr.bin/make/garray.h @@ -2,7 +2,7 @@ #define GARRAY_H /* $OpenPackages$ */ -/* $OpenBSD: garray.h,v 1.2 2007/09/17 09:44:20 espie Exp $ */ +/* $OpenBSD: garray.h,v 1.3 2007/09/17 10:12:35 espie Exp $ */ /* Growable array implementation */ /* @@ -49,14 +49,15 @@ do { \ #define MAY_INCREASE_STATS #endif -#define Array_AtEnd(l, gn) \ -do { \ - if ((l)->n >= (l)->size) { \ - (l)->size *= 2; \ - (l)->a = erealloc((l)->a, sizeof(struct GNode *) * (l)->size); \ - MAY_INCREASE_STATS; \ - } \ - (l)->a[(l)->n++] = (gn); \ +#define Array_AtEnd(l, gn) \ +do { \ + if ((l)->n >= (l)->size) { \ + (l)->size *= 2; \ + (l)->a = erealloc((l)->a, \ + sizeof(struct GNode *) * (l)->size);\ + MAY_INCREASE_STATS; \ + } \ + (l)->a[(l)->n++] = (gn); \ } while (0) #define Array_Find(l, func, v) \ @@ -67,6 +68,14 @@ do { \ break; \ } while (0) +#define Array_FindP(l, func, v) \ +do { \ + unsigned int i; \ + for (i = 0; i < (l)->n; i++) \ + if ((func)(&((l)->a[i]), (v)) == 0) \ + break; \ +} while (0) + #define Array_ForEach(l, func, v) \ do { \ unsigned int i; \ |