X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fxalloc.h;h=8668e198b7222b773a7e48573cccd05ed88e2bd2;hb=047aa6648c1a2931496d6530a93d8a665fc2be2e;hp=f75c3cdd7848d913af95966392ccce355f1f8435;hpb=9d67945fdbdd4afc1ef1be5d68ace53aba73fa34;p=gnulib.git diff --git a/lib/xalloc.h b/lib/xalloc.h index f75c3cdd7..8668e198b 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -26,8 +26,10 @@ # endif # endif -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __attribute__(x) +# ifndef __attribute__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# define __attribute__(x) +# endif # endif # ifndef ATTRIBUTE_NORETURN @@ -59,10 +61,10 @@ void *xcalloc PARAMS ((size_t n, size_t s)); void *xrealloc PARAMS ((void *p, size_t n)); char *xstrdup PARAMS ((const char *str)); -# define XMALLOC(Type, N_bytes) ((Type *) xmalloc (sizeof (Type) * (N_bytes))) -# define XCALLOC(Type, N_bytes) ((Type *) xcalloc (sizeof (Type), (N_bytes))) -# define XREALLOC(Ptr, Type, N_bytes) \ - ((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_bytes))) +# define XMALLOC(Type, N_items) ((Type *) xmalloc (sizeof (Type) * (N_items))) +# define XCALLOC(Type, N_items) ((Type *) xcalloc (sizeof (Type), (N_items))) +# define XREALLOC(Ptr, Type, N_items) \ + ((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_items))) /* Declare and alloc memory for VAR of type TYPE. */ # define NEW(Type, Var) Type *(Var) = XMALLOC (Type, 1)