From: Mike Frysinger Date: Wed, 28 Jan 2009 16:47:53 -0500 Subject: [U-Boot] [PATCH] include/image.h: Use explicit function definitions instead of macro trickery In-Reply-To: <20090128212013.86C72832E416@gemini.denx.de> References: <1233125286-29550-1-git-send-email-petri.lehtinen@inoi.fi> <20090128212013.86C72832E416@gemini.denx.de> Message-ID: <200901281647.54413.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday 28 January 2009 16:20:13 Wolfgang Denk wrote: > Petri Lehtinen wrote: > > I got frustrated while grepping through the sources, trying to find > > the definitions of these functions. Thinking back, the obvious place > > to look in the first place would of course have been include/image.h, > > but it didn't even cross my mind that there could be some macro > > trickery behind these functions. > > > > Anyway, I think that explicit is better than implicit and that this > > kind of macro usage is ugly. > > I am not really sure, but I tend to leave the code as it was. > > > -#define image_get_hdr_l(f) \ > > - static inline uint32_t image_get_##f(image_header_t *hdr) \ > > - { \ > > - return uimage_to_cpu (hdr->ih_##f); \ > > - } > > -image_get_hdr_l (magic); > > -image_get_hdr_l (hcrc); > > -image_get_hdr_l (time); > > -image_get_hdr_l (size); > > -image_get_hdr_l (load); > > -image_get_hdr_l (ep); > > -image_get_hdr_l (dcrc); > > The macro here has the advantages of being compact, and that you need > to change one location only to get a consistent set of function > declarations. agree completely. Petri: if you're worried about grepping, then perhaps you'd post a patch like so: -image_get_hdr_l (dcrc); +image_get_hdr_l (dcrc); /* image_get_dcrc() */ -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20090128/919c7321/attachment.pgp