From: Karel Zak Date: Mon, 30 Jun 2025 09:15:30 +0000 (+0200) Subject: lib/strutils: add ul_ prefix to strrep() and strrem() functions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7bb1151e559710f18682454384c99d7cd67f35fb;p=thirdparty%2Futil-linux.git lib/strutils: add ul_ prefix to strrep() and strrem() functions Addresses: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak --- diff --git a/include/strutils.h b/include/strutils.h index 04c867fde..2ee7c3e53 100644 --- a/include/strutils.h +++ b/include/strutils.h @@ -420,13 +420,13 @@ static inline size_t normalize_whitespace(unsigned char *str) return __normalize_whitespace(str, sz, str, sz + 1); } -static inline void strrep(char *s, int find, int replace) +static inline void ul_strrep(char *s, int find, int replace) { while (s && *s && (s = strchr(s, find)) != NULL) *s++ = replace; } -static inline void strrem(char *s, int rem) +static inline void ul_strrem(char *s, int rem) { char *p; diff --git a/sys-utils/lscpu-cputype.c b/sys-utils/lscpu-cputype.c index d741ce600..c3a4cbaa2 100644 --- a/sys-utils/lscpu-cputype.c +++ b/sys-utils/lscpu-cputype.c @@ -962,14 +962,14 @@ int lscpu_read_vulnerabilities(struct lscpu_cxt *cxt) /* Name */ vu->name = xstrdup(d->d_name); *vu->name = toupper(*vu->name); - strrep(vu->name, '_', ' '); + ul_strrep(vu->name, '_', ' '); /* Description */ vu->text = str; p = (char *) ul_startswith(vu->text, "Mitigation"); if (p) { *p = ';'; - strrem(vu->text, ':'); + ul_strrem(vu->text, ':'); } } closedir(dir); diff --git a/term-utils/script-playutils.c b/term-utils/script-playutils.c index 854d95252..8c68ad14c 100644 --- a/term-utils/script-playutils.c +++ b/term-utils/script-playutils.c @@ -359,7 +359,7 @@ static int read_multistream_step(struct replay_step *step, FILE *f, char type) break; } if (*buf) { - strrem(buf, '\n'); + ul_strrem(buf, '\n'); step->value = strrealloc(step->value, buf); if (!step->value) err_oom(); diff --git a/term-utils/script.c b/term-utils/script.c index 7f31c141c..b7777776e 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -826,7 +826,7 @@ int main(int argc, char **argv) case 'c': ctl.command = optarg; ctl.command_norm = xstrdup(ctl.command); - strrep(ctl.command_norm, '\n', ' '); + ul_strrep(ctl.command_norm, '\n', ' '); break; case 'E': if (strcmp(optarg, "auto") == 0) @@ -939,7 +939,7 @@ int main(int argc, char **argv) errx(EXIT_FAILURE, _("failed to concatenate arguments")); ctl.command_norm = xstrdup(ctl.command); - strrep(ctl.command_norm, '\n', ' '); + ul_strrep(ctl.command_norm, '\n', ' '); argc = 0; }