[1/3] msxml3: libxml2 error/warning callback functions

Alexandre Julliard julliard at winehq.org
Fri Oct 22 07:25:15 CDT 2010


Adam Martinson <amartinson at codeweavers.com> writes:

> +#define LIBXML2_OUTPUT_CALLBACK void __WINE_PRINTF_ATTR(2,3)
> +#define LIBXML2_OUTPUT_CALLBACK_BODY(caller, dbcl, msg) \
> +    do { \
> +        va_list ap; \
> +        char* buf; \
> +        int len; \
> +        va_start(ap, msg); \
> +        len = vsnprintf(NULL, 0, msg, ap); \
> +        buf = heap_alloc(len+1); \
> +        vsnprintf(buf, len+1, msg, ap); \
> +        va_end(ap); \
> +        wine_dbg_log(__WINE_DBCL##dbcl, __wine_dbch___default, #caller, buf); \
> +        heap_free(buf); \
> +    } while (0)
> +
> +#define LIBXML2_XMLERROR_CALLBACK void
> +#define LIBXML2_XMLERROR_CALLBACK_BODY(caller, err) \
> +    do { \
> +        enum __wine_debug_class dbcl = __WINE_DBCL_ERR; \
> +        switch (err->level) \
> +        { \
> +            case XML_ERR_NONE: \
> +                dbcl = __WINE_DBCL_TRACE; \
> +                break; \
> +            case XML_ERR_WARNING: \
> +                dbcl = __WINE_DBCL_WARN; \
> +                break; \
> +            default: \
> +                break; \
> +        } \
> +        wine_dbg_log(dbcl, __wine_dbch___default, #caller, err->message); \
> +    } while (0)

That's ugly, please write the code explicitly instead of using macros,
it's not that much code.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list