summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-10-29 17:19:47 -0400
committerAndrew Opalach <andrew@akon.city> 2024-10-29 17:19:47 -0400
commita8bd86763e3db5c4320bfaf6684a803026213968 (patch)
tree7de30ae5b8d9dff44ae262f4ccfd6d6af2099bd0 /include
parent736f15908cf34a851140094897a13ff12d55fd0c (diff)
downloadlibalabaster-a8bd86763e3db5c4320bfaf6684a803026213968.tar.gz
libalabaster-a8bd86763e3db5c4320bfaf6684a803026213968.tar.bz2
libalabaster-a8bd86763e3db5c4320bfaf6684a803026213968.zip
all: Undo previous #ifdef style change
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'include')
-rw-r--r--include/al/array_sort.h2
-rw-r--r--include/al/array_typed.h2
-rw-r--r--include/al/lib.h25
-rw-r--r--include/al/log.h2
-rw-r--r--include/al/types.h6
-rw-r--r--include/al/wstr.h4
6 files changed, 20 insertions, 21 deletions
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 <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -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 <BaseTsd.h>
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;