gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16076 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r16076 - in gnunet/src: include util
Date: Mon, 18 Jul 2011 10:18:37 +0200

Author: wachs
Date: 2011-07-18 10:18:37 +0200 (Mon, 18 Jul 2011)
New Revision: 16076

Modified:
   gnunet/src/include/gnunet_configuration_lib.h
   gnunet/src/util/configuration.c
Log:
aaded new function to iterate over section entries


Modified: gnunet/src/include/gnunet_configuration_lib.h
===================================================================
--- gnunet/src/include/gnunet_configuration_lib.h       2011-07-18 08:16:27 UTC 
(rev 16075)
+++ gnunet/src/include/gnunet_configuration_lib.h       2011-07-18 08:18:37 UTC 
(rev 16076)
@@ -277,6 +277,20 @@
                                                   cb, void *cb_cls);
 
 /**
+ * Iterate over values of a section in the configuration.
+ *
+ * @param cfg configuration to inspect
+ * @param section the section
+ * @param iter function to call on each option
+ * @param iter_cls closure for iter
+ */
+void
+GNUNET_CONFIGURATION_iterate_section_values (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
+                              const char *section,
+                              GNUNET_CONFIGURATION_Iterator iter,
+                              void *iter_cls);
+
+/**
  * Get a configuration value that should be in a set of
  * predefined strings
  *

Modified: gnunet/src/util/configuration.c
===================================================================
--- gnunet/src/util/configuration.c     2011-07-18 08:16:27 UTC (rev 16075)
+++ gnunet/src/util/configuration.c     2011-07-18 08:18:37 UTC (rev 16076)
@@ -390,6 +390,39 @@
 
 
 /**
+ * Iterate over values of a section in the configuration.
+ *
+ * @param cfg configuration to inspect
+ * @param section the section
+ * @param iter function to call on each option
+ * @param iter_cls closure for iter
+ */
+void
+GNUNET_CONFIGURATION_iterate_section_values (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
+                              const char *section,
+                              GNUNET_CONFIGURATION_Iterator iter,
+                              void *iter_cls)
+{
+  struct ConfigSection *spos;
+  struct ConfigEntry *epos;
+
+  spos = cfg->sections;
+  while ((spos != NULL) && (0 != strcmp (spos->name, section)))
+    spos = spos->next;
+
+  if (spos == NULL)
+    return;
+
+  epos = spos->entries;
+  while (epos != NULL)
+    {
+      iter (iter_cls, spos->name, epos->key, epos->val);
+      epos = epos->next;
+    }
+}
+
+
+/**
  * Iterate over all sections in the configuration.
  *
  * @param cfg configuration to inspect




reply via email to

[Prev in Thread] Current Thread [Next in Thread]