From d75131569cb74faa2a75eb94b1a81e8c0fe7bb7f Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Thu, 25 Jun 2020 16:33:19 -0400 Subject: puzzles: clean up error messages Expands buffer size, and prints to LOGF. Change-Id: I6dbcf60152d69c928270023c550976b802269d95 --- apps/plugins/puzzles/rbassert.h | 2 +- apps/plugins/puzzles/rockbox.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'apps/plugins/puzzles') diff --git a/apps/plugins/puzzles/rbassert.h b/apps/plugins/puzzles/rbassert.h index f3fef84351..56142d633b 100644 --- a/apps/plugins/puzzles/rbassert.h +++ b/apps/plugins/puzzles/rbassert.h @@ -8,6 +8,6 @@ #define assert(p) ((void)0) #else -#define assert(e) ((e) ? (void)0 : fatal("assertion failed %s:%d", __FILE__, __LINE__)) +#define assert(e) ((e) ? (void)0 : fatal("assertion failed on %s line %d: " #e, __FILE__, __LINE__)) #endif /* NDEBUG */ diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index ac6388bf4d..1aee42d080 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c @@ -1448,15 +1448,17 @@ const drawing_api rb_drawing = { void fatal(const char *fmt, ...) { va_list ap; + char buf[256]; rb->splash(HZ, "FATAL"); va_start(ap, fmt); - char buf[80]; - rb->vsnprintf(buf, 80, fmt, ap); - rb->splash(HZ * 2, buf); + rb->vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); + LOGF("%s", buf); + rb->splash(HZ * 2, buf); + if(rb->thread_self() == thread) rb->thread_exit(); else -- cgit v1.2.3