diff options
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r-- | src/util/configuration.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index 769d2aadc..ff177d966 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -315,6 +315,49 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *data, | |||
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
319 | GNUNET_CONFIGURATION_Iterator iter, | ||
320 | void *iter_cls) | ||
321 | { | ||
322 | struct ConfigSection *spos; | ||
323 | struct ConfigEntry *epos; | ||
324 | |||
325 | spos = cfg->sections; | ||
326 | while (spos != NULL) | ||
327 | { | ||
328 | epos = spos->entries; | ||
329 | while (epos != NULL) | ||
330 | { | ||
331 | iter (iter_cls, spos->name, epos->key, epos->val); | ||
332 | epos = epos->next; | ||
333 | } | ||
334 | spos = spos->next; | ||
335 | } | ||
336 | } | ||
337 | |||
338 | |||
339 | static void | ||
340 | copy_entry (void *cls, | ||
341 | const char *section, | ||
342 | const char *option, | ||
343 | const char *value) | ||
344 | { | ||
345 | struct GNUNET_CONFIGURATION_Handle *dst = cls; | ||
346 | GNUNET_CONFIGURATION_set_value_string (dst, section, option, value); | ||
347 | } | ||
348 | |||
349 | |||
350 | struct GNUNET_CONFIGURATION_Handle * | ||
351 | GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
352 | { | ||
353 | struct GNUNET_CONFIGURATION_Handle *ret; | ||
354 | |||
355 | ret = GNUNET_CONFIGURATION_create (); | ||
356 | GNUNET_CONFIGURATION_iterate (cfg, ©_entry, ret); | ||
357 | return ret; | ||
358 | } | ||
359 | |||
360 | |||
318 | static struct ConfigSection * | 361 | static struct ConfigSection * |
319 | findSection (const struct GNUNET_CONFIGURATION_Handle *data, const char *section) | 362 | findSection (const struct GNUNET_CONFIGURATION_Handle *data, const char *section) |
320 | { | 363 | { |