|
18 | 18 | #include <stdint.h>
|
19 | 19 | #include <stdbool.h>
|
20 | 20 | #include <stdio.h>
|
21 |
| -#include <stdlib.h> |
| 21 | +#include <stddef.h> |
22 | 22 |
|
23 | 23 | #include "zone/attributes.h"
|
24 | 24 | #include "zone/export.h"
|
@@ -444,57 +444,44 @@ zone_format_printf(3,4);
|
444 | 444 | /**
|
445 | 445 | * @brief Write error message to active log handler.
|
446 | 446 | *
|
447 |
| - * @param[in] parser Zone parser |
448 |
| - * @param[in] priority Log priority |
449 |
| - * @param[in] format Format string compatible with printf |
450 |
| - * @param[in] arguments Argument list |
| 447 | + * Shorthand to write out error message via @zone_log if error messages are |
| 448 | + * not to be discarded. |
| 449 | + * |
| 450 | + * @param[in] parser Zone parser |
| 451 | + * @param[in] format Format string |
| 452 | + * @param[in] ... Variadic arguments corresponding to #format |
451 | 453 | */
|
452 |
| -ZONE_EXPORT void zone_vlog( |
453 |
| - zone_parser_t *parser, |
454 |
| - uint32_t priority, |
455 |
| - const char *format, |
456 |
| - va_list arguments) |
457 |
| -zone_nonnull((1,3)); |
| 454 | +#define zone_error(parser, ...) \ |
| 455 | + (((parser)->options.log.mask & ZONE_ERROR) ? \ |
| 456 | + (void)0 : zone_log((parser), ZONE_ERROR, __VA_ARGS__)) |
458 | 457 |
|
459 |
| -ZONE_EXPORT inline void |
460 |
| -zone_nonnull((1,2)) |
461 |
| -zone_format_printf(2,3) |
462 |
| -zone_error(zone_parser_t *parser, const char *format, ...) |
463 |
| -{ |
464 |
| - va_list arguments; |
465 |
| - if (!(ZONE_ERROR & ~parser->options.log.mask)) |
466 |
| - return; |
467 |
| - va_start(arguments, format); |
468 |
| - zone_vlog(parser, ZONE_ERROR, format, arguments); |
469 |
| - va_end(arguments); |
470 |
| -} |
471 |
| - |
472 |
| -ZONE_EXPORT inline void |
473 |
| -zone_nonnull((1,2)) |
474 |
| -zone_format_printf(2,3) |
475 |
| -zone_warning(zone_parser_t *parser, const char *format, ...) |
476 |
| -{ |
477 |
| - va_list arguments; |
478 |
| - if (!(ZONE_WARNING & ~parser->options.log.mask)) |
479 |
| - return; |
480 |
| - va_start(arguments, format); |
481 |
| - zone_vlog(parser, ZONE_WARNING, format, arguments); |
482 |
| - va_end(arguments); |
483 |
| -} |
484 |
| - |
485 |
| -ZONE_EXPORT inline void |
486 |
| -zone_nonnull((1,2)) |
487 |
| -zone_format_printf(2,3) |
488 |
| -zone_info(zone_parser_t *parser, const char *format, ...) |
489 |
| -{ |
490 |
| - va_list arguments; |
491 |
| - if (!(ZONE_INFO & ~parser->options.log.mask)) |
492 |
| - return; |
493 |
| - va_start(arguments, format); |
494 |
| - zone_vlog(parser, ZONE_INFO, format, arguments); |
495 |
| - va_end(arguments); |
496 |
| -} |
| 458 | +/** |
| 459 | + * @brief Write warning message to active log handler. |
| 460 | + * |
| 461 | + * Shorthand to write out warning message via @zone_log if warning messages |
| 462 | + * are not to be discarded. |
| 463 | + * |
| 464 | + * @param[in] parser Zone parser |
| 465 | + * @param[in] format Format string compatible with printf. |
| 466 | + * @param[in] ... Variadic arguments corresponding to @format. |
| 467 | + */ |
| 468 | +#define zone_warning(parser, ...) \ |
| 469 | + (((parser)->options.mask & ZONE_WARNING) ? \ |
| 470 | + (void)0 : zone_log((parser), ZONE_WARNING, __VA_ARGS__)) |
497 | 471 |
|
| 472 | +/** |
| 473 | + * @brief Write informational message to active log handler. |
| 474 | + * |
| 475 | + * Shorthand to write out informational message via @zone_log if |
| 476 | + * informational messages are not be discarded. |
| 477 | + * |
| 478 | + * @param[in] parser Zone parser. |
| 479 | + * @param[in] format Format string compatible with printf. |
| 480 | + * @param[in] ... Variadic arguments corresponding to @format. |
| 481 | + */ |
| 482 | +#define zone_info(parser, ...) \ |
| 483 | + (((parser)->options.mask & ZONE_INFO) ? \ |
| 484 | + (void)0 : zone_log((parser), ZONE_INFO, __VA_ARGS__)) |
498 | 485 |
|
499 | 486 | #if defined(__cplusplus)
|
500 | 487 | }
|
|
0 commit comments