[PATCH] Document STR(N)EQ_NULLABLE (was Re: [PATCH 2/2] xenParseXM: don't dereference NULL pointer when script is empty)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 06, 2011 at 11:56:29AM +0200, Michal Privoznik wrote:
> On 06.10.2011 11:16, Guido Günther wrote:
> > O.k. to apply?
> >  -- Guido
> > 
> > ---
> >  src/xenxs/xen_xm.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
> > index d057043..30188e2 100644
> > --- a/src/xenxs/xen_xm.c
> > +++ b/src/xenxs/xen_xm.c
> > @@ -697,8 +697,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
> >                  }
> >              }
> >  
> > -            if (bridge[0] || STREQ(script, "vif-bridge") ||
> > -                STREQ(script, "vif-vnic")) {
> > +            if (bridge[0] || (script && (STREQ(script, "vif-bridge") ||
> 
> I'd rather use STREQ_NULLABLE here.
...and here's the doc update.
 -- Guido
>From 07b8940e3bb64e2208b191d890e95f059a7ac7a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@xxxxxxxxxxx>
Date: Thu, 6 Oct 2011 13:32:49 +0200
Subject: [PATCH] Document STREQ_NULLABLE and STRNEQ_NULLABLE

---
 docs/hacking.html.in |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 1a32d07..89f9980 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -587,6 +587,12 @@
   STRPREFIX(a,b)
 </pre>
       </li>
+      <li><p>To avoid having to check if a or b are NULL:</p>
+<pre>
+  STREQ_NULLABLE(a, b)
+  STRNEQ_NULLABLE(a, b)
+</pre>
+      </li>
     </ul>
 
 
-- 
1.7.6.3

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]