From a9a29869a42cb072ebf813ce9f12bc571827a23a Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 22 May 2026 10:07:28 +0800 Subject: [PATCH] Format: tidy --- src/common/impl/format.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/common/impl/format.c b/src/common/impl/format.c index d25f5336c..13bf7f5f8 100644 --- a/src/common/impl/format.c +++ b/src/common/impl/format.c @@ -532,20 +532,7 @@ static bool parseQuickJSString(FFstrbuf* buffer, const char* script, uint32_t sc } #endif -bool ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments) { -#if FF_HAVE_QUICKJS - if (ffStrbufStartsWithS(formatstr, "qjs:")) { - return parseQuickJSString(buffer, formatstr->chars + 4, formatstr->length - 4, numArgs, arguments); - } -#endif - -#if FF_HAVE_LUA - if (ffStrbufStartsWithS(formatstr, "lua:")) { - // If outputFormat starts with "lua:", treat the rest as a Lua script - return parseLuaString(buffer, formatstr->chars + 4, formatstr->length - 4, numArgs, arguments); - } -#endif - +static bool parseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments) { uint32_t argCounter = 0; uint32_t numOpenIfs = 0; @@ -818,3 +805,20 @@ bool ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n return true; } + +bool ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments) { +#if FF_HAVE_QUICKJS + if (ffStrbufStartsWithS(formatstr, "qjs:")) { + return parseQuickJSString(buffer, formatstr->chars + 4, formatstr->length - 4, numArgs, arguments); + } +#endif + +#if FF_HAVE_LUA + if (ffStrbufStartsWithS(formatstr, "lua:")) { + // If outputFormat starts with "lua:", treat the rest as a Lua script + return parseLuaString(buffer, formatstr->chars + 4, formatstr->length - 4, numArgs, arguments); + } +#endif + + return parseFormatString(buffer, formatstr, numArgs, arguments); +}