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

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