From de7cc8d65245d8ac01ae6f2d1f3ce5bd0f3a04f4 Mon Sep 17 00:00:00 2001 From: Pb Date: Thu, 9 Jan 2020 00:35:18 +0100 Subject: [PATCH] Pass module as %s arg instead of concatenation --- Changelog.md | 1 + Lilu/Headers/kern_util.hpp | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Changelog.md b/Changelog.md index 00639f1a..b4e8c085 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ Lilu Changelog - Made applyLookupPatch support kernel patches by passsing null kext - Export hde64 interface - Added evector deleter without copying for improved performance +- Allow C strings as module prefix argument to the logging functions #### v1.4.0 - Fixed mishandling user patches process list after processKernel API call diff --git a/Lilu/Headers/kern_util.hpp b/Lilu/Headers/kern_util.hpp index e5c7a680..4ba34e95 100644 --- a/Lilu/Headers/kern_util.hpp +++ b/Lilu/Headers/kern_util.hpp @@ -73,10 +73,10 @@ extern proc_t kernproc; * @param cond precondition * @param str printf-like string */ -#define SYSLOG_COND(cond, module, str, ...) \ - do { \ - if (cond) \ - lilu_os_log( "%s%10s" str "\n", xStringify(PRODUCT_NAME) ": ", module " @ ", ## __VA_ARGS__); \ +#define SYSLOG_COND(cond, module, str, ...) \ + do { \ + if (cond) \ + lilu_os_log( "%s%10s: @ " str "\n", xStringify(PRODUCT_NAME), safeString(module), ## __VA_ARGS__); \ } while (0) /** @@ -94,12 +94,12 @@ extern proc_t kernproc; * @param module log module * @param str printf-like string */ -#define SYSTRACE_COND(cond, module, str, ...) \ - do { \ - if (cond) { \ - SYSLOG(module, str, ## __VA_ARGS__); \ - OSReportWithBacktrace( "%s%10s" str "\n", xStringify(PRODUCT_NAME) ": ", module " @ ", ## __VA_ARGS__); \ - } \ +#define SYSTRACE_COND(cond, module, str, ...) \ + do { \ + if (cond) { \ + SYSLOG(module, str, ## __VA_ARGS__); \ + OSReportWithBacktrace( "%s%10s: @ " str "\n", xStringify(PRODUCT_NAME), safeString(module), ## __VA_ARGS__); \ + } \ } while (0) /** @@ -117,12 +117,12 @@ extern proc_t kernproc; * @param module log module * @param str printf-like string */ -#define PANIC_COND(cond, module, str, ...) \ - do { \ - if (cond) { \ - (panic)( "%s%10s" str "\n", xStringify(PRODUCT_NAME) ": ", module " @ ", ## __VA_ARGS__); \ - UNREACHABLE(); \ - } \ +#define PANIC_COND(cond, module, str, ...) \ + do { \ + if (cond) { \ + (panic)( "%s%10s: @ " str "\n", xStringify(PRODUCT_NAME), safeString(module), ## __VA_ARGS__); \ + UNREACHABLE(); \ + } \ } while (0) /**