summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-06-20 15:29:09 +0000
committerpfg <pfg@FreeBSD.org>2014-06-20 15:29:09 +0000
commit76a4926d960f80f509edef32f620bd5b4b0ed1c7 (patch)
tree0258a4920edfd2941d482a0322f2f2f54c3c3ba8 /lib
parentd9071b72216d167e5278e968bfdf44732835f31a (diff)
downloadFreeBSD-src-76a4926d960f80f509edef32f620bd5b4b0ed1c7.zip
FreeBSD-src-76a4926d960f80f509edef32f620bd5b4b0ed1c7.tar.gz
regex: Make use of reallocf().
Use of reallocf is useful in libraries as we are not certain the application will exit after NULL. This somewhat reduces portability but if since you are building this as part of libc it is likely you have our non-standard reallocf(3) already. Reviewed by: ache MFC after: 5 days
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/regex/regcomp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index 55f9c04..f27a65a 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -1111,7 +1111,7 @@ allocset(struct parse *p)
{
cset *cs, *ncs;
- ncs = realloc(p->g->sets, (p->g->ncsets + 1) * sizeof(*ncs));
+ ncs = reallocf(p->g->sets, (p->g->ncsets + 1) * sizeof(*ncs));
if (ncs == NULL) {
SETERROR(REG_ESPACE);
return (NULL);
@@ -1174,7 +1174,7 @@ CHadd(struct parse *p, cset *cs, wint_t ch)
if (ch < NC)
cs->bmp[ch >> 3] |= 1 << (ch & 7);
else {
- newwides = realloc(cs->wides, (cs->nwides + 1) *
+ newwides = reallocf(cs->wides, (cs->nwides + 1) *
sizeof(*cs->wides));
if (newwides == NULL) {
SETERROR(REG_ESPACE);
@@ -1203,7 +1203,7 @@ CHaddrange(struct parse *p, cset *cs, wint_t min, wint_t max)
CHadd(p, cs, min);
if (min >= max)
return;
- newranges = realloc(cs->ranges, (cs->nranges + 1) *
+ newranges = reallocf(cs->ranges, (cs->nranges + 1) *
sizeof(*cs->ranges));
if (newranges == NULL) {
SETERROR(REG_ESPACE);
@@ -1227,7 +1227,7 @@ CHaddtype(struct parse *p, cset *cs, wctype_t wct)
for (i = 0; i < NC; i++)
if (iswctype(i, wct))
CHadd(p, cs, i);
- newtypes = realloc(cs->types, (cs->ntypes + 1) *
+ newtypes = reallocf(cs->types, (cs->ntypes + 1) *
sizeof(*cs->types));
if (newtypes == NULL) {
SETERROR(REG_ESPACE);
@@ -1350,7 +1350,7 @@ enlarge(struct parse *p, sopno size)
if (p->ssize >= size)
return 1;
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
+ sp = (sop *)reallocf(p->strip, size*sizeof(sop));
if (sp == NULL) {
SETERROR(REG_ESPACE);
return 0;
@@ -1368,7 +1368,7 @@ static void
stripsnug(struct parse *p, struct re_guts *g)
{
g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
+ g->strip = (sop *)reallocf((char *)p->strip, p->slen * sizeof(sop));
if (g->strip == NULL) {
SETERROR(REG_ESPACE);
g->strip = p->strip;
OpenPOWER on IntegriCloud