aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-01-05 04:02:40 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-01-05 04:02:40 +0000
commitf06b1846a2580c3b19a89f5f5e76b7d509afb3c9 (patch)
treea833706e4456d1c8bb126907601f9026ce09eec3
parentee409a69c7f931c02aac69553c92817dfa7951db (diff)
downloadfetchmail-f06b1846a2580c3b19a89f5f5e76b7d509afb3c9.tar.gz
fetchmail-f06b1846a2580c3b19a89f5f5e76b7d509afb3c9.tar.bz2
fetchmail-f06b1846a2580c3b19a89f5f5e76b7d509afb3c9.zip
Initial revision
svn path=/trunk/; revision=2327
-rw-r--r--xalloca.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/xalloca.c b/xalloca.c
new file mode 100644
index 00000000..d5ed7abe
--- /dev/null
+++ b/xalloca.c
@@ -0,0 +1,47 @@
+/*
+ * xalloca.c -- allocate space or die
+ *
+ * For license terms, see the file COPYING in this directory.
+ */
+
+#include "config.h"
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#if defined(STDC_HEADERS)
+#include <stdlib.h>
+#endif
+#if defined(HAVE_ALLOCA_H)
+#include <alloca.h>
+#else
+#ifdef _AIX
+ #pragma alloca
+#endif
+#endif
+
+#include "fetchmail.h"
+
+#if defined(HAVE_VOIDPOINTER)
+#define XALLOCATYPE void
+#else
+#define XALLOCATYPE char
+#endif
+
+XALLOCATYPE *
+#ifdef __STDC__
+xalloca (size_t n)
+#else
+xalloca (n)
+
+int n;
+#endif
+{
+ XALLOCATYPE *p;
+
+ p = (XALLOCATYPE *) alloca(n);
+ if (p == (XALLOCATYPE *) 0)
+ error(PS_UNDEFINED, 0, "alloca failed");
+ return(p);
+}
+
+/* xalloca.c ends here */