From fcf6f769499412ed948583cb52ee3336355c51d5 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Tue, 31 Jan 2023 23:41:09 +0000 Subject: [PATCH] logging compataibility with emacs --- source/engine/debug/log.c | 6 +++--- source/engine/ffi.c | 2 -- source/engine/sound/mix.c | 7 +++---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/source/engine/debug/log.c b/source/engine/debug/log.c index 92ad4e5..6cd3bf6 100644 --- a/source/engine/debug/log.c +++ b/source/engine/debug/log.c @@ -11,8 +11,8 @@ #define logLevel 0 //char *logstr[] = { "INFO", "WARN", "\x1b[1;31mERROR\x1b[0m", "CRITICAL" }; -char *logstr[] = { "INFO", "WARN", "ERROR", "CRITICAL" }; -char *catstr[] = {"ENGINE", "SCRIPT"}; +char *logstr[] = { "info", "warn", "error", "critical" }; +char *catstr[] = {"engine", "script"}; FILE *logfile = NULL; @@ -34,7 +34,7 @@ void mYughLog(int category, int priority, int line, const char *file, const char va_end(args); char buffer[ERROR_BUFFER] = { '\0' }; - snprintf(buffer, ERROR_BUFFER, "%s | %s | %s [ %s:%d ] %s\n", logstr[priority], catstr[category], dt, file, line, msgbuffer); + snprintf(buffer, ERROR_BUFFER, "%s:%d: %s, %s | %s\n", file, line, logstr[priority], catstr[category], msgbuffer); fprintf(stderr, "%s", buffer); fflush(stderr); diff --git a/source/engine/ffi.c b/source/engine/ffi.c index c283f7f..290a576 100644 --- a/source/engine/ffi.c +++ b/source/engine/ffi.c @@ -175,10 +175,8 @@ duk_ret_t duk_spline_cmd(duk_context *duk) duk_put_prop_index(duk, arridx, i); } - free(samples); ts_bspline_free(&spline); - return 1; } diff --git a/source/engine/sound/mix.c b/source/engine/sound/mix.c index c2f2ed8..a1c23ba 100644 --- a/source/engine/sound/mix.c +++ b/source/engine/sound/mix.c @@ -10,7 +10,7 @@ static struct bus bus[256]; static int first = 0; /* First bus available */ -//static struct bus *first_on = NULL; + static int first_on = -1; /* First bus to fill buffer with */ short mastermix[BUF_FRAMES*CHANNELS]; @@ -37,9 +37,9 @@ void mixer_init() { } struct bus *first_free_bus(struct dsp_filter in) { - if (!initted) return; + if (!initted) return NULL; assert(initted); - + if (first == -1) return NULL; int ret = first; first = bus[ret].next; @@ -80,5 +80,4 @@ void bus_fill_buffers(short *master, int n) { curbus = nextbus; } - }