summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c')
-rw-r--r--xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c b/xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c
new file mode 100644
index 000000000..ffce7fe2c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c
@@ -0,0 +1,79 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xalloc.c,v 1.1 2000/02/13 03:06:39 dawes Exp $ */
+
+#include "X.h"
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+
+/*
+ * Utility functions required by libxf86_os.
+ */
+
+pointer
+Xalloc(unsigned long n)
+{
+ if (!n)
+ n = 1;
+ return malloc(n);
+}
+
+pointer
+Xrealloc(pointer p, unsigned long n)
+{
+ if (!n)
+ n = 1;
+ return realloc(p, n);
+}
+
+pointer
+Xcalloc(unsigned long n)
+{
+ pointer r;
+
+ r = Xalloc(n);
+ memset(r, 0, n);
+ return r;
+}
+
+pointer
+XNFalloc(unsigned long n)
+{
+ pointer r;
+
+ r = Xalloc(n);
+ if (!r)
+ FatalError("XNFalloc failed\n");
+ return r;
+
+}
+
+pointer
+XNFrealloc(pointer p, unsigned long n)
+{
+ pointer r;
+
+ r = Xrealloc(p, n);
+ if (!r)
+ FatalError("XNFrealloc failed\n");
+ return r;
+
+}
+
+pointer
+XNFcalloc(unsigned long n)
+{
+ pointer r;
+
+ r = Xcalloc(n);
+ if (!r)
+ FatalError("XNFcalloc failed\n");
+ return r;
+
+}
+
+void
+Xfree(pointer p)
+{
+ free(p);
+}
+