Blame SOURCES/0003-util-move-string_in_list-to-util_ext.patch

bb7cd1
From 7bf6cf5632fbdf83a37c52c40b7b982094b5c668 Mon Sep 17 00:00:00 2001
bb7cd1
From: Sumit Bose <sbose@redhat.com>
bb7cd1
Date: Mon, 20 Feb 2017 17:28:51 +0100
bb7cd1
Subject: [PATCH 03/15] util: move string_in_list to util_ext
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
To be able to include string_in_list() without additional
bb7cd1
dependencies it is moved into a separate file.
bb7cd1
bb7cd1
Related to https://pagure.io/SSSD/sssd/issue/3050
bb7cd1
bb7cd1
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
bb7cd1
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
bb7cd1
---
bb7cd1
 src/util/util.c     | 20 --------------------
bb7cd1
 src/util/util_ext.c | 22 ++++++++++++++++++++++
bb7cd1
 2 files changed, 22 insertions(+), 20 deletions(-)
bb7cd1
bb7cd1
diff --git a/src/util/util.c b/src/util/util.c
bb7cd1
index 9d6202f695d516f20d648621da81a2d5e746daa5..f0e8f9dd6a4bceed6befb74c57aa066b19a72bb7 100644
bb7cd1
--- a/src/util/util.c
bb7cd1
+++ b/src/util/util.c
bb7cd1
@@ -617,26 +617,6 @@ errno_t add_string_to_list(TALLOC_CTX *mem_ctx, const char *string,
bb7cd1
     return EOK;
bb7cd1
 }
bb7cd1
 
bb7cd1
-bool string_in_list(const char *string, char **list, bool case_sensitive)
bb7cd1
-{
bb7cd1
-    size_t c;
bb7cd1
-    int(*compare)(const char *s1, const char *s2);
bb7cd1
-
bb7cd1
-    if (string == NULL || list == NULL || *list == NULL) {
bb7cd1
-        return false;
bb7cd1
-    }
bb7cd1
-
bb7cd1
-    compare = case_sensitive ? strcmp : strcasecmp;
bb7cd1
-
bb7cd1
-    for (c = 0; list[c] != NULL; c++) {
bb7cd1
-        if (compare(string, list[c]) == 0) {
bb7cd1
-            return true;
bb7cd1
-        }
bb7cd1
-    }
bb7cd1
-
bb7cd1
-    return false;
bb7cd1
-}
bb7cd1
-
bb7cd1
 void safezero(void *data, size_t size)
bb7cd1
 {
bb7cd1
     volatile uint8_t *p = data;
bb7cd1
diff --git a/src/util/util_ext.c b/src/util/util_ext.c
bb7cd1
index fceb8c873a26471d476b39d5d4e567c445ed8d0b..04dc02a8adf32bd0590fe6eba230658e67d0a362 100644
bb7cd1
--- a/src/util/util_ext.c
bb7cd1
+++ b/src/util/util_ext.c
bb7cd1
@@ -24,6 +24,8 @@
bb7cd1
 #include <stdbool.h>
bb7cd1
 #include <errno.h>
bb7cd1
 #include <ctype.h>
bb7cd1
+#include <string.h>
bb7cd1
+#include <strings.h>
bb7cd1
 
bb7cd1
 #define EOK 0
bb7cd1
 
bb7cd1
@@ -119,3 +121,23 @@ done:
bb7cd1
     talloc_free(tmp_ctx);
bb7cd1
     return ret;
bb7cd1
 }
bb7cd1
+
bb7cd1
+bool string_in_list(const char *string, char **list, bool case_sensitive)
bb7cd1
+{
bb7cd1
+    size_t c;
bb7cd1
+    int(*compare)(const char *s1, const char *s2);
bb7cd1
+
bb7cd1
+    if (string == NULL || list == NULL || *list == NULL) {
bb7cd1
+        return false;
bb7cd1
+    }
bb7cd1
+
bb7cd1
+    compare = case_sensitive ? strcmp : strcasecmp;
bb7cd1
+
bb7cd1
+    for (c = 0; list[c] != NULL; c++) {
bb7cd1
+        if (compare(string, list[c]) == 0) {
bb7cd1
+            return true;
bb7cd1
+        }
bb7cd1
+    }
bb7cd1
+
bb7cd1
+    return false;
bb7cd1
+}
bb7cd1
-- 
bb7cd1
2.9.3
bb7cd1