diff options
| author | Jari Aalto <jari.aalto@cante.net> | 2002-07-17 14:10:11 +0000 |
|---|---|---|
| committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:55 +0000 |
| commit | 7117c2d221b2aed4ede8600f6a36b7c1454b4f55 (patch) | |
| tree | b792f26ecca68813c51ed5ba2e381790758ef31b /unwind_prot.c | |
| parent | f73dda092b33638d2d5e9c35375f687a607b5403 (diff) | |
| download | android_external_bash-7117c2d221b2aed4ede8600f6a36b7c1454b4f55.tar.gz android_external_bash-7117c2d221b2aed4ede8600f6a36b7c1454b4f55.tar.bz2 android_external_bash-7117c2d221b2aed4ede8600f6a36b7c1454b4f55.zip | |
Imported from ../bash-2.05b.tar.gz.
Diffstat (limited to 'unwind_prot.c')
| -rw-r--r-- | unwind_prot.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/unwind_prot.c b/unwind_prot.c index 13dfc78..4bb7a78 100644 --- a/unwind_prot.c +++ b/unwind_prot.c @@ -1,7 +1,7 @@ /* I can't stand it anymore! Please can't we just write the whole Unix system in lisp or something? */ -/* Copyright (C) 1987,1989 Free Software Foundation, Inc. +/* Copyright (C) 1987-2002 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -72,6 +72,9 @@ typedef union uwp { } sv; } UNWIND_ELT; + +extern int interrupt_immediately; + static void without_interrupts __P((VFunction *, char *, char *)); static void unwind_frame_discard_internal __P((char *, char *)); static void unwind_frame_run_internal __P((char *, char *)); @@ -84,7 +87,8 @@ static void unwind_protect_mem_internal __P((char *, char *)); static UNWIND_ELT *unwind_protect_list = (UNWIND_ELT *)NULL; -extern int interrupt_immediately; +#define uwpalloc(elt) (elt) = (UNWIND_ELT *)xmalloc (sizeof (UNWIND_ELT)) +#define uwpfree(elt) free(elt) /* Run a function without interrupts. This relies on the fact that the FUNCTION cannot change the value of interrupt_immediately. (I.e., does @@ -185,7 +189,7 @@ add_unwind_protect_internal (cleanup, arg) { UNWIND_ELT *elt; - elt = (UNWIND_ELT *)xmalloc (sizeof (UNWIND_ELT)); + uwpalloc (elt); elt->head.next = unwind_protect_list; elt->head.cleanup = cleanup; elt->arg.v = arg; @@ -202,7 +206,7 @@ remove_unwind_protect_internal (ignore1, ignore2) if (elt) { unwind_protect_list = unwind_protect_list->head.next; - free (elt); + uwpfree (elt); } } @@ -236,11 +240,11 @@ unwind_frame_discard_internal (tag, ignore) unwind_protect_list = unwind_protect_list->head.next; if (elt->head.cleanup == 0 && (STREQ (elt->arg.v, tag))) { - free (elt); + uwpfree (elt); break; } else - free (elt); + uwpfree (elt); } } @@ -269,7 +273,7 @@ unwind_frame_run_internal (tag, ignore) { if (tag && STREQ (elt->arg.v, tag)) { - free (elt); + uwpfree (elt); break; } } @@ -281,7 +285,7 @@ unwind_frame_run_internal (tag, ignore) (*(elt->head.cleanup)) (elt->arg.v); } - free (elt); + uwpfree (elt); } } |
