From a3896511152cd5dcd64d2eb4aebcce65b29c6c0b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 7 May 2006 20:20:34 +0000 Subject: 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. --- editors/awk.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'editors') diff --git a/editors/awk.c b/editors/awk.c index e11c8350f..9c8bef53a 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; il) 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); -- cgit v1.2.3