diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-18 08:18:37 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-18 08:18:37 +0000 |
commit | b245a60021ef93b0157f6445aa152e808763a145 (patch) | |
tree | 05ca29430c16b377ff2025ed96c15a8a96703180 /src/util | |
parent | 44c3d88a33a82e66144ba0bbe491febd0e244703 (diff) | |
download | gnunet-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.c | 33 |
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 | */ | ||
400 | void | ||
401 | GNUNET_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 |