+static void config_add_str(struct json_object *config, int optid, const char *val)
+{
+ config_add(config, optid, to_jstr(val));
+}
+
+static void config_add_optstr(struct json_object *config, int optid)
+{
+ config_add_str(config, optid, get_arg(optid));
+}
+
+static void config_mix2_cb(void *closure, struct json_object *obj, const char *name)
+{
+ struct json_object *dest, *base = closure;
+
+ if (!name)
+ name = "";
+
+ if (!json_object_object_get_ex(base, name, &dest)) {
+ dest = joomchk(json_object_new_object());
+ json_object_object_add(base, name, dest);
+ }
+ if (json_object_is_type(obj, json_type_object))
+ wrap_json_object_add(dest, obj);
+ else
+ json_object_object_add(dest, "", json_object_get(obj));
+}
+
+static void config_mix2(struct json_object *config, int optid, struct json_object *val)
+{
+ struct json_object *obj;
+
+ if (!json_object_object_get_ex(config, name_of_optid(optid), &obj)) {
+ obj = joomchk(json_object_new_object());
+ json_object_object_add(config, name_of_optid(optid), obj);
+ }
+ wrap_json_for_all(val, config_mix2_cb, obj);
+}