Skip to content

Commit c1f6a2f

Browse files
committed
Refactor: inline printError into ffPrintError and remove unused static helper
1 parent 9c455c3 commit c1f6a2f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/common/printing.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleAr
100100
ffStrbufPutTo(&buffer, stdout);
101101
}
102102

103-
static void printError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, va_list arguments)
103+
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
104104
{
105105
if(!instance.config.display.showErrors)
106106
return;
@@ -110,22 +110,17 @@ static void printError(const char* moduleName, uint8_t moduleIndex, const FFModu
110110
if(!instance.config.display.pipe)
111111
fputs(FASTFETCH_TEXT_MODIFIER_ERROR, stdout);
112112

113+
va_list arguments;
114+
va_start(arguments, message);
113115
vprintf(message, arguments);
116+
va_end(arguments);
114117

115118
if(!instance.config.display.pipe)
116119
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
117120

118121
putchar('\n');
119122
}
120123

121-
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
122-
{
123-
va_list arguments;
124-
va_start(arguments, message);
125-
printError(moduleName, moduleIndex, moduleArgs, printType, message, arguments);
126-
va_end(arguments);
127-
}
128-
129124
void ffPrintColor(const FFstrbuf* colorValue)
130125
{
131126
//If the color is not set, this would reset in \033[m, which resets everything.

0 commit comments

Comments
 (0)