← Commit list

694d2982e

Denys Vlasenko
Denys Vlasenko
2018-12-18
SUCCESS Duration: 153s

Subject

bc: code shrink

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

miscutils/bc.c+6 -4
@@ -5174,17 +5174,19 @@ static size_t bc_program_index(char *code, size_t *bgn)
static char *bc_program_name(char *code, size_t *bgn)
{
size_t i;
- char *s, *str = code + *bgn, *ptr = strchr(str, BC_PARSE_STREND);
+ char *s;
- s = xmalloc(ptr - str + 1);
+ code += *bgn;
+ s = xmalloc(strchr(code, BC_PARSE_STREND) - code + 1);
i = 0;
for (;;) {
- char c = code[(*bgn)++];
- if (c == '\0' || c == BC_PARSE_STREND)
+ char c = *code++;
+ if (c == BC_PARSE_STREND)
break;
s[i++] = c;
}
s[i] = '\0';
+ *bgn += i + 1;
return s;
}