]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Tweak virStringMatchesNameSuffix()
authorAndrea Bolognani <abologna@redhat.com>
Thu, 7 Mar 2019 09:47:21 +0000 (10:47 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 7 Mar 2019 16:55:33 +0000 (17:55 +0100)
We can use STRNEQ() instead of STRNEQLEN() since we're only
interested in the trailing part of the string and we've
already verified that the length of file, name and suffix
are those we expect.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
src/util/virstring.c

index f669d59f589682bbd472ff7594c322cde0c4b0d3..33f8191f456f3493a835b56a770b70588648c3ff 100644 (file)
@@ -1290,7 +1290,7 @@ virStringMatchesNameSuffix(const char *file,
 
     if (filelen == (namelen + suffixlen) &&
         STREQLEN(file, name, namelen) &&
-        STREQLEN(file + namelen, suffix, suffixlen))
+        STREQ(file + namelen, suffix))
         return true;
     else
         return false;