new function `xmalloc_unsafe'
authorRobin Templeton <robin@terpri.org>
Mon, 30 Jun 2014 08:04:22 +0000 (04:04 -0400)
committerRobin Templeton <robin@terpri.org>
Sat, 18 Apr 2015 22:49:06 +0000 (18:49 -0400)
* src/alloc.c (xmalloc_unsafe): New function.

Conflicts:
src/alloc.c
src/lisp.h

src/alloc.c
src/lisp.h

index 17ec809..7397f73 100644 (file)
@@ -232,6 +232,14 @@ xfree (void *block)
   return;
 }
 
+/* Allocate memory, but if memory is exhausted, return NULL instead of
+   signalling an error.  */
+
+void *
+xmalloc_unsafe (size_t size)
+{
+  return GC_MALLOC (size);
+}
 
 /* Other parts of Emacs pass large int values to allocator functions
    expecting ptrdiff_t.  This is portable in practice, but check it to
index 7570f5f..b6997f3 100644 (file)
@@ -4180,6 +4180,7 @@ extern void *xmalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1));
 extern void *xzalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1));
 extern void *xrealloc (void *, size_t) ATTRIBUTE_ALLOC_SIZE ((2));
 extern void xfree (void *);
+extern void *xmalloc_unsafe (size_t) ATTRIBUTE_MALLOC_SIZE ((1));
 extern void *xnmalloc (ptrdiff_t, ptrdiff_t) ATTRIBUTE_MALLOC_SIZE ((1,2));
 extern void *xnrealloc (void *, ptrdiff_t, ptrdiff_t)
   ATTRIBUTE_ALLOC_SIZE ((2,3));