[libvirt] [PATCH 4/7] util: Tweak virStringHasSuffix()
Peter Krempa
pkrempa at redhat.com
Thu Mar 7 11:36:19 UTC 2019
On Thu, Mar 07, 2019 at 11:14:43 +0100, Andrea Bolognani wrote:
> Make it more similar to virStringStripSuffix(), which also
> results in types being more correct since STRNEQ() returns
> int rather than bool.
# define STREQ(a, b) (strcmp(a, b) == 0)
# define STRNEQ(a, b) (strcmp(a, b) != 0)
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
> src/util/virstring.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/util/virstring.c b/src/util/virstring.c
> index f669d59f58..a938669b63 100644
> --- a/src/util/virstring.c
> +++ b/src/util/virstring.c
> @@ -1245,7 +1245,10 @@ virStringHasSuffix(const char *str,
> if (len < suffixlen)
> return false;
>
> - return STREQ(str + len - suffixlen, suffix);
> + if (STRNEQ(str + len - suffixlen, suffix))
> + return false;
> +
> + return true;
NACK
-------------- 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/09f1f048/attachment-0001.sig>
More information about the libvir-list
mailing list