diff options
author | Dmitri Pal <dpal@redhat.com> | 2009-12-25 18:54:56 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-01-21 15:02:15 -0500 |
commit | 526dd14cdc1461859a5dd1cdd83ee9b1268175fe (patch) | |
tree | c5822d0dc74c09021d2f13cbd3d8fc0ee7ba87be /common/ini/ini_config_ut.c | |
parent | 650261ebb1fc02b1469a3ca38e1bdc17fa5b96ec (diff) | |
download | sssd-526dd14cdc1461859a5dd1cdd83ee9b1268175fe.tar.gz sssd-526dd14cdc1461859a5dd1cdd83ee9b1268175fe.tar.bz2 sssd-526dd14cdc1461859a5dd1cdd83ee9b1268175fe.zip |
INI: Added method to get string list with empty values
The original implementation was compressing the list,
throwing away empty strings.
The function that did that was pretty brain damaging.
I cleaned it up and adjusted so that it could return
list with empty values and without them.
The old function was turned into a wrapper and a new
high level function was intorduced to provide
ability to get both empty and non empty strings.
Diffstat (limited to 'common/ini/ini_config_ut.c')
-rw-r--r-- | common/ini/ini_config_ut.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/common/ini/ini_config_ut.c b/common/ini/ini_config_ut.c index 52e89cb1..fabc0881 100644 --- a/common/ini/ini_config_ut.c +++ b/common/ini/ini_config_ut.c @@ -755,6 +755,25 @@ int get_test(void) free_string_config_array(strarray); + printf("Get raw str array without size.\n"); + + error = 0; + strarray = get_raw_string_config_array(item, ",", NULL, &error); + if (error) { + printf("Expect success got error %d.\n", error); + free_ini_config(ini_config); + return error; + } + + /* Can be used with this cycle */ + strptr = strarray; + while (*strptr != NULL) { + printf("[%s]\n",*strptr); + strptr++; + } + + free_string_config_array(strarray); + printf("Get str array with size.\n"); error = 0; @@ -771,6 +790,22 @@ int get_test(void) free_string_config_array(strarray); + printf("Get raw str array with size.\n"); + + error = 0; + size = 0; + strarray = get_raw_string_config_array(item, ",", &size, &error); + if (error) { + printf("Expect success got error %d.\n", error); + free_ini_config(ini_config); + return error; + } + + /* Can be used with this cycle */ + for (i=0;i<size;i++) printf("[%s]\n",*(strarray + i)); + + free_string_config_array(strarray); + printf("Get long array item\n"); item = NULL; |