New module 'unicase/ulc-casecoll'.
[pspp] / lib / safe-alloc.h
index 1b7847add53cb2b70d486736e789922e5d358d0e..f07ee916c770fb37d38a0dd84ebffbb872a634f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * memory.c: safer memory allocation
+ * safe-alloc.h: safer memory allocation
  *
  * Copyright (C) 2009 Free Software Foundation, Inc.
  *
 
 # include <stdlib.h>
 
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min)                                       \
+  ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
 # ifndef ATTRIBUTE_RETURN_CHECK
 #  if __GNUC_PREREQ (3, 4)
 #   define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
@@ -108,7 +117,7 @@ safe_alloc_realloc_n (void *ptrptr, size_t size, size_t count)
 # define FREE(ptr)                              \
   do                                            \
     {                                           \
-      free(ptr);                                \
+      free (ptr);                               \
       (ptr) = NULL;                             \
     }                                           \
   while(0)