summaryrefslogtreecommitdiffstats
path: root/xalloc.h
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-10-26 16:45:12 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-10-26 16:45:12 (GMT)
commit6054f36bb658916bd231b9002efb94444e2871c8 (patch)
treea815500ec9bf0e100f4075a825213605c382def0 /xalloc.h
downloadblt-6054f36bb658916bd231b9002efb94444e2871c8.zip
blt-6054f36bb658916bd231b9002efb94444e2871c8.tar.gz
blt-6054f36bb658916bd231b9002efb94444e2871c8.tar.bz2
Squashed 'xpa/' content from commit d6a54301
git-subtree-dir: xpa git-subtree-split: d6a543018b46c5a6c47b5ff91e0e131549595ca6
Diffstat (limited to 'xalloc.h')
-rw-r--r--xalloc.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/xalloc.h b/xalloc.h
new file mode 100644
index 0000000..c25fb32
--- /dev/null
+++ b/xalloc.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2004 Smithsonian Astrophysical Observatory
+ */
+
+/*
+ *
+ * xalloc.h -- declarations for safe (error-checked) memory allocation
+ *
+ */
+
+#ifndef __xalloc_h
+#define __xalloc_h
+
+#if HAVE_CONFIG_H
+#include <conf.h>
+#endif
+
+#include <sys/types.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SETJMP_H
+#define XALLOC_SETJMP 142857
+#include <setjmp.h>
+#endif
+
+#include <prsetup.h>
+
+_PRbeg
+
+void *xmalloc _PRx((size_t n));
+void *xcalloc _PRx((size_t n, size_t s));
+void *xrealloc _PRx((void *p, size_t n));
+void xfree _PRx((void *p));
+char *xstrdup _PRx((char *s));
+#if HAVE_SETJMP_H
+void xalloc_savejmp _PRx((jmp_buf *env));
+#endif
+
+_PRend
+
+#endif