Chassis: refactor

This commit is contained in:
李通洲
2023-06-16 16:33:43 +08:00
committed by CarterLi
parent 4360450ac6
commit 5483cb9143
5 changed files with 15 additions and 26 deletions
+8 -5
View File
@@ -8,18 +8,22 @@
void ffPrintChassis(FFinstance* instance, FFChassisOptions* options)
{
FFChassisResult result;
ffDetectChassis(&result);
ffStrbufInit(&result.chassisType);
ffStrbufInit(&result.chassisVendor);
ffStrbufInit(&result.chassisVersion);
if(result.error.length > 0)
const char* error = ffDetectChassis(&result);
if(error)
{
ffPrintError(instance, FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, "%*s", result.error.length, result.error.chars);
ffPrintError(instance, FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, "%s", error);
goto exit;
}
if(result.chassisType.length == 0)
{
ffPrintError(instance, FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, "chassis_type is not set by O.E.M.");
return;
goto exit;
}
if(options->moduleArgs.outputFormat.length == 0)
@@ -46,7 +50,6 @@ exit:
ffStrbufDestroy(&result.chassisType);
ffStrbufDestroy(&result.chassisVendor);
ffStrbufDestroy(&result.chassisVersion);
ffStrbufDestroy(&result.error);
}
void ffInitChassisOptions(FFChassisOptions* options)