From 89c95454300f28b0241a44fc2aa7886304c90824 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 18 Oct 2008 15:56:07 +0200 Subject: Use str_list_equal() rather than str_list_compare(). --- source3/include/proto.h | 2 +- source3/lib/util_str.c | 23 ----------------------- source3/param/loadparm.c | 6 +++--- source3/web/swat.c | 3 ++- 4 files changed, 6 insertions(+), 28 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index cab294d8b1..ac900233fa 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1664,7 +1664,7 @@ char *binary_string(char *buf, int len); int fstr_sprintf(fstring s, const char *fmt, ...); char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep); char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list); -bool str_list_compare(char **list1, char **list2); +bool str_list_equal(const char **list1, const char **list2); size_t str_list_length( const char * const*list ); bool str_list_sub_basic( char **list, const char *smb_name, const char *domain_name ); diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 5d1893a85b..80aaa2b9c0 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1843,29 +1843,6 @@ int fstr_sprintf(fstring s, const char *fmt, ...) #define S_LIST_ABS 16 /* List Allocation Block Size */ -/** - * Return true if all the elements of the list match exactly. - **/ -bool str_list_compare(char **list1, char **list2) -{ - int num; - - if (!list1 || !list2) - return (list1 == list2); - - for (num = 0; list1[num]; num++) { - if (!list2[num]) - return false; - if (!strcsequal(list1[num], list2[num])) - return false; - } - if (list2[num]) - return false; /* if list2 has more elements than list1 fail */ - - return true; -} - - /****************************************************************************** version of standard_sub_basic() for string lists; uses talloc_sub_basic() for the work diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 3401bd16a0..d91d34d29b 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -7423,7 +7423,7 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2) return (*((char *)ptr1) == *((char *)ptr2)); case P_LIST: - return str_list_compare(*(char ***)ptr1, *(char ***)ptr2); + return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2); case P_STRING: case P_USTRING: @@ -7512,8 +7512,8 @@ static bool is_default(int i) return False; switch (parm_table[i].type) { case P_LIST: - return str_list_compare (parm_table[i].def.lvalue, - *(char ***)parm_table[i].ptr); + return str_list_equal((const char **)parm_table[i].def.lvalue, + *(const char ***)parm_table[i].ptr); case P_STRING: case P_USTRING: return strequal(parm_table[i].def.svalue, diff --git a/source3/web/swat.c b/source3/web/swat.c index 23fc43f776..27c4b54e2f 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -384,7 +384,8 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte break; case P_LIST: - if (!str_list_compare(*(char ***)ptr, (char **)(parm->def.lvalue))) continue; + if (!str_list_equal(*(const char ***)ptr, + (const char **)(parm->def.lvalue))) continue; break; case P_STRING: -- cgit