]> sjero.net Git - wget/blobdiff - src/xmalloc.h
[svn] Retired the `boolean' type. Renamed FREE_MAYBE to xfree_null and moved the
[wget] / src / xmalloc.h
index 220fc312fe3c841744c598be6c16bd187cf43ac5..d738afc502f57b2f8ebce6bc83273be3122da6a1 100644 (file)
@@ -76,4 +76,10 @@ char *xstrdup_debug PARAMS ((const char *, const char *, int));
 
 #define alloca_array(type, size) ((type *) alloca ((size) * sizeof (type)))
 
+/* Free P if it is non-NULL.  C requires free() to behaves this way by
+   default, but Wget's code is historically careful not to pass NULL
+   to free.  This allows us to assert p!=NULL in xfree to check
+   additional errors.  (But we currently don't do that!)  */
+#define xfree_null(p) if (!(p)) ; else xfree (p)
+
 #endif /* XMALLOC_H */