[U-Boot] [PATCH] include/image.h: Use explicit function definitions instead of macro trickery
Mike Frysinger
vapier at gentoo.org
Wed Jan 28 22:47:53 CET 2009
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
More information about the U-Boot
mailing list