X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=unwind_prot.h;h=14ef5dc8f6e205a7d8cba25a6ed8351f945dfa15;hb=ccc6cda312fea9f0468ee65b8f368e9653e1380b;hp=e01363153ecdb98d630c0a3ef5de591917650b29;hpb=726f63884db0132f01745f1fb4465e6621088ccf;p=platform%2Fupstream%2Fbash.git 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 */