From: "Jan Beulich" Subject: Re: [PATCH] xen/many: xfree() can tolerate NULL pointers Date: Mon, 19 Jan 2015 11:29:15 +0000 Message-ID: <54BCF89B020000780005665E@mail.emea.novell.com> References: <1421664139-9058-1-git-send-email-andrew.cooper3@citrix.com> <1421664847.10440.41.camel@citrix.com> <54BCE6B0.6090707@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54BCE6B0.6090707@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Keir Fraser , Tim Deegan , Ian Jackson , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 19.01.15 at 12:12, wrote: > On 19/01/15 10:54, Ian Campbell wrote: >> On Mon, 2015-01-19 at 10:42 +0000, Andrew Cooper wrote: >>> Replace instances of "if ( p ) xfree(p)" with just "xfree(p)" >>> >>> Signed-off-by: Andrew Cooper >>> CC: Keir Fraser >>> CC: Jan Beulich >>> CC: Tim Deegan >>> CC: Ian Campbell >>> CC: Ian Jackson >>> >>> --- >>> >>> This was from some experimentation with semantic patches. 'spatch' can't >>> currently parse some of our macros (e.g. XEN_GUEST_HANDLE()), which cases it >>> to skip large numbers of functions in the codebase >> How annoying! (and surprising) > > It also can't parse the "case $X ... $Y:" syntax if the spaces around > the ellipsis is missing. This is a little more understandable as this > gccism does introduce an ambiguity into the grammar, insofar that 1...3 > is not a valid floating point constant. > > We have a number of uses with #defined numbers uses without spaces. > This turns out to be safe only because the preprocessor replacement puts > spaces around replaced tokens. Spaces? That could end up being problematic (e.g. when subsequently making the resulting token sequence subject to a # operator). Afaik the preprocessor simply doesn't concatenate adjacent tokens after expansion, unless told so by the ## operator. Jan