Re: [libvirt PATCH v6 14/15] xen_common: Change xenParseVfbs to using virConfGetValueStringList

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/18/2018 02:48 PM, Fabiano Fidêncio wrote:
> Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
> ---
>  src/xenconfig/xen_common.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
> index 9ad081e56b..a6e77a9250 100644
> --- a/src/xenconfig/xen_common.c
> +++ b/src/xenconfig/xen_common.c
> @@ -605,8 +605,10 @@ xenParseCPUFeatures(virConfPtr conf,
>  static int
>  xenParseVfb(virConfPtr conf, virDomainDefPtr def)
>  {
> +    int ret = -1;
>      int val;
>      char *listenAddr = NULL;
> +    char **vfbs = NULL;
>      int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM;
>      virConfValuePtr list;
>      virDomainGraphicsDefPtr graphics = NULL;
> @@ -664,17 +666,14 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
>      }
>  
>      if (!hvm && def->graphics == NULL) { /* New PV guests use this format */
> -        list = virConfGetValue(conf, "vfb");
> -        if (list && list->type == VIR_CONF_LIST &&
> -            list->list && list->list->type == VIR_CONF_STRING &&
> -            list->list->str) {
> +        if (virConfGetValueStringList(conf, "vfb", false, &vfbs) == 1) {

There needs to be an else that will do some of the similar checking
described in the previous patch...

At the very least if return < 0, then virResetLastError... In fact now
that I see the same pattern, the code described in the last patch should
be a some common local/static function used by the 3 consumers to handle
the case where rc is not 1.

John

>              char vfb[MAX_VFB];
>              char *key = vfb;
>  
> -            if (virStrcpyStatic(vfb, list->list->str) < 0) {
> +            if (virStrcpyStatic(vfb, *vfbs) < 0) {
>                  virReportError(VIR_ERR_INTERNAL_ERROR,
>                                 _("VFB %s too big for destination"),
> -                               list->list->str);
> +                               *vfbs);
>                  goto cleanup;
>              }
>  
> @@ -747,12 +746,13 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
>          }
>      }
>  
> -    return 0;
> +    ret = 0;
>  
>   cleanup:
>      virDomainGraphicsDefFree(graphics);
>      VIR_FREE(listenAddr);
> -    return -1;
> +    virStringListFree(vfbs);
> +    return ret;
>  }
>  
>  
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux