]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/strutils: add ul_ prefix to strrep() and strrem() functions
authorKarel Zak <kzak@redhat.com>
Mon, 30 Jun 2025 09:15:30 +0000 (11:15 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Sep 2025 09:48:25 +0000 (11:48 +0200)
Addresses: https://github.com/util-linux/util-linux/issues/3626
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 7bb1151e559710f18682454384c99d7cd67f35fb)

include/strutils.h
sys-utils/lscpu-cputype.c
term-utils/script-playutils.c
term-utils/script.c

index c8c616f7bf7d57dfdd9a57d228f391c2f22cd484..a7177fc23212b650f45d9af13e2002a1bffdb86d 100644 (file)
@@ -405,13 +405,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;
 
index 98ad03e71f74d48139c1b104c3d61c691c6caacf..3937a00a8132726dfce3446503daa1d89f603a2e 100644 (file)
@@ -961,14 +961,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);
index 854d9525228f36e13939f0a5e1a3f1598c9cee12..8c68ad14ca538d4b4c03344a76a1c1ce14e8edc3 100644 (file)
@@ -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();
index 90070248d49c1b50b6dd5dfa518a05245ad5d433..5b2d6b517727d83f2bf1450648ac770b19bbff13 100644 (file)
@@ -824,7 +824,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)