mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
vsh: Replace vshPrint macro with function
The macro would eat the first parameter. In some cases the format string for vshPrint was eaten. In other cases the calls referenced variables which did not exist in the given context. Avoid errors by doing compile time checking.
This commit is contained in:
15
tools/vsh.c
15
tools/vsh.c
@@ -1720,6 +1720,21 @@ vshPrintExtra(vshControl *ctl, const char *format, ...)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vshPrint(vshControl *ctl ATTRIBUTE_UNUSED, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *str;
|
||||
|
||||
va_start(ap, format);
|
||||
if (virVasprintfQuiet(&str, format, ap) < 0)
|
||||
vshErrorOOM();
|
||||
va_end(ap);
|
||||
fputs(str, stdout);
|
||||
VIR_FREE(str);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
vshTTYIsInterruptCharacter(vshControl *ctl ATTRIBUTE_UNUSED,
|
||||
const char chr ATTRIBUTE_UNUSED)
|
||||
|
||||
Reference in New Issue
Block a user