Blame SOURCES/0163-utils-make-arguments-of-a-list-func-const.patch

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