From a4b0c31e64ec3e836d7c351269c4de716a0e7c66 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 17 Sep 2007 10:12:36 +0000 Subject: reindent garray.h, add new function, to be used later --- usr.bin/make/garray.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'usr.bin/make/garray.h') 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; \ -- cgit v1.2.3