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:
@@ -300,6 +300,8 @@ const vshCmdOpt *vshCommandOptArgv(vshControl *ctl, const vshCmd *cmd,
|
||||
bool vshCommandArgvParse(vshControl *ctl, int nargs, char **argv);
|
||||
int vshCommandOptTimeoutToMs(vshControl *ctl, const vshCmd *cmd, int *timeout);
|
||||
|
||||
void vshPrint(vshControl *ctl, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
void vshPrintExtra(vshControl *ctl, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(2, 3);
|
||||
bool vshInit(vshControl *ctl, const vshCmdGrp *groups, const vshCmdDef *set);
|
||||
@@ -308,9 +310,6 @@ void vshDeinit(vshControl *ctl);
|
||||
void vshDebug(vshControl *ctl, int level, const char *format, ...)
|
||||
ATTRIBUTE_FMT_PRINTF(3, 4);
|
||||
|
||||
/* XXX: add batch support */
|
||||
# define vshPrint(_ctl, ...) vshPrintExtra(NULL, __VA_ARGS__)
|
||||
|
||||
/* User visible sort, so we want locale-specific case comparison. */
|
||||
# define vshStrcasecmp(S1, S2) strcasecmp(S1, S2)
|
||||
int vshNameSorter(const void *a, const void *b);
|
||||
|
||||
Reference in New Issue
Block a user