mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 16:50:54 +07:00
perf script: Fix compiler warning in builtin_script.c:is_top_script()
Fix annoying compiler warning in the is_top_script() function. The issue was that a const char * was cast into a char * to call ends_with(). We fix the users of ends_with() instead. Some are passing a char *, but it is okay to cast the return value of ends_with() to char * (because we understand what ends_with() does). Cc: David S. Miller <davem@davemloft.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@gmail.com> LKML-Reference: <4cf92096.17edd80a.1540.5d60@mx.google.com> Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
cbf41645f3
commit
965bb6beaf
@ -387,10 +387,10 @@ static struct script_desc *script_desc__findnew(const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *ends_with(char *str, const char *suffix)
|
||||
static const char *ends_with(const char *str, const char *suffix)
|
||||
{
|
||||
size_t suffix_len = strlen(suffix);
|
||||
char *p = str;
|
||||
const char *p = str;
|
||||
|
||||
if (strlen(str) > suffix_len) {
|
||||
p = str + strlen(str) - suffix_len;
|
||||
@ -482,7 +482,7 @@ static int list_available_scripts(const struct option *opt __used,
|
||||
|
||||
for_each_script(lang_path, lang_dir, script_dirent, script_next) {
|
||||
script_root = strdup(script_dirent.d_name);
|
||||
str = ends_with(script_root, REPORT_SUFFIX);
|
||||
str = (char *)ends_with(script_root, REPORT_SUFFIX);
|
||||
if (str) {
|
||||
*str = '\0';
|
||||
desc = script_desc__findnew(script_root);
|
||||
@ -530,7 +530,7 @@ static char *get_script_path(const char *script_root, const char *suffix)
|
||||
|
||||
for_each_script(lang_path, lang_dir, script_dirent, script_next) {
|
||||
__script_root = strdup(script_dirent.d_name);
|
||||
str = ends_with(__script_root, suffix);
|
||||
str = (char *)ends_with(__script_root, suffix);
|
||||
if (str) {
|
||||
*str = '\0';
|
||||
if (strcmp(__script_root, script_root))
|
||||
@ -550,7 +550,7 @@ static char *get_script_path(const char *script_root, const char *suffix)
|
||||
|
||||
static bool is_top_script(const char *script_path)
|
||||
{
|
||||
return ends_with((char *)script_path, "top") == NULL ? false : true;
|
||||
return ends_with(script_path, "top") == NULL ? false : true;
|
||||
}
|
||||
|
||||
static int has_required_arg(char *script_path)
|
||||
|
Loading…
Reference in New Issue
Block a user