summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-12-10 14:58:10 -0500
committerAndrew Opalach <andrew@akon.city> 2024-12-10 14:58:44 -0500
commitec924efb4168f906efe8978a6c083d63e550ae3f (patch)
tree30ed0042ca0afb1f96a591f5f30771181e79d607
parent27cbe448f08a783196e49aa58d9af57240a20d43 (diff)
downloadlibalabaster-ec924efb4168f906efe8978a6c083d63e550ae3f.tar.gz
libalabaster-ec924efb4168f906efe8978a6c083d63e550ae3f.tar.bz2
libalabaster-ec924efb4168f906efe8978a6c083d63e550ae3f.zip
all: clang-analyzer warnings
Signed-off-by: Andrew Opalach <andrew@akon.city>
-rw-r--r--src/array.c6
-rw-r--r--src/log.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/array.c b/src/array.c
index 40e5577..14db581 100644
--- a/src/array.c
+++ b/src/array.c
@@ -114,9 +114,13 @@ static inline u32 _al_array_reserve(void **ptr, u32 item_size, u32 prev_size, u3
size = (u32)((size + al_grow_limit) & ~al_grow_limit);
}
- if (size <= prev_size) return prev_size;
+ if (size <= prev_size) {
+ al_assert(prev_size > 0);
+ return prev_size;
+ }
*ptr = (!*ptr) ? AL_ARRAY_MALLOC(item_size * size) : AL_ARRAY_REALLOC(*ptr, item_size * size);
+ al_assert(*ptr);
return size;
}
diff --git a/src/log.c b/src/log.c
index 7bdba95..40cfd4b 100644
--- a/src/log.c
+++ b/src/log.c
@@ -38,7 +38,7 @@ static char *get_buffer(const char *level, const char *section, const char *fmt,
(void)section;
s32 prefix = al_snprintf(buffer, AL_LOG_MESSAGE_MAX, AL_LOG_TEMPLATE, name, line, func, level);
#endif
- prefix += al_vsnprintf(buffer + prefix, AL_LOG_MESSAGE_MAX - prefix, fmt, args);
+ al_vsnprintf(buffer + prefix, AL_LOG_MESSAGE_MAX - prefix, fmt, args);
buffer[strcspn(buffer, "\r\n")] = '\0';
return buffer;
}