]> 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>
Mon, 30 Jun 2025 09:24:27 +0000 (11:24 +0200)
Addresses: https://github.com/util-linux/util-linux/issues/3626
Signed-off-by: Karel Zak <kzak@redhat.com>
include/strutils.h
sys-utils/lscpu-cputype.c
term-utils/script-playutils.c
term-utils/script.c

index 04c867fde889adeba4b5752d8c68d14ae559b9a7..2ee7c3e531e32eb7b6c7dedddc09bc7e11dbbeb4 100644 (file)
@@ -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;
 
index d741ce60024fa0a2a1d25670ae626da705362605..c3a4cbaa2f9fb643366fe092840e481df49200af 100644 (file)
@@ -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);
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 7f31c141cf0ec335441bc737f8904779509c4125..b7777776eb0db97be3046a9d873e2c5465bd6e2f 100644 (file)
@@ -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;
        }