diff options
| author | 2026-04-09 09:49:33 -0400 | |
|---|---|---|
| committer | 2026-04-09 09:49:33 -0400 | |
| commit | abe21ac46759ffef041e52310a17552f36ee9297 (patch) | |
| tree | 30abd744c7e0faea126a7b6fdf330eddc0e4280c /include/al/lib.h | |
| parent | b5b765781482a7b3ff6026ea71b4eb35a0a155d0 (diff) | |
| download | libalabaster-abe21ac46759ffef041e52310a17552f36ee9297.tar.gz libalabaster-abe21ac46759ffef041e52310a17552f36ee9297.tar.bz2 libalabaster-abe21ac46759ffef041e52310a17552f36ee9297.zip | |
lib: Add strscmp() for static char arrays
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'include/al/lib.h')
| -rw-r--r-- | include/al/lib.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/al/lib.h b/include/al/lib.h index 3195e7b..8e16700 100644 --- a/include/al/lib.h +++ b/include/al/lib.h @@ -26,6 +26,8 @@ AL_STATIC_ASSERT(t1_size_eq_t2, sizeof(t1), ==, sizeof(t2)); \ AL_STATIC_ASSERT(t1_signedness_eq_t2, AL_IS_SIGNED(t1), ==, AL_IS_SIGNED(t2)) +#define AL_CHARS_IF_LITERAL(s) ((char *)("" s "")) // This argument must be a static char array. + #define AL_USE_STDLIB //#define AL_PARANOID_REALLOC //#define AL_MEMORY_TRACKING @@ -95,6 +97,7 @@ static inline void *al_realloc(void *ptr, size_t n) { return ptr ? realloc(ptr, #define al_bzero bzero #define al_strlen strlen #define al_strncmp strncmp +#define al_strscmp(s1, s2) strncmp(s1, AL_CHARS_IF_LITERAL(s2), sizeof(s2)) // strndup is _POSIX_C_SOURCE >= 200809L. //#define al_strndup strndup #define al_snprintf snprintf |