summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/log.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/log.c b/src/log.c
index 3466320..c64ca11 100644
--- a/src/log.c
+++ b/src/log.c
@@ -8,13 +8,13 @@
#define AL_LOG_TEMPLATE "%s:%d %s(): %s -> "
#endif
-#define AL_LOG_MESSAGE_SIZE 511
+#define AL_LOG_MESSAGE_MAX 511
#if !AL_LOG_SKIP
static s32 al_print_default(void *userdata, char *s)
{
(void)userdata;
- s32 ret = al_printf("%*.*s\n", 0, AL_LOG_MESSAGE_SIZE, s);
+ s32 ret = al_printf("%*.*s\n", 0, AL_LOG_MESSAGE_MAX, s);
al_free(s);
return ret;
}
@@ -30,14 +30,14 @@ void al_set_print(s32 (*print_func)(void *, char *), void *userdata)
static char *get_buffer(const char *level, const char *section, const char *fmt, const char *name, const s32 line, const char *func, va_list args)
{
- char *buffer = al_calloc(1, AL_LOG_MESSAGE_SIZE + 1);
+ char *buffer = al_malloc(AL_LOG_MESSAGE_MAX + 1);
#if AL_LOG_USE_SECTION
- s32 prefix = snprintf(buffer, AL_LOG_MESSAGE_SIZE, AL_LOG_TEMPLATE, name, line, func, level, section);
+ s32 prefix = al_snprintf(buffer, AL_LOG_MESSAGE_MAX, AL_LOG_TEMPLATE, name, line, func, level, section);
#else
(void)section;
- s32 prefix = snprintf(buffer, AL_LOG_MESSAGE_SIZE, AL_LOG_TEMPLATE, name, line, func, level);
+ s32 prefix = al_snprintf(buffer, AL_LOG_MESSAGE_MAX, AL_LOG_TEMPLATE, name, line, func, level);
#endif
- prefix += vsnprintf(buffer + prefix, AL_LOG_MESSAGE_SIZE - prefix, fmt, args);
+ prefix += al_vsnprintf(buffer + prefix, AL_LOG_MESSAGE_MAX - prefix, fmt, args);
buffer[strcspn(buffer, "\r\n")] = '\0';
return buffer;
}