JsonConfig: refactor to get rid of data-ffjson_*

This commit is contained in:
李通洲
2023-03-15 15:24:40 +08:00
parent 5f52c64d4d
commit dca9ce4b2d
37 changed files with 463 additions and 364 deletions
+10 -7
View File
@@ -52,7 +52,7 @@ void ffDestroyKernelOptions(FFKernelOptions* options)
}
#ifdef FF_HAVE_JSONC
bool ffParseKernelJsonObject(FFinstance* instance, const char* type, JSONCData* data, json_object* module)
bool ffParseKernelJsonObject(FFinstance* instance, const char* type, json_object* module)
{
if (strcasecmp(type, FF_KERNEL_MODULE_NAME) != 0)
return false;
@@ -60,15 +60,18 @@ bool ffParseKernelJsonObject(FFinstance* instance, const char* type, JSONCData*
FFKernelOptions __attribute__((__cleanup__(ffDestroyKernelOptions))) options;
ffInitKernelOptions(&options);
FF_JSON_OBJECT_OBJECT_FOREACH(data, module, key, val)
if (module)
{
if (strcasecmp(key, "type") == 0)
continue;
json_object_object_foreach(module, key, val)
{
if (strcasecmp(key, "type") == 0)
continue;
if (ffJsonConfigParseModuleArgs(data, key, val, &options.moduleArgs))
continue;
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
continue;
ffPrintError(instance, FF_KERNEL_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
ffPrintError(instance, FF_KERNEL_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
}
}
ffPrintKernel(instance, &options);