[libvirt] [PATCH 7/7] util: Tweak virStringMatchesNameSuffix() some more

Peter Krempa pkrempa at redhat.com
Thu Mar 7 16:40:16 UTC 2019


On Thu, Mar 07, 2019 at 11:14:46 +0100, Andrea Bolognani wrote:
> We can use STRNEQ() instead of STRNEQLEN() since we're only
> interested in the trailing part of the string.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  src/util/virstring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virstring.c b/src/util/virstring.c
> index ba36562f85..f23daca0bd 100644
> --- a/src/util/virstring.c
> +++ b/src/util/virstring.c
> @@ -1300,7 +1300,7 @@ virStringMatchesNameSuffix(const char *file,
>      if (STRNEQLEN(file, name, namelen))
>          return false;
>  
> -    if (STRNEQLEN(file + namelen, suffix, suffixlen))
> +    if (STRNEQ(file + namelen, suffix))
>          return false;

ACK to this if you rebase it without the previous patches. The change is
okay as we verify that filelen == (namelen + suffixlen) prior to
attempting this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190307/b16f3a2b/attachment-0001.sig>


More information about the libvir-list mailing list