aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-07-18 08:18:37 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-07-18 08:18:37 +0000
commitb245a60021ef93b0157f6445aa152e808763a145 (patch)
tree05ca29430c16b377ff2025ed96c15a8a96703180 /src/util
parent44c3d88a33a82e66144ba0bbe491febd0e244703 (diff)
downloadgnunet-b245a60021ef93b0157f6445aa152e808763a145.tar.gz
gnunet-b245a60021ef93b0157f6445aa152e808763a145.zip
aaded new function to iterate over section entries
Diffstat (limited to 'src/util')
-rw-r--r--src/util/configuration.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 978765970..88bde1c38 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -390,6 +390,39 @@ GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
390 390
391 391
392/** 392/**
393 * Iterate over values of a section in the configuration.
394 *
395 * @param cfg configuration to inspect
396 * @param section the section
397 * @param iter function to call on each option
398 * @param iter_cls closure for iter
399 */
400void
401GNUNET_CONFIGURATION_iterate_section_values (const struct GNUNET_CONFIGURATION_Handle *cfg,
402 const char *section,
403 GNUNET_CONFIGURATION_Iterator iter,
404 void *iter_cls)
405{
406 struct ConfigSection *spos;
407 struct ConfigEntry *epos;
408
409 spos = cfg->sections;
410 while ((spos != NULL) && (0 != strcmp (spos->name, section)))
411 spos = spos->next;
412
413 if (spos == NULL)
414 return;
415
416 epos = spos->entries;
417 while (epos != NULL)
418 {
419 iter (iter_cls, spos->name, epos->key, epos->val);
420 epos = epos->next;
421 }
422}
423
424
425/**
393 * Iterate over all sections in the configuration. 426 * Iterate over all sections in the configuration.
394 * 427 *
395 * @param cfg configuration to inspect 428 * @param cfg configuration to inspect