]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:lib: remove unused str_list_substitute()
authorStefan Metzmacher <metze@samba.org>
Tue, 15 Oct 2019 08:15:41 +0000 (10:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Nov 2019 10:25:31 +0000 (10:25 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/include/proto.h
source3/lib/util_str.c

index bf0ea06aa9eb92d78cf115b6a8e71749daf0ec4e..c097ab19d14c62aa3dbceb9e88cb5e6ebb2db9e5 100644 (file)
@@ -620,7 +620,6 @@ size_t strlen_m(const char *s);
 size_t strlen_m_term(const char *s);
 size_t strlen_m_term_null(const char *s);
 int fstr_sprintf(fstring s, const char *fmt, ...);
-bool str_list_substitute(char **list, const char *pattern, const char *insert);
 
 char *ipstr_list_make(char **ipstr_list,
                        const struct ip_service *ip_list,
index e660e295c3394a3bd0620bce560b24f8a4755542..5d1d1291011ae6c56e26db878fbabbc4d843e671 100644 (file)
@@ -570,80 +570,6 @@ int fstr_sprintf(fstring s, const char *fmt, ...)
        return ret;
 }
 
-/**
- List of Strings manipulation functions
-**/
-
-#define S_LIST_ABS 16 /* List Allocation Block Size */
-
-/******************************************************************************
- substitute a specific pattern in a string list
- *****************************************************************************/
-
-bool str_list_substitute(char **list, const char *pattern, const char *insert)
-{
-       TALLOC_CTX *ctx = list;
-       char *p, *s, *t;
-       ssize_t ls, lp, li, ld, i, d;
-
-       if (!list)
-               return false;
-       if (!pattern)
-               return false;
-       if (!insert)
-               return false;
-
-       lp = (ssize_t)strlen(pattern);
-       li = (ssize_t)strlen(insert);
-       ld = li -lp;
-
-       while (*list) {
-               s = *list;
-               ls = (ssize_t)strlen(s);
-
-               while ((p = strstr_m(s, pattern))) {
-                       t = *list;
-                       d = p -t;
-                       if (ld) {
-                               t = talloc_array(ctx, char, ls +ld +1);
-                               if (!t) {
-                                       DEBUG(0,("str_list_substitute: "
-                                               "Unable to allocate memory"));
-                                       return false;
-                               }
-                               memcpy(t, *list, d);
-                               memcpy(t +d +li, p +lp, ls -d -lp +1);
-                               TALLOC_FREE(*list);
-                               *list = t;
-                               ls += ld;
-                               s = t +d +li;
-                       }
-
-                       for (i = 0; i < li; i++) {
-                               switch (insert[i]) {
-                                       case '`':
-                                       case '"':
-                                       case '\'':
-                                       case ';':
-                                       case '$':
-                                       case '%':
-                                       case '\r':
-                                       case '\n':
-                                               t[d +i] = '_';
-                                               break;
-                                       default:
-                                               t[d +i] = insert[i];
-                               }
-                       }
-               }
-
-               list++;
-       }
-
-       return true;
-}
-
-
 #define IPSTR_LIST_SEP ","
 #define IPSTR_LIST_CHAR        ','