Use of __foo naming is against C99. Besides, we had several different styles in use; this consolidates things to set up the typedefs up front then declare the types. * tools/virsh.h: Use consistent struct naming. * tools/virsh.c (_vshCommandParser): Likewise. --- tools/virsh.c | 9 +++++---- tools/virsh.h | 48 +++++++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 054047f..ecb27df 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1581,15 +1581,16 @@ typedef enum { VSH_TK_END /* No more commands */ } vshCommandToken; -typedef struct __vshCommandParser { - vshCommandToken(*getNextArg)(vshControl *, struct __vshCommandParser *, - char **); +typedef struct _vshCommandParser vshCommandParser; +struct _vshCommandParser { + vshCommandToken(*getNextArg)(vshControl *, vshCommandParser *, + char **); /* vshCommandStringGetArg() */ char *pos; /* vshCommandArgvGetArg() */ char **arg_pos; char **arg_end; -} vshCommandParser; +}; static bool vshCommandParse(vshControl *ctl, vshCommandParser *parser) diff --git a/tools/virsh.h b/tools/virsh.h index 7e505aa..69f37cc 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -140,9 +140,15 @@ enum { VSH_OFLAG_REQ_OPT = (1 << 2), /* --optionname required */ }; -/* dummy */ -typedef struct __vshControl vshControl; -typedef struct __vshCmd vshCmd; +/* forward declarations */ +typedef struct _vshCmd vshCmd; +typedef struct _vshCmdDef vshCmdDef; +typedef struct _vshCmdGrp vshCmdGrp; +typedef struct _vshCmdInfo vshCmdInfo; +typedef struct _vshCmdOpt vshCmdOpt; +typedef struct _vshCmdOptDef vshCmdOptDef; +typedef struct _vshControl vshControl; +typedef struct _vshCtrlData vshCtrlData; /* * vshCmdInfo -- name/value pair for information about command @@ -151,21 +157,21 @@ typedef struct __vshCmd vshCmd; * "name" - command name * "desc" - description of command, or empty string */ -typedef struct { +struct _vshCmdInfo { const char *name; /* name of information, or NULL for list end */ const char *data; /* non-NULL information */ -} vshCmdInfo; +}; /* * vshCmdOptDef - command option definition */ -typedef struct { +struct _vshCmdOptDef { const char *name; /* the name of option, or NULL for list end */ vshCmdOptType type; /* option type */ unsigned int flags; /* flags */ const char *help; /* non-NULL help string; or for VSH_OT_ALIAS * the name of a later public option */ -} vshCmdOptDef; +}; /* * vshCmdOpt - command options @@ -173,11 +179,11 @@ typedef struct { * After parsing a command, all arguments to the command have been * collected into a list of these objects. */ -typedef struct vshCmdOpt { +struct _vshCmdOpt { const vshCmdOptDef *def; /* non-NULL pointer to option definition */ char *data; /* allocated data, or NULL for bool option */ - struct vshCmdOpt *next; -} vshCmdOpt; + vshCmdOpt *next; +}; /* * Command Usage Flags @@ -190,27 +196,27 @@ enum { /* * vshCmdDef - command definition */ -typedef struct { +struct _vshCmdDef { const char *name; /* name of command, or NULL for list end */ bool (*handler) (vshControl *, const vshCmd *); /* command handler */ const vshCmdOptDef *opts; /* definition of command options */ const vshCmdInfo *info; /* details about command */ unsigned int flags; /* bitwise OR of VSH_CMD_FLAG */ -} vshCmdDef; +}; /* * vshCmd - parsed command */ -typedef struct __vshCmd { +struct _vshCmd { const vshCmdDef *def; /* command definition */ vshCmdOpt *opts; /* list of command arguments */ - struct __vshCmd *next; /* next command */ -} __vshCmd; + vshCmd *next; /* next command */ +}; /* * vshControl */ -typedef struct __vshControl { +struct _vshControl { char *name; /* connection name */ virConnectPtr conn; /* connection to hypervisor (MAY BE NULL) */ vshCmd *cmd; /* the current command */ @@ -237,13 +243,13 @@ typedef struct __vshControl { const char *escapeChar; /* String representation of console escape character */ -} __vshControl; +}; -typedef struct vshCmdGrp { +struct _vshCmdGrp { const char *name; /* name of group, or NULL for list end */ const char *keyword; /* help keyword */ const vshCmdDef *commands; -} vshCmdGrp; +}; void vshError(vshControl *ctl, const char *format, ...) ATTRIBUTE_FMT_PRINTF(2, 3); @@ -338,11 +344,11 @@ double prettyCapacity(unsigned long long val, const char **unit); * There are used by some long lingering commands like * migrate, dump, save, managedsave. */ -typedef struct __vshCtrlData { +struct _vshCtrlData { vshControl *ctl; const vshCmd *cmd; int writefd; -} vshCtrlData; +}; typedef void (*jobWatchTimeoutFunc) (vshControl *ctl, virDomainPtr dom, void *opaque); -- 1.7.11.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list