}
/* gradually increasing buffer */
-static void qrealloc(char **b, int n, int *size)
+static char* qrealloc(char *b, int n, int *size)
{
- if (!*b || n >= *size) {
+ if (!b || n >= *size) {
*size = n + (n>>1) + 80;
- *b = xrealloc(*b, *size);
+ b = xrealloc(b, *size);
}
+ return b;
}
/* resize field storage space */
memcpy(b+len, sep, sl);
len += sl;
}
- qrealloc(&b, len+l+sl, &bsize);
+ b = qrealloc(b, len+l+sl, &bsize);
memcpy(b+len, s, l);
len += l;
}
c = (char) rsplitter.n.info;
rp = 0;
- if (!m) qrealloc(&m, 256, &size);
+ if (!m)
+ m = qrealloc(m, 256, &size);
do {
b = m + a;
so = eo = p;
a = 0;
}
- qrealloc(&m, a+p+128, &size);
+ m = qrealloc(m, a+p+128, &size);
b = m + a;
pp = p;
p += safe_read(fd, b+p, size-p-1);
}
incr = (f - s) + MAXVARFMT;
- qrealloc(&b, incr + i, &bsize);
+ b = qrealloc(b, incr + i, &bsize);
c = *f;
if (c != '\0') f++;
c1 = *f;
(char)getvar_i(arg) : *getvar_s(arg));
} else if (c == 's') {
s1 = getvar_s(arg);
- qrealloc(&b, incr+i+strlen(s1), &bsize);
+ b = qrealloc(b, incr+i+strlen(s1), &bsize);
i += sprintf(b+i, s, s1);
} else {
i += fmt_num(b+i, incr, s, getvar_i(arg), FALSE);
so = pmatch[0].rm_so;
eo = pmatch[0].rm_eo;
- qrealloc(&ds, di + eo + rl, &dssize);
+ ds = qrealloc(ds, di + eo + rl, &dssize);
memcpy(ds + di, sp, eo);
di += eo;
if (++i >= nm) {
ds[di++] = c;
} else {
n = pmatch[j].rm_eo - pmatch[j].rm_so;
- qrealloc(&ds, di + rl + n, &dssize);
+ ds = qrealloc(ds, di + rl + n, &dssize);
memcpy(ds + di, sp + pmatch[j].rm_so, n);
di += n;
}
}
}
- qrealloc(&ds, di + strlen(sp), &dssize);
+ ds = qrealloc(ds, di + strlen(sp), &dssize);
strcpy(ds + di, sp);
setvar_p(dest, ds);
if (re == &sreg)