]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf metricgroup: Constify variables storing the result of strchr() on const tables
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 27 Jan 2026 04:15:47 +0000 (01:15 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 27 Jan 2026 04:54:47 +0000 (01:54 -0300)
As newer glibcs will propagate the const attribute of the searched table
to its return.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/metricgroup.c

index 25c75fdbfc525f91c3cb7a8b0bad3db35289b4c7..40a1e14de4189191d52a0b52d304c0fb4fa92de5 100644 (file)
@@ -367,7 +367,7 @@ static int setup_metric_events(const char *pmu, struct hashmap *ids,
 static bool match_metric_or_groups(const char *metric_or_groups, const char *sought)
 {
        int len;
-       char *m;
+       const char *m;
 
        if (!sought)
                return false;
@@ -450,11 +450,10 @@ static const char *code_characters = ",-=@";
 
 static int encode_metric_id(struct strbuf *sb, const char *x)
 {
-       char *c;
        int ret = 0;
 
        for (; *x; x++) {
-               c = strchr(code_characters, *x);
+               const char *c = strchr(code_characters, *x);
                if (c) {
                        ret = strbuf_addch(sb, '!');
                        if (ret)