+/**
+ * Parse a configuration file @a filename and run the function
+ * @a cb with the resulting configuration object. Then free the
+ * configuration object and return the status value from @a cb.
+ *
+ * @param filename configuration to parse, NULL for "default"
+ * @param cb function to run
+ * @param cb_cls closure for @a cb
+ * @return #GNUNET_SYSERR if parsing the configuration failed,
+ * otherwise return value from @a cb.
+ */
+int
+GNUNET_CONFIGURATION_parse_and_run (const char *filename,
+ GNUNET_CONFIGURATION_Callback cb,
+ void *cb_cls)
+{
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+ int ret;
+
+ cfg = GNUNET_CONFIGURATION_create ();
+ if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, filename))
+ {
+ GNUNET_break (0);
+ GNUNET_CONFIGURATION_destroy (cfg);
+ return GNUNET_SYSERR;
+ }
+ ret = cb (cb_cls, cfg);
+ GNUNET_CONFIGURATION_destroy (cfg);
+ return ret;
+}
+
+