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