[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/regex.c
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] Changes to emacs/src/regex.c |
Date: |
Mon, 20 Feb 2006 16:25:22 +0000 |
Index: emacs/src/regex.c
diff -u emacs/src/regex.c:1.208 emacs/src/regex.c:1.209
--- emacs/src/regex.c:1.208 Mon Feb 20 03:48:53 2006
+++ emacs/src/regex.c Mon Feb 20 16:25:21 2006
@@ -181,6 +181,42 @@
char *realloc ();
# endif
+/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
+
+void *
+xmalloc (size)
+ size_t size;
+{
+ register void *val;
+ val = (void *) malloc (size);
+ if (!val && size)
+ {
+ write (2, "virtual memory exhausted\n", 25);
+ exit (1);
+ }
+ return val;
+}
+
+void *
+xrealloc (block, size)
+ void *block;
+ size_t size;
+{
+ register void *val;
+ /* We must call malloc explicitly when BLOCK is 0, since some
+ reallocs don't do this. */
+ if (! block)
+ val = (void *) malloc (size);
+ else
+ val = (void *) realloc (block, size);
+ if (!val && size)
+ {
+ write (2, "virtual memory exhausted\n", 25);
+ exit (1);
+ }
+ return val;
+}
+
/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
If nothing else has been done, use the method below. */
# ifdef INHIBIT_STRING_HEADER