On 05/17/2014 05:03 PM, Marc Marí wrote: > Create this macro to let debug macros to have the same format through the > codebase and use regular ifs instead of ifdef. > > Signed-off-by: Marc Marí <marc.mari.barc...@gmail.com> > --- > include/qemu-common.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/include/qemu-common.h b/include/qemu-common.h > index 3f3fd60..acdcf08 100644 > --- a/include/qemu-common.h > +++ b/include/qemu-common.h > @@ -463,3 +463,10 @@ int parse_debug_env(const char *name, int max, int > initial); > const char *qemu_ether_ntoa(const MACAddr *mac); > > #endif > + > +#define QEMU_DPRINTF(cond,pfx,fmt,...) \
Style: space after comma: #define QEMU_DPRINTF(cond, pfx, fmt, ...) \ > + do { \ Up to you if you want to align \ rather than putting them flush to each line (I don't know if there is a prevalent style in the codebase). > + if (cond) { \ > + fprintf(stderr, pfx": %s:"fmt, __func__, ## __VA_ARGS__); \ Style: spaces between string concatenation: pfx ": %s:" fmt This definition requires that pfx and fmt be constant strings to allow string concatenation. Might it be better to allow for non-constants, by splitting it into two actions, as in: fprintf(stderr, "%s: %s:", pfx, __func__); fprintf(stderr, fmt, ## __VA_ARGS__); -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature