From: Keir Fraser <keir.fraser@eu.citrix.com>
To: Patrick Colp <pjcolp@cs.ubc.ca>, Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code
Date: Wed, 28 Jul 2010 16:06:45 +0100 [thread overview]
Message-ID: <C8760615.1BE8D%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <AANLkTimhFnLgX4X8r3t7fdREZ6xvetPjhZCkWGv2O3d2@mail.gmail.com>
On 28/07/2010 15:57, "Patrick Colp" <pjcolp@cs.ubc.ca> wrote:
>>> ++ free(paging->bitmap);
>>
>> since free(0) is legal and a no-op ?
>
> Could do, but free(0) isn't exactly a no-op. free() does a check to
> see if the pointer passed was 0. So it doesn't really make much
> difference if I do the check or let it do the check. I can easily
> change the code to just do free(paging->bitmap) though, if that's the
> preferred way to do it. Actually, I would argue my way is better since
> in the case of a NULL pointer, the free function isn't called at all,
> which saves a bunch of cycles.
Avoiding the if is better. Everyone knows free(0) is legal, so it's
idiomatic to unconditionally call free().
-- Keir
next prev parent reply other threads:[~2010-07-28 15:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 21:21 [PATCH 0 of 3] xenpaging: Check that EPT is enabled for target guest Patrick Colp
2010-07-27 21:21 ` [PATCH 1 of 3] xenpaging: Add a check to Xen for EPT Patrick Colp
2010-07-28 13:58 ` Ian Jackson
2010-07-28 13:59 ` Ian Jackson
2010-07-28 14:35 ` Patrick Colp
2010-07-28 15:19 ` Ian Jackson
2010-07-27 21:21 ` [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code Patrick Colp
2010-07-28 14:00 ` Ian Jackson
2010-07-28 14:57 ` Patrick Colp
2010-07-28 15:01 ` Gianni Tedesco
2010-07-28 15:28 ` Patrick Colp
2010-07-28 16:27 ` Patrick Colp
2010-07-28 15:06 ` Keir Fraser [this message]
2010-07-27 21:21 ` [PATCH 3 of 3] xenpaging: Add check to xenpaging tool for EPT error from Xen Patrick Colp
2010-09-15 8:37 ` Jiang, Yunhong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C8760615.1BE8D%keir.fraser@eu.citrix.com \
--to=keir.fraser@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=pjcolp@cs.ubc.ca \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).