Mercurial > emacs
changeset 69038:b2288bb7d88f
* regex.c (xmalloc, xrealloc): Define these when not linked to
Emacs.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 20 Feb 2006 16:25:21 +0000 |
parents | 2e60323be52d |
children | f717c65a39d7 |
files | src/ChangeLog src/regex.c |
diffstat | 2 files changed, 41 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Mon Feb 20 15:59:51 2006 +0000 +++ b/src/ChangeLog Mon Feb 20 16:25:21 2006 +0000 @@ -1,3 +1,8 @@ +2006-02-20 Chong Yidong <cyd@stupidchicken.com> + + * regex.c (xmalloc, xrealloc): Define these when not linked to + Emacs. + 2006-02-19 Luc Teirlinck <teirllm@auburn.edu> * regex.c (extend_range_table_work_area): Fix typo.
--- a/src/regex.c Mon Feb 20 15:59:51 2006 +0000 +++ b/src/regex.c Mon Feb 20 16:25:21 2006 +0000 @@ -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