From a8bd86763e3db5c4320bfaf6684a803026213968 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Tue, 29 Oct 2024 17:19:47 -0400 Subject: all: Undo previous #ifdef style change Signed-off-by: Andrew Opalach --- include/al/array_sort.h | 2 +- include/al/array_typed.h | 2 +- include/al/lib.h | 25 ++++++++++++------------- include/al/log.h | 2 +- include/al/types.h | 6 +++--- include/al/wstr.h | 4 ++-- 6 files changed, 20 insertions(+), 21 deletions(-) (limited to 'include/al') diff --git a/include/al/array_sort.h b/include/al/array_sort.h index 8d138d0..18b00f5 100644 --- a/include/al/array_sort.h +++ b/include/al/array_sort.h @@ -18,7 +18,7 @@ } \ } while (0) -#if AL_USE_STDLIB +#ifdef AL_USE_STDLIB #define AL_STDLIB_QSORT(data, type, count, cmp) qsort(data, count, sizeof(type), cmp) #endif diff --git a/include/al/array_typed.h b/include/al/array_typed.h index 09289f2..a48b230 100644 --- a/include/al/array_typed.h +++ b/include/al/array_typed.h @@ -1,7 +1,7 @@ #ifndef _AL_ARRAY_TYPED_H #define _AL_ARRAY_TYPED_H -#if !defined AL_HAVE_GNU_EXTENSIONS +#ifndef AL_HAVE_GNU_EXTENSIONS #error "missing required GNU C extensions" #endif diff --git a/include/al/lib.h b/include/al/lib.h index 6e0b1a9..a8f2b9f 100644 --- a/include/al/lib.h +++ b/include/al/lib.h @@ -3,9 +3,8 @@ #include "types.h" -#define AL_USE_STDLIB 1 - -#define AL_FORCE_DISABLE_OUTPUT 0 +#define AL_USE_STDLIB +//#define AL_FORCE_DISABLE_OUTPUT #if defined __clang__ || defined __GNUC__ #define AL_UNUSED_FUNCTION_PUSH \ @@ -18,7 +17,7 @@ #define AL_UNUSED_FUNCTION_POP #endif -#if AL_USE_STDLIB +#ifdef AL_USE_STDLIB #include #include #include @@ -34,7 +33,7 @@ void *al_malloc(size_t n); void *al_calloc(size_t n, size_t size); void *al_realloc(void *ptr, size_t n); void al_free(void *ptr); -#if defined AL_HAVE_POSIX_MEMALIGN +#ifdef AL_HAVE_POSIX_MEMALIGN int al_posix_memalign(void **ptr, size_t alignment, size_t n); #endif void al_malloc_stats(u32 *current, u32 *peak, u32 *total); @@ -50,7 +49,7 @@ void al_set_alloc(void *(*malloc_func)(size_t), void *(*calloc_func)(size_t, siz #define al_strlen strlen #define al_snprintf snprintf #define al_vsnprintf vsnprintf -#if defined _DEBUG_ +#ifdef _DEBUG_ #define al_assert assert #else #define al_assert(expr) do { (void)sizeof(expr); } while (0) // NOLINT(bugprone-sizeof-expression) @@ -67,7 +66,7 @@ AL_UNUSED_FUNCTION_PUSH static inline s32 al_printf(const char *fmt, ...) { -#if AL_FORCE_DISABLE_OUTPUT +#ifdef AL_FORCE_DISABLE_OUTPUT (void)fmt; return 0; #else @@ -81,7 +80,7 @@ static inline s32 al_printf(const char *fmt, ...) static inline s32 al_vprintf(const char *fmt, va_list args) { -#if AL_FORCE_DISABLE_OUTPUT +#ifdef AL_FORCE_DISABLE_OUTPUT (void)fmt; (void)args; return 0; @@ -105,16 +104,16 @@ static inline void *al_memrchr(const void *s, s32 c, size_t n) AL_UNUSED_FUNCTION_POP #endif -#if !defined LIKELY -#if defined AL_HAVE_BUILTIN_EXPECT +#ifndef LIKELY +#ifdef AL_HAVE_BUILTIN_EXPECT #define LIKELY(x) __builtin_expect((x), 1) #else #define LIKELY(x) x #endif #endif -#if !defined UNLIKELY -#if defined AL_HAVE_BUILTIN_EXPECT +#ifndef UNLIKELY +#ifdef AL_HAVE_BUILTIN_EXPECT #define UNLIKELY(x) __builtin_expect((x), 0) #else #define UNLIKELY(x) x @@ -150,7 +149,7 @@ AL_UNUSED_FUNCTION_POP #define AL_BOOLSTR(b) ((b) ? "true" : "false") -#if !defined _MSVC_ +#ifndef _MSVC_ #define __al_thread __thread #else #define __al_thread __declspec(thread) diff --git a/include/al/log.h b/include/al/log.h index 87b25c2..9f5dc91 100644 --- a/include/al/log.h +++ b/include/al/log.h @@ -18,7 +18,7 @@ s32 _al_logv(const char *level, const char *section, const char *name, const s32 #define al_log_info(section, fmt, ...) al_log("info", section, fmt, ##__VA_ARGS__) #define al_log_warn(section, fmt, ...) al_log("warn", section, fmt, ##__VA_ARGS__) #define al_log_error(section, fmt, ...) al_log("error", section, fmt, ##__VA_ARGS__) -#if defined _DEBUG_ +#ifdef _DEBUG_ #define al_log_debug(section, fmt, ...) al_log("debug", section, fmt, ##__VA_ARGS__) #else AL_UNUSED_FUNCTION_PUSH diff --git a/include/al/types.h b/include/al/types.h index 45a8a54..cf3d0e8 100644 --- a/include/al/types.h +++ b/include/al/types.h @@ -1,7 +1,7 @@ #ifndef _AL_TYPES_H #define _AL_TYPES_H -#if defined _POSIX_C_SOURCE +#ifdef _POSIX_C_SOURCE #if _POSIX_C_SOURCE < 200112L #error "libalabaster requires _POSIX_C_SOURCE >= 200112L" #endif @@ -9,7 +9,7 @@ #define _POSIX_C_SOURCE 200112L #endif -#if defined _XOPEN_SOURCE +#ifdef _XOPEN_SOURCE #if _XOPEN_SOURCE < 500 #error "libalabaster requires _XOPEN_SOURCE >= 500" #endif @@ -39,7 +39,7 @@ typedef double f64; // Use `long` and `ulong`, if needed, for API compatibility. typedef unsigned long ulong; -#if defined _MSC_VER +#ifdef _MSC_VER #include typedef SSIZE_T ssize_t; #endif diff --git a/include/al/wstr.h b/include/al/wstr.h index 1202882..8113575 100644 --- a/include/al/wstr.h +++ b/include/al/wstr.h @@ -31,7 +31,7 @@ AL_UNUSED_FUNCTION_PUSH static inline s32 al_wchar_width(wchar_t wc) { -#if defined AL_HAVE_WIDE_STRING +#ifdef AL_HAVE_WIDE_STRING return wcwidth(wc); #else (void)wc; @@ -98,7 +98,7 @@ static inline void al_wstr_to_str(wstr *w, str *s) static inline s32 al_wstr_width(wstr *w) { -#if defined AL_HAVE_WIDE_STRING +#ifdef AL_HAVE_WIDE_STRING return wcswidth(w->data, w->len); #else (void)w; -- cgit v1.2.3-101-g0448