summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/misc.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-07-24 14:05:21 +0000
committerobrien <obrien@FreeBSD.org>2001-07-24 14:05:21 +0000
commit6dc73139c0963b16a0a8642e6399a5433348138e (patch)
tree5cfbf3a709a30e3188c47d1beb93d8b2481dcaf0 /usr.bin/sed/misc.c
parent4f82093ece0a22bfe072a2c476f29289a0773290 (diff)
downloadFreeBSD-src-6dc73139c0963b16a0a8642e6399a5433348138e.zip
FreeBSD-src-6dc73139c0963b16a0a8642e6399a5433348138e.tar.gz
Expand xmalloc in-place, along with xrealloc; which wasn't even ANSI in its
implementation.
Diffstat (limited to 'usr.bin/sed/misc.c')
-rw-r--r--usr.bin/sed/misc.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/usr.bin/sed/misc.c b/usr.bin/sed/misc.c
index c9b013a..d5ad374 100644
--- a/usr.bin/sed/misc.c
+++ b/usr.bin/sed/misc.c
@@ -55,36 +55,6 @@ static const char rcsid[] =
#include "extern.h"
/*
- * malloc with result test
- */
-void *
-xmalloc(size)
- u_int size;
-{
- void *p;
-
- if ((p = malloc(size)) == NULL)
- err(1, "malloc");
- return (p);
-}
-
-/*
- * realloc with result test
- */
-void *
-xrealloc(p, size)
- void *p;
- u_int size;
-{
- if (p == NULL) /* Compatibility hack. */
- return (xmalloc(size));
-
- if ((p = realloc(p, size)) == NULL)
- err(1, "realloc");
- return (p);
-}
-
-/*
* Return a string for a regular expression error passed. This is a overkill,
* because of the silly semantics of regerror (we can never know the size of
* the buffer).
@@ -100,7 +70,8 @@ strregerror(errcode, preg)
if (oe != NULL)
free(oe);
s = regerror(errcode, preg, "", 0);
- oe = xmalloc(s);
+ if ((oe = malloc(s)) == NULL)
+ err(1, "malloc");
(void)regerror(errcode, preg, oe, s);
return (oe);
}
OpenPOWER on IntegriCloud