From 309c723003add5c465a87cf9db70cf31db8fcf04 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 14 Apr 2010 00:52:06 +0200 Subject: win32: ash: macros for implementing simple foo_size, foo_copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy --- shell/ash.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 1326182fe..afe443518 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -13280,6 +13280,41 @@ int ash_main(int argc UNUSED_PARAM, char **argv) /* NOTREACHED */ } +/* + * forkshell_prepare() and friends + */ +#define SLIST_SIZE_BEGIN(name,type) \ +static void \ +name(type *p) \ +{ \ + while (p) { \ + funcblock = (char *) funcblock + sizeof(type); + /* do something here with p */ +#define SLIST_SIZE_END() \ + nodeptrsize++; \ + p = p->next; \ + } \ +} + +#define SLIST_COPY_BEGIN(name,type) \ +static type * \ +name(type *vp) \ +{ \ + type *start; \ + type **vpp; \ + vpp = &start; \ + while (vp) { \ + *vpp = funcblock; \ + funcblock = (char *) funcblock + sizeof(type); + /* do something here with vpp and vp */ +#define SLIST_COPY_END() \ + SAVE_PTR((*vpp)->next); \ + vp = vp->next; \ + vpp = &(*vpp)->next; \ + } \ + *vpp = NULL; \ + return start; \ +} /*- * Copyright (c) 1989, 1991, 1993, 1994 -- cgit v1.2.3-55-g6feb