[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2 of 3] xenpaging: Fix-up xenpaging tool code
On 28 July 2010 10:00, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> wrote: > Patrick Colp writes ("[Xen-devel] [PATCH 2 of 3] xenpaging: Fix-up xenpaging > tool code"): >> Â err: >> - Â Âif ( paging->bitmap ) >> - Â Â Â Âfree(paging->bitmap); >> - Â Âif ( paging->platform_info ) >> - Â Â Â Âfree(paging->platform_info); >> Â Â Âif ( paging ) >> + Â Â{ >> + Â Â Â Âif ( paging->bitmap ) >> + Â Â Â Â Â Âfree(paging->bitmap); > > While you're doing this, why not replace > >>-+ Â Â Â Âif ( paging->bitmap ) >>-+ Â Â Â Â Â Âfree(paging->bitmap); > with > >>++ Â Â Â Â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. Patrick _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |