summaryrefslogtreecommitdiff
path: root/editors/awk.c
diff options
context:
space:
mode:
authorRob Landley2006-05-07 20:20:34 +0000
committerRob Landley2006-05-07 20:20:34 +0000
commita3896511152cd5dcd64d2eb4aebcce65b29c6c0b (patch)
tree0058e653d90a3d2a961fca16f7c7afd57cd63715 /editors/awk.c
parentf8a808426745ee5f4e5cc76ff1fb9c484c315195 (diff)
downloadbusybox-a3896511152cd5dcd64d2eb4aebcce65b29c6c0b.zip
busybox-a3896511152cd5dcd64d2eb4aebcce65b29c6c0b.tar.gz
Remove bb_strlen() in favor of -fno-builtin-strlen. Saves as many bytes
as the old optimization did (actually does slightly better under gcc 4.0), and simplifies the code.
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/editors/awk.c b/editors/awk.c
index e11c835..9c8bef5 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -534,7 +534,7 @@ static void *hash_find(xhash *hash, const char *name)
if (++hash->nel / hash->csize > 10)
hash_rebuild(hash);
- l = bb_strlen(name) + 1;
+ l = strlen(name) + 1;
hi = xcalloc(sizeof(hash_item) + l, 1);
memcpy(hi->name, name, l);
@@ -559,7 +559,7 @@ static void hash_remove(xhash *hash, const char *name)
while (*phi) {
hi = *phi;
if (strcmp(hi->name, name) == 0) {
- hash->glen -= (bb_strlen(name) + 1);
+ hash->glen -= (strlen(name) + 1);
hash->nel--;
*phi = hi->next;
free(hi);
@@ -1364,7 +1364,7 @@ static node *mk_splitter(char *s, tsplitter *spl)
regfree(re);
regfree(ire);
}
- if (bb_strlen(s) > 1) {
+ if (strlen(s) > 1) {
mk_re_node(s, n, re);
} else {
n->info = (uint32_t) *s;
@@ -1432,7 +1432,7 @@ static int awk_split(char *s, node *spl, char **slist)
regmatch_t pmatch[2];
/* in worst case, each char would be a separate field */
- *slist = s1 = bb_xstrndup(s, bb_strlen(s) * 2 + 3);
+ *slist = s1 = bb_xstrndup(s, strlen(s) * 2 + 3);
c[0] = c[1] = (char)spl->info;
c[2] = c[3] = '\0';
@@ -1527,12 +1527,12 @@ static void handle_special(var *v)
/* recalculate $0 */
sep = getvar_s(V[OFS]);
- sl = bb_strlen(sep);
+ sl = strlen(sep);
b = NULL;
len = 0;
for (i=0; i<n; i++) {
s = getvar_s(&Fields[i]);
- l = bb_strlen(s);
+ l = strlen(s);
if (b) {
memcpy(b+len, sep, sl);
len += sl;
@@ -1769,7 +1769,7 @@ static char *awk_printf(node *n)
} else if (c == 's') {
s1 = getvar_s(arg);
- qrealloc(&b, incr+i+bb_strlen(s1), &bsize);
+ qrealloc(&b, incr+i+strlen(s1), &bsize);
i += sprintf(b+i, s, s1);
} else {
@@ -1809,7 +1809,7 @@ static int awk_sub(node *rn, char *repl, int nm, var *src, var *dest, int ex)
i = di = 0;
sp = getvar_s(src);
- rl = bb_strlen(repl);
+ rl = strlen(repl);
while (regexec(re, sp, 10, pmatch, sp==getvar_s(src) ? 0:REG_NOTBOL) == 0) {
so = pmatch[0].rm_so;
eo = pmatch[0].rm_eo;
@@ -1922,7 +1922,7 @@ static var *exec_builtin(node *op, var *res)
break;
case B_ss:
- l = bb_strlen(as[0]);
+ l = strlen(as[0]);
i = getvar_i(av[1]) - 1;
if (i>l) i=l; if (i<0) i=0;
n = (nargs > 2) ? getvar_i(av[2]) : l-i;
@@ -1950,8 +1950,8 @@ lo_cont:
case B_ix:
n = 0;
- ll = bb_strlen(as[1]);
- l = bb_strlen(as[0]) - ll;
+ ll = strlen(as[1]);
+ l = strlen(as[0]) - ll;
if (ll > 0 && l >= 0) {
if (! icase) {
s = strstr(as[0], as[1]);
@@ -2353,7 +2353,7 @@ re_cont:
case F_le:
if (! op1)
L.s = getvar_s(V[F0]);
- R.d = bb_strlen(L.s);
+ R.d = strlen(L.s);
break;
case F_sy:
@@ -2441,12 +2441,12 @@ re_cont:
/* concatenation (" ") and index joining (",") */
case XC( OC_CONCAT ):
case XC( OC_COMMA ):
- opn = bb_strlen(L.s) + bb_strlen(R.s) + 2;
+ opn = strlen(L.s) + strlen(R.s) + 2;
X.s = (char *)xmalloc(opn);
strcpy(X.s, L.s);
if ((opinfo & OPCLSMASK) == OC_COMMA) {
L.s = getvar_s(V[SUBSEP]);
- X.s = (char *)xrealloc(X.s, opn + bb_strlen(L.s));
+ X.s = (char *)xrealloc(X.s, opn + strlen(L.s));
strcat(X.s, L.s);
}
strcat(X.s, R.s);