Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalwareutils.git;a=commitdiff;h=f214605243c838c4f85c34e0f9c8f2bb6a1ed9c1

commit f214605243c838c4f85c34e0f9c8f2bb6a1ed9c1
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Sun Sep 28 22:27:11 2008 +0200

libfwutil: add FWUTIL_MALLOC() macro

diff --git a/libfwutil/libfwutil.h b/libfwutil/libfwutil.h
index 33acb73..3366f8e 100644
--- a/libfwutil/libfwutil.h
+++ b/libfwutil/libfwutil.h
@@ -30,6 +30,10 @@
#define _(str) dgettext (FWUTIL_GETTEXT, str)
#endif

+#define FWUTIL_MALLOC(p, b) { if((b) > 0) \
+       { p = malloc(b); if (!(p)) \
+       { fprintf(stderr, "malloc failure: could not allocate %d bytes\n", 
(int)(b)); \
+       exit(1); }} else p = NULL; }
#define FWUTIL_FREE(p) do { if (p) { free(p); (p) = NULL; }} while(0)

#define fwutil_min(p, q)  ((p) < (q) ? (p) : (q))
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to