Re: [libvirt PATCH 07/14] virInterfaceDefParseXML: Inline trivial virInterfaceDefParseName

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

 



On 1/12/22 14:10, Tim Wiederhake wrote:
> Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
> ---
>  src/conf/interface_conf.c | 23 ++++-------------------
>  1 file changed, 4 insertions(+), 19 deletions(-)
> 
> diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
> index 47f9da797d..f3fc47bd69 100644
> --- a/src/conf/interface_conf.c
> +++ b/src/conf/interface_conf.c
> @@ -116,23 +116,6 @@ virInterfaceDefFree(virInterfaceDef *def)
>  }
>  
>  
> -static int
> -virInterfaceDefParseName(virInterfaceDef *def,
> -                         xmlXPathContextPtr ctxt)
> -{
> -    char *tmp;
> -
> -    tmp = virXPathString("string(./@name)", ctxt);
> -    if (tmp == NULL) {
> -        virReportError(VIR_ERR_XML_ERROR,
> -                       "%s",  _("interface has no name"));
> -        return -1;
> -    }
> -    def->name = tmp;
> -    return 0;
> -}
> -
> -
>  static int
>  virInterfaceDefParseMtu(virInterfaceDef *def,
>                          xmlXPathContextPtr ctxt)
> @@ -662,8 +645,10 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt,
>      }
>      def->type = type;
>  
> -    if (virInterfaceDefParseName(def, ctxt) < 0)
> -       return NULL;
> +    if ((def->name = virXMLPropString(ctxt->node, "name")) == NULL) {

At your discretion (here and in the rest of patches):

  if (!(def->name = ...))) {

> +        virReportError(VIR_ERR_XML_ERROR, "%s",  _("interface has no name"));
> +        return NULL;
> +    }
>  
>      if (parentIfType == VIR_INTERFACE_TYPE_LAST) {
>          /* only recognize these in toplevel bond interfaces */

Michal




[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