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

2019-03-07 Thread Peter Krempa
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 
> ---
>  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.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

2019-03-07 Thread Andrea Bolognani
We can use STRNEQ() instead of STRNEQLEN() since we're only
interested in the trailing part of the string.

Signed-off-by: Andrea Bolognani 
---
 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;
 
 return true;
-- 
2.20.1

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