diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 00:52:06 +0200 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-14 11:04:23 +1000 |
| commit | 7461a43ca9cc97f062b2e18fb07c58d0951250d7 (patch) | |
| tree | afbdb9325235f250b9377184de9eca4961b1b2b9 /shell | |
| parent | 268083aec522fb734e2f8f5be796587d5dfd1bbc (diff) | |
| download | busybox-w32-7461a43ca9cc97f062b2e18fb07c58d0951250d7.tar.gz busybox-w32-7461a43ca9cc97f062b2e18fb07c58d0951250d7.tar.bz2 busybox-w32-7461a43ca9cc97f062b2e18fb07c58d0951250d7.zip | |
win32: ash: macros for implementing simple foo_size, foo_copy
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index c99a1351f..518615316 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -13281,6 +13281,41 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
| 13281 | /* NOTREACHED */ | 13281 | /* NOTREACHED */ |
| 13282 | } | 13282 | } |
| 13283 | 13283 | ||
| 13284 | /* | ||
| 13285 | * forkshell_prepare() and friends | ||
| 13286 | */ | ||
| 13287 | #define SLIST_SIZE_BEGIN(name,type) \ | ||
| 13288 | static void \ | ||
| 13289 | name(type *p) \ | ||
| 13290 | { \ | ||
| 13291 | while (p) { \ | ||
| 13292 | funcblocksize += sizeof(type); | ||
| 13293 | /* do something here with p */ | ||
| 13294 | #define SLIST_SIZE_END() \ | ||
| 13295 | nodeptrsize++; \ | ||
| 13296 | p = p->next; \ | ||
| 13297 | } \ | ||
| 13298 | } | ||
| 13299 | |||
| 13300 | #define SLIST_COPY_BEGIN(name,type) \ | ||
| 13301 | static type * \ | ||
| 13302 | name(type *vp) \ | ||
| 13303 | { \ | ||
| 13304 | type *start; \ | ||
| 13305 | type **vpp; \ | ||
| 13306 | vpp = &start; \ | ||
| 13307 | while (vp) { \ | ||
| 13308 | *vpp = funcblock; \ | ||
| 13309 | funcblock = (char *) funcblock + sizeof(type); | ||
| 13310 | /* do something here with vpp and vp */ | ||
| 13311 | #define SLIST_COPY_END() \ | ||
| 13312 | SAVE_PTR((*vpp)->next); \ | ||
| 13313 | vp = vp->next; \ | ||
| 13314 | vpp = &(*vpp)->next; \ | ||
| 13315 | } \ | ||
| 13316 | *vpp = NULL; \ | ||
| 13317 | return start; \ | ||
| 13318 | } | ||
| 13284 | 13319 | ||
| 13285 | /*- | 13320 | /*- |
| 13286 | * Copyright (c) 1989, 1991, 1993, 1994 | 13321 | * Copyright (c) 1989, 1991, 1993, 1994 |
