aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2006-02-20 16:25:21 +0000
committerChong Yidong2006-02-20 16:25:21 +0000
commita77f947b23c1cc19f049b2d70b930f974bde6540 (patch)
treea5fb7716c3ba1a29ab3b6abf1f5525eefe0e71b3 /src
parentec9f0a62bf72630aae48ae220ed0254ebbe64993 (diff)
downloademacs-a77f947b23c1cc19f049b2d70b930f974bde6540.tar.gz
emacs-a77f947b23c1cc19f049b2d70b930f974bde6540.zip
* regex.c (xmalloc, xrealloc): Define these when not linked to
Emacs.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/regex.c36
2 files changed, 41 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f2a6e1e2752..1ed2e8512e2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12006-02-20 Chong Yidong <cyd@stupidchicken.com>
2
3 * regex.c (xmalloc, xrealloc): Define these when not linked to
4 Emacs.
5
12006-02-19 Luc Teirlinck <teirllm@auburn.edu> 62006-02-19 Luc Teirlinck <teirllm@auburn.edu>
2 7
3 * regex.c (extend_range_table_work_area): Fix typo. 8 * regex.c (extend_range_table_work_area): Fix typo.
diff --git a/src/regex.c b/src/regex.c
index c08471355fd..9cc6c8c08ee 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -181,6 +181,42 @@ char *malloc ();
181char *realloc (); 181char *realloc ();
182# endif 182# endif
183 183
184/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
185
186void *
187xmalloc (size)
188 size_t size;
189{
190 register void *val;
191 val = (void *) malloc (size);
192 if (!val && size)
193 {
194 write (2, "virtual memory exhausted\n", 25);
195 exit (1);
196 }
197 return val;
198}
199
200void *
201xrealloc (block, size)
202 void *block;
203 size_t size;
204{
205 register void *val;
206 /* We must call malloc explicitly when BLOCK is 0, since some
207 reallocs don't do this. */
208 if (! block)
209 val = (void *) malloc (size);
210 else
211 val = (void *) realloc (block, size);
212 if (!val && size)
213 {
214 write (2, "virtual memory exhausted\n", 25);
215 exit (1);
216 }
217 return val;
218}
219
184/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. 220/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
185 If nothing else has been done, use the method below. */ 221 If nothing else has been done, use the method below. */
186# ifdef INHIBIT_STRING_HEADER 222# ifdef INHIBIT_STRING_HEADER