Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=cfpm.git;a=commitdiff;h=47126fb9891b1bc1a4755415f6d575e8a3d1b199

commit 47126fb9891b1bc1a4755415f6d575e8a3d1b199
Author: James Buren <r...@frugalware.org>
Date:   Wed Oct 28 10:45:00 2009 -0500

Utility.c
* initial draft

diff --git a/src/Utility.c b/src/Utility.c
new file mode 100644
index 0000000..789d59c
--- /dev/null
+++ b/src/Utility.c
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <iso646.h>
+#include <assert.h>
+#include "Utility.h"
+
+int eprintf(const char *fmt,...) {
+  va_list args;
+  int ret;
+
+  assert((fmt != NULL));
+
+  va_start(args,fmt);
+
+  ret = fprintf(stderr,fmt,args);
+
+  va_end(args);
+
+  return ret;
+}
+
+void *xmalloc(size_t size) {
+  void *ptr;
+
+  assert((size > 0));
+
+  ptr = malloc(size);
+
+  if(ptr == NULL) {
+    eprintf("Failed to allocate %u bytes of memory.\n",size);
+    abort();
+  }
+
+  return ptr;
+}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to