[libvirt] [PATCH v1 1/3] virConfSetValue: Simplify condition

Martin Kletzander mkletzan at redhat.com
Wed Dec 10 07:15:14 UTC 2014


On Tue, Dec 09, 2014 at 04:52:14PM +0100, Michal Privoznik wrote:
>There's no need for condition of the following form:
>
>  if (str && STREQ(str, dst))
>
>since we have STREQ_NULLABLE macro that handles NULL cases.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/util/virconf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

ACK

>diff --git a/src/util/virconf.c b/src/util/virconf.c
>index 0a17eff..74e695a 100644
>--- a/src/util/virconf.c
>+++ b/src/util/virconf.c
>@@ -884,7 +884,7 @@ virConfSetValue(virConfPtr conf,
>
>     cur = conf->entries;
>     while (cur != NULL) {
>-        if ((cur->name != NULL) && (STREQ(cur->name, setting)))
>+        if (STREQ_NULLABLE(cur->name, setting))
>             break;
>         prev = cur;
>         cur = cur->next;
>--
>2.0.4
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141210/2e253968/attachment-0001.sig>


More information about the libvir-list mailing list