diff options
author | Denys Vlasenko | 2023-05-27 18:21:38 +0200 |
---|---|---|
committer | Denys Vlasenko | 2023-05-27 18:21:38 +0200 |
commit | 5c8a9dfd976493e4351abadf6686b621763b564c (patch) | |
tree | 9d9dd9cd194ef8d8a60f92a44d2dd77e7c1e14d3 | |
parent | 528808bcd25f7d237874dc82fad2adcddf354b42 (diff) | |
download | busybox-5c8a9dfd976493e4351abadf6686b621763b564c.zip busybox-5c8a9dfd976493e4351abadf6686b621763b564c.tar.gz |
awk: remove a local variable "caching" a struct member
Since we take its address, the variable lives on stack (not a GPR).
Thus, nothing is improved by caching it.
function old new delta
awk_getline 642 639 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/awk.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/editors/awk.c b/editors/awk.c index 22f5241..4a0eb92 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -2236,7 +2236,7 @@ static int awk_getline(rstream *rsm, var *v) { char *b; regmatch_t pmatch[1]; - int size, a, p, pp = 0; + int a, p, pp = 0; int fd, so, eo, r, rp; char c, *m, *s; @@ -2249,12 +2249,11 @@ static int awk_getline(rstream *rsm, var *v) m = rsm->buffer; a = rsm->adv; p = rsm->pos; - size = rsm->size; c = (char) rsplitter.n.info; rp = 0; if (!m) - m = qrealloc(m, 256, &size); + m = qrealloc(m, 256, &rsm->size); do { b = m + a; @@ -2298,10 +2297,10 @@ static int awk_getline(rstream *rsm, var *v) a = 0; } - m = qrealloc(m, a+p+128, &size); + m = qrealloc(m, a+p+128, &rsm->size); b = m + a; pp = p; - p += safe_read(fd, b+p, size-p-1); + p += safe_read(fd, b+p, rsm->size - p - 1); if (p < pp) { p = 0; r = 0; @@ -2325,7 +2324,6 @@ static int awk_getline(rstream *rsm, var *v) rsm->buffer = m; rsm->adv = a + eo; rsm->pos = p - eo; - rsm->size = size; debug_printf_eval("returning from %s(): %d\n", __func__, r); |