commit 59fdc07ddeff92ab869956e142de8716c973330e
parent fd2dcd76f62fcb3baa34a427b712937d0fccb1a7
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Wed, 13 Mar 2019 21:39:28 +0100
Remove functions mgu_*_test_unq_nc()
Only one of them was being used, only once, and
it was replaced by a straightforward call to
g_list_find_custom().
Diffstat:
3 files changed, 2 insertions(+), 51 deletions(-)
diff --git a/src/common/mgutils.c b/src/common/mgutils.c
@@ -317,53 +317,5 @@ gchar *mgu_slist_longest_entry( GSList *list ) {
}
/*
- * Test whether string appears in list of strings, ignoring case. NULL or empty
- * strings will be ignored.
- * Enter: list List to process.
- * str String to test.
- * Return: TRUE if string is unique.
- */
-gboolean mgu_slist_test_unq_nc( GSList *list, gchar *str ) {
- GSList *node;
-
- if( str ) {
- if( strlen( str ) > 0 ) {
- node = list;
- while( node ) {
- if( g_utf8_collate( str, node->data ) == 0 )
- return FALSE;
- node = g_slist_next( node );
- }
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/*
- * Test whether string appears in list of strings, ignoring case. NULL or empty
- * strings will be ignored.
- * Enter: list List to process.
- * str String to test.
- * Return: TRUE if string is unique.
- */
-gboolean mgu_list_test_unq_nc( GList *list, gchar *str ) {
- GList *node;
-
- if( str ) {
- if( strlen( str ) > 0 ) {
- node = list;
- while( node ) {
- if( g_utf8_collate( str, node->data ) == 0 )
- return FALSE;
- node = g_list_next( node );
- }
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/*
* End of Source.
*/
diff --git a/src/common/mgutils.h b/src/common/mgutils.h
@@ -53,8 +53,6 @@ GList *mgu_parse_string ( gchar *line, const gint maxTokens,
void mgu_str_unescape ( gchar *str );
void mgu_str_ltc2space ( gchar *str, gchar chlead, gchar chtail );
gchar *mgu_slist_longest_entry ( GSList *list );
-gboolean mgu_slist_test_unq_nc ( GSList *list, gchar *str );
-gboolean mgu_list_test_unq_nc ( GList *list, gchar *str );
#endif /* __MGUTILS_H__ */
diff --git a/src/ldapctrl.c b/src/ldapctrl.c
@@ -254,7 +254,8 @@ void ldapctl_criteria_list_clear( LdapControl *ctl ) {
void ldapctl_criteria_list_add( LdapControl *ctl, gchar *attr ) {
cm_return_if_fail( ctl != NULL );
if( attr != NULL ) {
- if( mgu_list_test_unq_nc( ctl->listCriteria, attr ) ) {
+ if( !g_list_find_custom( ctl->listCriteria, attr,
+ (GCompareFunc)g_utf8_collate ) ) {
debug_print("adding to criteria list: %s\n", attr);
ctl->listCriteria = g_list_append(
ctl->listCriteria, g_strdup( attr ) );