[libvirt] [PATCH] internal: Use g_strcmp0 in STR(N)EQ_NULLABLE

Pavel Hrdina phrdina at redhat.com
Thu Oct 24 14:22:09 UTC 2019


On Thu, Oct 24, 2019 at 04:12:00PM +0200, Peter Krempa wrote:
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  src/internal.h | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/internal.h b/src/internal.h
> index 5b0a2335f5..0ff9f496ac 100644
> --- a/src/internal.h
> +++ b/src/internal.h
> @@ -86,10 +86,8 @@
>  #define STRCASEPREFIX(a, b) (c_strncasecmp(a, b, strlen(b)) == 0)
>  #define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL)
> 
> -#define STREQ_NULLABLE(a, b) \
> -    ((a) ? (b) && STREQ((a), (b)) : !(b))
> -#define STRNEQ_NULLABLE(a, b) \
> -    ((a) ? !(b) || STRNEQ((a), (b)) : !!(b))
> +#define STREQ_NULLABLE(a, b) (g_strcmp0(a, b) == 0)
> +#define STRNEQ_NULLABLE(a, b) (g_strcmp0(a, b) != 0)

Why not use g_strcmp0 directly?

Pavel
-------------- 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/20191024/ffc1d884/attachment-0001.sig>


More information about the libvir-list mailing list