From 0c675b12e46d6036aea8c576c7980a2611354be4 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 16 Sep 2023 01:20:34 -0700 Subject: [PATCH] Scripting: Simplify console implementation --- src/core/scripting.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/scripting.c b/src/core/scripting.c index d5aee8be7..0dcb78d2b 100644 --- a/src/core/scripting.c +++ b/src/core/scripting.c @@ -1247,33 +1247,33 @@ static struct mScriptTextBuffer* _mScriptConsoleCreateBuffer(struct mScriptConso return buffer; } -static void mScriptConsoleLog(struct mScriptConsole* console, struct mScriptString* msg) { +static void mScriptConsoleLog(struct mScriptConsole* console, const char* msg) { if (console->logger) { - mLogExplicit(console->logger, _mLOG_CAT_SCRIPT, mLOG_INFO, "%s", msg->buffer); + mLogExplicit(console->logger, _mLOG_CAT_SCRIPT, mLOG_INFO, "%s", msg); } else { - mLog(_mLOG_CAT_SCRIPT, mLOG_INFO, "%s", msg->buffer); + mLog(_mLOG_CAT_SCRIPT, mLOG_INFO, "%s", msg); } } -static void mScriptConsoleWarn(struct mScriptConsole* console, struct mScriptString* msg) { +static void mScriptConsoleWarn(struct mScriptConsole* console, const char* msg) { if (console->logger) { - mLogExplicit(console->logger, _mLOG_CAT_SCRIPT, mLOG_WARN, "%s", msg->buffer); + mLogExplicit(console->logger, _mLOG_CAT_SCRIPT, mLOG_WARN, "%s", msg); } else { - mLog(_mLOG_CAT_SCRIPT, mLOG_WARN, "%s", msg->buffer); + mLog(_mLOG_CAT_SCRIPT, mLOG_WARN, "%s", msg); } } -static void mScriptConsoleError(struct mScriptConsole* console, struct mScriptString* msg) { +static void mScriptConsoleError(struct mScriptConsole* console, const char* msg) { if (console->logger) { - mLogExplicit(console->logger, _mLOG_CAT_SCRIPT, mLOG_ERROR, "%s", msg->buffer); + mLogExplicit(console->logger, _mLOG_CAT_SCRIPT, mLOG_ERROR, "%s", msg); } else { - mLog(_mLOG_CAT_SCRIPT, mLOG_ERROR, "%s", msg->buffer); + mLog(_mLOG_CAT_SCRIPT, mLOG_ERROR, "%s", msg); } } -mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptConsole, log, mScriptConsoleLog, 1, STR, msg); -mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptConsole, warn, mScriptConsoleWarn, 1, STR, msg); -mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptConsole, error, mScriptConsoleError, 1, STR, msg); +mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptConsole, log, mScriptConsoleLog, 1, CHARP, msg); +mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptConsole, warn, mScriptConsoleWarn, 1, CHARP, msg); +mSCRIPT_DECLARE_STRUCT_VOID_METHOD(mScriptConsole, error, mScriptConsoleError, 1, CHARP, msg); mSCRIPT_DECLARE_STRUCT_METHOD_WITH_DEFAULTS(mScriptConsole, S(mScriptTextBuffer), createBuffer, _mScriptConsoleCreateBuffer, 1, CHARP, name); mSCRIPT_DEFINE_STRUCT(mScriptConsole)