From 0470ca3416388e7e58b64f63bfe505d454f150b9 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Mon, 23 Jun 2025 14:41:38 -0400 Subject: all: *_free() check consistency, C++ compat Signed-off-by: Andrew Opalach --- include/al/array_typed.h | 2 +- include/al/str.h | 2 +- include/al/wstr.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include/al') diff --git a/include/al/array_typed.h b/include/al/array_typed.h index e4a6c53..73e77f7 100644 --- a/include/al/array_typed.h +++ b/include/al/array_typed.h @@ -88,7 +88,7 @@ } \ static inline void al_array_free(N, __VA_ARGS__)(array(N, __VA_ARGS__) *array) \ { \ - if (array->data != NULL) al_free(array->data); \ + if (array->data) al_free(array->data); \ } #define AL_ARRAY_DEFINE(N, T) \ diff --git a/include/al/str.h b/include/al/str.h index 93b4f4a..ac5dba8 100644 --- a/include/al/str.h +++ b/include/al/str.h @@ -34,7 +34,7 @@ static inline bool al_str_is_empty(str *s) static inline void al_str_free(str *s) { - if (s->alloc > 0) al_free(s->data); + if (s->alloc) al_free(s->data); } static inline u32 al_str_reserve(str *s, u32 size) diff --git a/include/al/wstr.h b/include/al/wstr.h index c80eac2..af66161 100644 --- a/include/al/wstr.h +++ b/include/al/wstr.h @@ -44,7 +44,7 @@ static inline bool al_wstr_is_empty(wstr *w) static inline void al_wstr_free(wstr *w) { - if (w->alloc > 0) al_free(w->data); + if (w->alloc) al_free(w->data); } static inline u32 al_wstr_reserve(wstr *w, u32 size) -- cgit v1.2.3-101-g0448