diff options
author | Jari Aalto <jari.aalto@cante.net> | 1996-12-23 17:02:34 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:49 +0000 |
commit | ccc6cda312fea9f0468ee65b8f368e9653e1380b (patch) | |
tree | b059878adcfd876c4acb8030deda1eeb918c7e75 /unwind_prot.h | |
parent | 726f63884db0132f01745f1fb4465e6621088ccf (diff) | |
download | android_external_bash-ccc6cda312fea9f0468ee65b8f368e9653e1380b.tar.gz android_external_bash-ccc6cda312fea9f0468ee65b8f368e9653e1380b.tar.bz2 android_external_bash-ccc6cda312fea9f0468ee65b8f368e9653e1380b.zip |
Imported from ../bash-2.0.tar.gz.
Diffstat (limited to 'unwind_prot.h')
-rw-r--r-- | unwind_prot.h | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/unwind_prot.h b/unwind_prot.h index e013631..14ef5dc 100644 --- a/unwind_prot.h +++ b/unwind_prot.h @@ -22,16 +22,36 @@ #define _UNWIND_PROT_H /* Run a function without interrupts. */ -void - begin_unwind_frame (), discard_unwind_frame (), - run_unwind_frame (), add_unwind_protect (), remove_unwind_protect (), - run_unwind_protects (); +extern void begin_unwind_frame (); +extern void discard_unwind_frame (); +extern void run_unwind_frame (); +extern void add_unwind_protect (); +extern void remove_unwind_protect (); +extern void run_unwind_protects (); +extern void unwind_protect_var (); + +/* Try to force correct alignment on machines where pointers and ints + differ in size. */ +typedef union { + char *s; + int i; +} UWP; /* Define for people who like their code to look a certain way. */ #define end_unwind_frame() /* How to protect an integer. */ -#define unwind_protect_int(X) unwind_protect_var (&(X), (char *)(X), sizeof (int)) +#define unwind_protect_int(X) \ + do \ + { \ + UWP u; \ + u.i = (X); \ + unwind_protect_var (&(X), u.s, sizeof (int)); \ + } \ + while (0) + +#define unwind_protect_short(X) \ + unwind_protect_var ((int *)&(X), (char *)&(X), sizeof (short)) /* How to protect a pointer to a string. */ #define unwind_protect_string(X) \ @@ -42,6 +62,6 @@ void /* How to protect the contents of a jmp_buf. */ #define unwind_protect_jmp_buf(X) \ - unwind_protect_var ((int *)(X), (char *)(X), sizeof (jmp_buf)) + unwind_protect_var ((int *)(X), (char *)(X), sizeof (procenv_t)) #endif /* _UNWIND_PROT_H */ |