Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-05-27 19:21:38 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2023-05-27 19:21:38 +0300
commit5c8a9dfd976493e4351abadf6686b621763b564c (patch)
tree9d9dd9cd194ef8d8a60f92a44d2dd77e7c1e14d3 /editors
parent528808bcd25f7d237874dc82fad2adcddf354b42 (diff)
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>
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 22f52417d..4a0eb9281 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);