X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fallocsa.h;h=0fd46a8e6acb1aec0d906e8436bf8fa3827a699f;hb=c6ad67bb80efa455e52904f98af0c8c4ec4f36ee;hp=b5fdac56f6a16501921972450ee771ab3718ac98;hpb=e1bb3dab9a2dca414eab231c33afd3fad19e7924;p=gnulib.git diff --git a/lib/allocsa.h b/lib/allocsa.h index b5fdac56f..0fd46a8e6 100644 --- a/lib/allocsa.h +++ b/lib/allocsa.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2004 Free Software Foundation, Inc. + Copyright (C) 2003-2006 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _ALLOCSA_H #define _ALLOCSA_H @@ -23,6 +23,12 @@ #include #include + +#ifdef __cplusplus +extern "C" { +#endif + + /* safe_alloca(N) is equivalent to alloca(N) when it is safe to call alloca(N); otherwise it returns NULL. It either returns N bytes of memory allocated on the stack, that lasts until the function returns, @@ -69,6 +75,11 @@ extern void freesa (void *p); If this would be useful in your application. please speak up. */ +#ifdef __cplusplus +} +#endif + + /* ------------------- Auxiliary, non-public definitions ------------------- */ /* Determine the alignment of a type at compile time. */ @@ -81,6 +92,10 @@ extern void freesa (void *p); /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof values. */ # define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#elif defined _AIX + /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) #else # define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) #endif @@ -91,17 +106,17 @@ enum among all elementary types. */ sa_alignment_long = sa_alignof (long), sa_alignment_double = sa_alignof (double), -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT sa_alignment_longlong = sa_alignof (long long), #endif -#ifdef HAVE_LONG_DOUBLE +#ifdef HAVE_LONG_DOUBLE sa_alignment_longdouble = sa_alignof (long double), #endif sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) -#ifdef HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG_INT | (sa_alignment_longlong - 1) #endif -#ifdef HAVE_LONG_DOUBLE +#ifdef HAVE_LONG_DOUBLE | (sa_alignment_longdouble - 1) #endif ) + 1,