mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cpumf/pai: Remove unnecessary const parameter definition
With glibc 2.43 const-ness is preserved for standard library functions and a compiler warning will be issued if this is violated. pai parse_cpulist() receives user input via the parm function parameter. The parameter is defined as 'const char *' and used as input value for strchr(). The target pointer (cp) is defined as mutable 'char *' leading to violation of const correctness and this compiler warning: pai.c: In function ‘parse_cpulist’: pai.c:907:20: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 907 | cp = strchr(parm, ':'); Since the user input is coming from optarg 'non-const char *', it is unnecessary to have the function parameters carrying this data defined as const. Remove the unnecessary const definition in the function call chain to fix the described issue. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Suggested-by: Jan Hoeppner <hoeppner@linux.ibm.com> Suggested-by: Juergen Christ <jchrist@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
8f2d77c9d3
commit
21c2a04347
@@ -894,7 +894,7 @@ static int parse_event_attr(char *cp)
|
||||
}
|
||||
|
||||
/* Parse CPU list and event specifications */
|
||||
static void parse_cpulist(int enr, const char *parm)
|
||||
static void parse_cpulist(int enr, char *parm)
|
||||
{
|
||||
unsigned int evt_attr = 0;
|
||||
cpu_set_t cmdlist, result;
|
||||
@@ -948,14 +948,14 @@ static const struct util_prg prg = {
|
||||
}
|
||||
};
|
||||
|
||||
static void record_cpus_crypto(const char *cp)
|
||||
static void record_cpus_crypto(char *cp)
|
||||
{
|
||||
if (!libcpumf_have_pai_crypto())
|
||||
errx(EXIT_FAILURE, "No support for PAI crypto counters");
|
||||
parse_cpulist(S390_EVT_PAI_CRYPTO, cp);
|
||||
}
|
||||
|
||||
static void record_cpus_nnpa(const char *cp)
|
||||
static void record_cpus_nnpa(char *cp)
|
||||
{
|
||||
if (!libcpumf_have_pai_nnpa())
|
||||
errx(EXIT_FAILURE, "No support for PAI nnpa counters");
|
||||
|
||||
Reference in New Issue
Block a user