From 881fad86fa4942571c74cdfa89831a2cd25dbe16 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 4 Oct 2017 15:59:32 +0200 Subject: evaluate: Fix debug output When introducing output_fp, debug output in src/evaluate.c was not adjusted and therefore broke. This patch restores eval debug output by applying the following changes: - Change erec_print() and erec_print_list() to take a struct output_ctx pointer as first argument and use output_fp field as destination to print to. - Drop octx_debug_dummy variable and instead use octx pointer from struct eval_ctx for debug output. - Add missing calls to erec_destroy() in eval debug output which should eliminate another mem leak. Fixes: 2535ba7006f22 ("src: get rid of printf") Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/erec.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/erec.h') diff --git a/include/erec.h b/include/erec.h index 223cb12d..79a16290 100644 --- a/include/erec.h +++ b/include/erec.h @@ -46,6 +46,7 @@ extern struct error_record *erec_create(enum error_record_types type, const char *fmt, ...) __gmp_fmtstring(3, 4); extern void erec_add_location(struct error_record *erec, const struct location *loc); +extern void erec_destroy(struct error_record *erec); #define error(loc, fmt, args...) \ erec_create(EREC_ERROR, (loc), (fmt), ## args) @@ -58,9 +59,9 @@ static inline void erec_queue(struct error_record *erec, list_add_tail(&erec->list, queue); } -extern void erec_print(FILE *f, const struct error_record *erec, +extern void erec_print(struct output_ctx *octx, const struct error_record *erec, unsigned int debug_mask); -extern void erec_print_list(FILE *f, struct list_head *list, +extern void erec_print_list(struct output_ctx *octx, struct list_head *list, unsigned int debug_mask); struct eval_ctx; -- cgit v1.2.3