summaryrefslogtreecommitdiffstats
path: root/common/ini/ini_config.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-12-25 18:54:56 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-01-21 15:02:15 -0500
commit526dd14cdc1461859a5dd1cdd83ee9b1268175fe (patch)
treec5822d0dc74c09021d2f13cbd3d8fc0ee7ba87be /common/ini/ini_config.h
parent650261ebb1fc02b1469a3ca38e1bdc17fa5b96ec (diff)
downloadsssd-526dd14cdc1461859a5dd1cdd83ee9b1268175fe.tar.gz
sssd-526dd14cdc1461859a5dd1cdd83ee9b1268175fe.tar.xz
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.h')
-rw-r--r--common/ini/ini_config.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/common/ini/ini_config.h b/common/ini/ini_config.h
index 12d4a8092..2c906e476 100644
--- a/common/ini/ini_config.h
+++ b/common/ini/ini_config.h
@@ -226,15 +226,37 @@ const char *get_const_string_config_value(struct collection_item *item, int *err
char *get_bin_config_value(struct collection_item *item, int *length, int *error);
void free_bin_config_value(char *);
-/* Array of stings */
-/* Separator string includes up to three different separators. If NULL comma is assumed. */
-/* The spaces are trimmed automatically around separators in the string. */
-char **get_string_config_array(struct collection_item *item, const char *sep, int *size, int *error);
+/* Array of stings.
+ * Separator string includes up to three different separators. If NULL comma is assumed.
+ * The spaces are trimmed automatically around separators in the string.
+ * The function drops empty tokens from the list.
+ * This means that the string like this: "apple, ,banana, ,orange ,"
+ * will be translated into the list of three items: "apple","banana" and "orange".
+ *
+ * The length of the allocated array is returned in "size".
+ * Size and error parameters can be NULL.
+ * Use free_string_config_array() to free the array after use.
+ */
+char **get_string_config_array(struct collection_item *item,
+ const char *sep, int *size, int *error);
+
+/* This function is same as above but does not omit empty tokens.
+ * This means that the string like this: "apple, ,banana, ,orange ,"
+ * will be translated into the items: "apple", "", "banana", "", "orange", "".
+ * This function is useful when the configuration parameter
+ * holds a positionally sensitive list.
+ * Use free_string_config_array() to free the array after use.
+ */
+char **get_raw_string_config_array(struct collection_item *item,
+ const char *sep, int *size, int *error);
+
/* Array of long values - separators are detected automatically. */
-/* The length of the allocated array is returned in "size" */
+/* The length of the allocated array is returned in "size". */
+/* Size and error parameters can be NULL. */
long *get_long_config_array(struct collection_item *item, int *size, int *error);
/* Array of double values - separators are detected automatically. */
/* The length of the allocated array is returned in "size" */
+/* Size and error parameters can be NULL. */
double *get_double_config_array(struct collection_item *item, int *size, int *error);
/* Special function to free string config array */