summaryrefslogtreecommitdiff
path: root/shells/bash2/patches/patch-ad
blob: ea7dfad5d6115c9b5d2924eb0e562573c82fdf3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-ad,v 1.1 2001/08/30 13:56:28 mrg Exp $

--- unwind_prot.h.orig	Thu Feb  1 19:51:00 2001
+++ unwind_prot.h	Thu Aug 30 11:24:44 2001
@@ -34,8 +34,9 @@
 /* Try to force correct alignment on machines where pointers and ints
    differ in size. */
 typedef union {
-  char *s;
+  char *p;
   int i;
+  int s;
 } UWP;

 /* Define for people who like their code to look a certain way. */
@@ -47,18 +48,28 @@
 	  { \
 	    UWP u; \
 	    u.i = (X); \
-	    unwind_protect_var (&(X), u.s, sizeof (int)); \
+	    unwind_protect_var (&(X), &u, sizeof (int)); \
 	  } \
 	while (0)

 #define unwind_protect_short(X) \
-  unwind_protect_var ((int *)&(X), (char *)&(X), sizeof (short))
+	do \
+	  { \
+	    UWP u; \
+	    u.i = (X); \
+	    unwind_protect_var (&(X), &u, sizeof (int)); \
+	  } \
+	while (0)

 /* How to protect a pointer to a string. */
 #define unwind_protect_string(X) \
-  unwind_protect_var ((int *)&(X), \
-		      ((sizeof (char *) == sizeof (int)) ? (char *) (X) : (char *) &(X)), \
-		       sizeof (char *))
+	do \
+	{ \
+	  UWP u; \
+	  u.p = (X); \
+	  unwind_protect_var (&(X), &u, sizeof (char *)); \
+	} \
+	while (0)

 /* How to protect any old pointer. */
 #define unwind_protect_pointer(X) unwind_protect_string (X)