|
|
4b6aa8 |
From 4d5571e60769e08efc7dcbbe4cd69b68cd7e5a4e Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
4b6aa8 |
Date: Fri, 12 Feb 2016 14:32:29 +0100
|
|
|
4b6aa8 |
Subject: [PATCH] utils: make arguments of a list func const
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
src/include/internal_libreport.h | 4 ++--
|
|
|
4b6aa8 |
src/lib/is_in_string_list.c | 4 ++--
|
|
|
4b6aa8 |
src/lib/make_descr.c | 6 +++---
|
|
|
4b6aa8 |
src/lib/problem_data.c | 8 ++++----
|
|
|
4b6aa8 |
4 files changed, 11 insertions(+), 11 deletions(-)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
|
|
|
4b6aa8 |
index 38d75a1..108f4f1 100644
|
|
|
4b6aa8 |
--- a/src/include/internal_libreport.h
|
|
|
4b6aa8 |
+++ b/src/include/internal_libreport.h
|
|
|
4b6aa8 |
@@ -293,10 +293,10 @@ char *run_in_shell_and_save_output(int flags,
|
|
|
4b6aa8 |
/* Random utility functions */
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
#define is_in_string_list libreport_is_in_string_list
|
|
|
4b6aa8 |
-bool is_in_string_list(const char *name, char **v);
|
|
|
4b6aa8 |
+bool is_in_string_list(const char *name, const char *const *v);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
#define index_of_string_in_list libreport_index_of_string_in_list
|
|
|
4b6aa8 |
-int index_of_string_in_list(const char *name, char **v);
|
|
|
4b6aa8 |
+int index_of_string_in_list(const char *name, const char *const *v);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
#define is_in_comma_separated_list libreport_is_in_comma_separated_list
|
|
|
4b6aa8 |
bool is_in_comma_separated_list(const char *value, const char *list);
|
|
|
4b6aa8 |
diff --git a/src/lib/is_in_string_list.c b/src/lib/is_in_string_list.c
|
|
|
4b6aa8 |
index e0ee26b..b75abe4 100644
|
|
|
4b6aa8 |
--- a/src/lib/is_in_string_list.c
|
|
|
4b6aa8 |
+++ b/src/lib/is_in_string_list.c
|
|
|
4b6aa8 |
@@ -18,7 +18,7 @@
|
|
|
4b6aa8 |
*/
|
|
|
4b6aa8 |
#include "internal_libreport.h"
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
-bool is_in_string_list(const char *name, char **v)
|
|
|
4b6aa8 |
+bool is_in_string_list(const char *name, const char *const *v)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
while (*v)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
@@ -29,7 +29,7 @@ bool is_in_string_list(const char *name, char **v)
|
|
|
4b6aa8 |
return false;
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
-int index_of_string_in_list(const char *name, char **v)
|
|
|
4b6aa8 |
+int index_of_string_in_list(const char *name, const char *const *v)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
for(int i = 0; v[i]; ++i)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
|
|
|
4b6aa8 |
index f8da893..fd180a9 100644
|
|
|
4b6aa8 |
--- a/src/lib/make_descr.c
|
|
|
4b6aa8 |
+++ b/src/lib/make_descr.c
|
|
|
4b6aa8 |
@@ -20,7 +20,7 @@
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static bool rejected_name(const char *name, char **v, int flags)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- bool r = is_in_string_list(name, v);
|
|
|
4b6aa8 |
+ bool r = is_in_string_list(name, (const char *const *)v);
|
|
|
4b6aa8 |
if (flags & MAKEDESC_WHITELIST)
|
|
|
4b6aa8 |
r = !r;
|
|
|
4b6aa8 |
return r;
|
|
|
4b6aa8 |
@@ -59,8 +59,8 @@ static int list_cmp(const char *s1, const char *s2)
|
|
|
4b6aa8 |
FILENAME_COUNT ,
|
|
|
4b6aa8 |
NULL
|
|
|
4b6aa8 |
};
|
|
|
4b6aa8 |
- int s1_index = index_of_string_in_list(s1, (char**) list_order);
|
|
|
4b6aa8 |
- int s2_index = index_of_string_in_list(s2, (char**) list_order);
|
|
|
4b6aa8 |
+ int s1_index = index_of_string_in_list(s1, list_order);
|
|
|
4b6aa8 |
+ int s2_index = index_of_string_in_list(s2, list_order);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
if(s1_index < 0 && s2_index < 0)
|
|
|
4b6aa8 |
return strcmp(s1, s2);
|
|
|
4b6aa8 |
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
|
|
|
4b6aa8 |
index 212f337..9e625bd 100644
|
|
|
4b6aa8 |
--- a/src/lib/problem_data.c
|
|
|
4b6aa8 |
+++ b/src/lib/problem_data.c
|
|
|
4b6aa8 |
@@ -303,7 +303,7 @@ static const char *const editable_files[] = {
|
|
|
4b6aa8 |
};
|
|
|
4b6aa8 |
static bool is_editable_file(const char *file_name)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- return is_in_string_list(file_name, (char**)editable_files);
|
|
|
4b6aa8 |
+ return is_in_string_list(file_name, editable_files);
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
/* When is_text_file() returns this special pointer value,
|
|
|
4b6aa8 |
@@ -353,7 +353,7 @@ static char* is_text_file_at(int dir_fd, const char *name, ssize_t *sz)
|
|
|
4b6aa8 |
if (base)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
base++;
|
|
|
4b6aa8 |
- if (is_in_string_list(base, (char**)always_text_files))
|
|
|
4b6aa8 |
+ if (is_in_string_list(base, always_text_files))
|
|
|
4b6aa8 |
goto text;
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
@@ -423,7 +423,7 @@ void problem_data_load_from_dump_dir(problem_data_t *problem_data, struct dump_d
|
|
|
4b6aa8 |
dd_init_next_file(dd);
|
|
|
4b6aa8 |
while (dd_get_next_file(dd, &short_name, &full_name))
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- if (excluding && is_in_string_list(short_name, excluding))
|
|
|
4b6aa8 |
+ if (excluding && is_in_string_list(short_name, (const char *const *)excluding))
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
//log("Excluded:'%s'", short_name);
|
|
|
4b6aa8 |
goto next;
|
|
|
4b6aa8 |
@@ -494,7 +494,7 @@ void problem_data_load_from_dump_dir(problem_data_t *problem_data, struct dump_d
|
|
|
4b6aa8 |
FILENAME_REASON ,
|
|
|
4b6aa8 |
NULL
|
|
|
4b6aa8 |
};
|
|
|
4b6aa8 |
- if (is_in_string_list(short_name, (char**)list_files))
|
|
|
4b6aa8 |
+ if (is_in_string_list(short_name, list_files))
|
|
|
4b6aa8 |
flags |= CD_FLAG_LIST;
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
if (strcmp(short_name, FILENAME_TIME) == 0)
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
1.8.3.1
|
|
|
4b6aa8 |
|