Get rid of module_path_get_name() and use the find backend function
authorJelmer Vernooij <jelmer@samba.org>
Thu, 24 Apr 2003 20:27:19 +0000 (20:27 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 24 Apr 2003 20:27:19 +0000 (20:27 +0000)
to find duplicates
(This used to be commit 871cad7e9ac38e6f8e4391fcb2894d91300cbe94)

source3/lib/iconv.c

index d161975601c5654e0282c11218d64596ea345b53..01fa31915a2f392414c114a52b9d3e4e1bd1d1bc 100644 (file)
@@ -66,12 +66,9 @@ static struct charset_functions *charsets = NULL;
 static struct charset_functions *find_charset_functions(const char *name) 
 {
        struct charset_functions *c = charsets;
-       pstring stripped;
 
-       module_path_get_name(name, stripped);
-       
        while(c) {
-               if (strcasecmp(stripped, c->name) == 0) {
+               if (strcasecmp(name, c->name) == 0) {
                        return c;
                }
                c = c->next;
@@ -86,12 +83,10 @@ BOOL smb_register_charset(struct charset_functions *funcs)
 
        DEBUG(5, ("Attempting to register new charset %s\n", funcs->name));
        /* Check whether we already have this charset... */
-       while(c) {
-               if(!strcasecmp(c->name, funcs->name)){ 
-                       DEBUG(2, ("Duplicate charset %s, not registering\n", funcs->name));
-                       return False;
-               }
-               c = c->next;
+
+       if (find_charset_functions(funcs->name)) {
+               DEBUG(0, ("Duplicate charset %s, not registering\n", funcs->name));
+               return False;
        }
 
        funcs->next = funcs->prev = NULL;