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

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