Skip to content

Commit ee8ab4e

Browse files
acmelgregkh
authored andcommitted
perf metricgroup: Constify variables storing the result of strchr() on const tables
commit b428686 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8bac35a commit ee8ab4e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

tools/perf/util/metricgroup.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static int setup_metric_events(const char *pmu, struct hashmap *ids,
364364
static bool match_metric_or_groups(const char *metric_or_groups, const char *sought)
365365
{
366366
int len;
367-
char *m;
367+
const char *m;
368368

369369
if (!sought)
370370
return false;
@@ -439,11 +439,10 @@ static const char *code_characters = ",-=@";
439439

440440
static int encode_metric_id(struct strbuf *sb, const char *x)
441441
{
442-
char *c;
443442
int ret = 0;
444443

445444
for (; *x; x++) {
446-
c = strchr(code_characters, *x);
445+
const char *c = strchr(code_characters, *x);
447446
if (c) {
448447
ret = strbuf_addch(sb, '!');
449448
if (ret)

0 commit comments

Comments
 (0)