Both had copies originating from git.git, move those to tools/lib/string.c, getting both tools/lib/subcmd/ and tools/perf/ to use it.
Showing the changes to tools/lib/string.c (1 of 7 files). Show all
Unified · Split
| @@ -87,3 +87,12 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size) · 86 unmodified lines | ||
| 87 | 87 | } |
| 88 | 88 | return ret; |
| 89 | 89 | } |
| 90 | + | |
| 91 | +int prefixcmp(const char *str, const char *prefix) | |
| 92 | +{ | |
| 93 | + for (; ; str++, prefix++) | |
| 94 | + if (!*prefix) | |
| 95 | + return 0; | |
| 96 | + else if (*str != *prefix) | |
| 97 | + return (unsigned char)*prefix - (unsigned char)*str; | |
| 98 | +} | |