← Commit list

c9fc15359

Martin Lewis
Martin Lewis
2020-06-29
SUCCESS Duration: 152s

Subject

compare_string_array: 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 →

libbb/compare_string_array.c+5 -2
@@ -117,8 +117,11 @@ int FAST_FUNC index_in_substrings(const char *strings, const char *key)
const char* FAST_FUNC nth_string(const char *strings, int n)
{
while (n) {
- n--;
- strings += strlen(strings) + 1;
+ if (*strings++ == '\0') {
+ if (*strings == '\0') /* reached end of strings */
+ break;
+ n--;
+ }
}
return strings;
}