[libvirt] [PATCH 01/17] graphics: use enums instead of int

Peter Krempa pkrempa at redhat.com
Fri May 6 08:17:23 UTC 2016


On Thu, May 05, 2016 at 18:20:20 +0200, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  src/conf/domain_conf.c  |  2 ++
>  src/conf/domain_conf.h  | 14 +++++++-------
>  src/libxl/libxl_conf.c  |  8 ++++++++
>  src/qemu/qemu_command.c | 14 +++++++++++++-
>  4 files changed, 30 insertions(+), 8 deletions(-)
> 

> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index b7b099c..b825477 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1552,7 +1552,7 @@ typedef enum {
>  typedef struct _virDomainGraphicsListenDef virDomainGraphicsListenDef;
>  typedef virDomainGraphicsListenDef *virDomainGraphicsListenDefPtr;
>  struct _virDomainGraphicsListenDef {
> -    int type;   /* enum virDomainGraphicsListenType */
> +    virDomainGraphicsListenType type;

Same as below. Assigned in virDomainGraphicsListenDefParseXML.

>      char *address;
>      char *network;
>      bool fromConfig;    /* true if the @address is config file originated */
> @@ -1564,7 +1564,7 @@ struct _virDomainGraphicsDef {
>       * Value 0 means port wasn't specified in XML at all.
>       * Positive value is actual port number given in XML.
>       */
> -    int type;
> +    virDomainGraphicsType type;

In virDomainGraphicsDefParseXML this struct member is directly assigned
without a temp variable so virDomainGraphicsTypeFromString won't be
able to return error as enum types are unsigned .


>      union {
>          struct {
>              int port;

ACK with a temp variable added.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160506/c03acc8b/attachment-0001.sig>


More information about the libvir-list mailing list