
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