diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-13 11:27:33 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2009-12-13 11:27:33 +0100 |
commit | ef8cc767b201e4798a060282d4a6f280094bb8cc (patch) | |
tree | 4f19eae6870321f280959be4b7b24cd0e38d4c2a /common/set.c | |
parent | 7dd703c9af5f8b4a50f056c47588a9e51d4ea681 (diff) |
change dict and set API to perform loops with a list of strings instead of loop_first() and loop_next() functions
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1028 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'common/set.c')
-rw-r--r-- | common/set.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/common/set.c b/common/set.c index 7e82730..d36ce2d 100644 --- a/common/set.c +++ b/common/set.c @@ -2,7 +2,7 @@ set.c - set functions This file is part of the nss-pam-ldapd library. - Copyright (C) 2008 Arthur de Jong + Copyright (C) 2008, 2009 Arthur de Jong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -30,6 +30,12 @@ #include "set.h" #include "dict.h" +/* + The SET object is just a DICT which is passed around. The value + for each entry in the dict is just the pointer to the dict. + Another API is provided to give it a more set-like interface. +*/ + SET *set_new(void) { return (SET *)dict_new(); @@ -50,15 +56,7 @@ void set_free(SET *set) dict_free((DICT *)set); } -void set_loop_first(SET *set) -{ - dict_loop_first((DICT *)set); -} - -const char *set_loop_next(SET *set) +const char **set_tolist(SET *set) { - const char *value=NULL; - if (dict_loop_next((DICT *)set,&value,NULL)==NULL) - return NULL; - return value; + return dict_keys((DICT *)set); } |