Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=yaxmenu.git;a=commitdiff;h=93e74455794ee01c327a4408e61d5c1fbf1b8525
commit 93e74455794ee01c327a4408e61d5c1fbf1b8525 Author: James Buren <r...@frugalware.org> Date: Tue Dec 1 21:05:41 2009 -0600 utility.c * initial draft diff --git a/src/utility.c b/src/utility.c new file mode 100644 index 0000000..2d44cbd --- /dev/null +++ b/src/utility.c @@ -0,0 +1,31 @@ +#include "utility.h" + +void *xmalloc(size_t size) { + void *ptr; + + assert(size); + + ptr = malloc(size); + + if(!ptr) { + eprintf("Failed to allocate %u bytes of memory.\n",size); + abort(); + } + + return ptr; +} + +void *xrealloc(void *optr,size_t size) { + void *nptr; + + assert(optr && size); + + nptr = realloc(optr,size); + + if(!nptr) { + eprintf("Failed to reallocate %u bytes of memory.\n",size); + abort(); + } + + return nptr; +} _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git