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:
Peter Krempa
2016-02-12 14:09:02 +01:00
parent 018010f05c
commit 27fa42b24c
3 changed files with 26 additions and 10 deletions

View File

@@ -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)