core: use std::string in error_callback

No naked free().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-08 23:32:17 +02:00 committed by bstoeger
parent 71f3189a31
commit d05e289507
8 changed files with 40 additions and 74 deletions

View file

@ -4,6 +4,8 @@
// error reporting functions
#include <string>
#ifdef __GNUC__
#define __printf(x, y) __attribute__((__format__(__printf__, x, y)))
#else
@ -13,6 +15,6 @@
extern int verbose;
extern int __printf(1, 2) report_error(const char *fmt, ...);
extern void __printf(1, 2) report_info(const char *fmt, ...);
extern void set_error_cb(void(*cb)(char *)); // Callback takes ownership of passed string
extern void set_error_cb(void(*cb)(std::string s)); // Callback takes ownership of passed string
#endif