From 1c196dd6585cce48a8f45bfd762826cf0c060fa3 Mon Sep 17 00:00:00 2001 From: MechSlayer <0jcrespo1996@gmail.com> Date: Fri, 5 Sep 2025 22:03:02 +0200 Subject: [PATCH] style: run flang-format --- Source/DrangPlatform/Include/drang/error.h | 22 +++++++++---------- Source/DrangPlatform/Source/errno_convert.h | 4 +--- .../Source/linux/sync/cond_var.c | 4 ++-- .../DrangPlatform/Source/linux/sync/mutex.c | 2 -- .../DrangPlatform/Source/linux/sync/rwlock.c | 2 -- Source/DrangPlatform/Source/sync/cond_var.c | 5 ++--- Source/DrangPlatform/Source/sync/mutex.c | 5 ++--- Source/DrangPlatform/Source/sync/rwlock.c | 7 +++--- .../DrangPlatform/Source/win32/sync/mutex.c | 1 - 9 files changed, 21 insertions(+), 31 deletions(-) diff --git a/Source/DrangPlatform/Include/drang/error.h b/Source/DrangPlatform/Include/drang/error.h index 5a72e66..6100d59 100644 --- a/Source/DrangPlatform/Include/drang/error.h +++ b/Source/DrangPlatform/Include/drang/error.h @@ -10,17 +10,17 @@ DRANG_BEGIN_DECLS */ DRANG_PLATFORM_API const char *drang_error_str(int err); -#define DRANG_EOK (0) // Success -#define DRANG_EINVAL (-1) // Invalid argument -#define DRANG_ENOMEM (-2) // Out of memory -#define DRANG_EIO (-3) // I/O error -#define DRANG_NOTSUP (-4) // Operation not supported -#define DRANG_EAGAIN (-5) // Resource temporarily unavailable -#define DRANG_ENOENT (-6) // No such file or directory -#define DRANG_EDEADLK (-7) // Resource deadlock would occur -#define DRANG_EPERM (-8) // Operation not permitted -#define DRANG_ETIMEDOUT (-9) // Connection timed out -#define DRANG_EBUSY (-10) // Device or resource busy +#define DRANG_EOK (0) // Success +#define DRANG_EINVAL (-1) // Invalid argument +#define DRANG_ENOMEM (-2) // Out of memory +#define DRANG_EIO (-3) // I/O error +#define DRANG_NOTSUP (-4) // Operation not supported +#define DRANG_EAGAIN (-5) // Resource temporarily unavailable +#define DRANG_ENOENT (-6) // No such file or directory +#define DRANG_EDEADLK (-7) // Resource deadlock would occur +#define DRANG_EPERM (-8) // Operation not permitted +#define DRANG_ETIMEDOUT (-9) // Connection timed out +#define DRANG_EBUSY (-10) // Device or resource busy #define DRANG_EPLATFORM (-1000) // An unknown platform-specific error occurred /** diff --git a/Source/DrangPlatform/Source/errno_convert.h b/Source/DrangPlatform/Source/errno_convert.h index 0d95042..aba18d8 100644 --- a/Source/DrangPlatform/Source/errno_convert.h +++ b/Source/DrangPlatform/Source/errno_convert.h @@ -1,11 +1,9 @@ #pragma once #include - DRANG_BEGIN_DECLS - int drang_error_to_errno(int error); int drang_errno_to_error(int errnum); -DRANG_END_DECLS \ No newline at end of file +DRANG_END_DECLS diff --git a/Source/DrangPlatform/Source/linux/sync/cond_var.c b/Source/DrangPlatform/Source/linux/sync/cond_var.c index a768c41..aafd680 100644 --- a/Source/DrangPlatform/Source/linux/sync/cond_var.c +++ b/Source/DrangPlatform/Source/linux/sync/cond_var.c @@ -88,8 +88,8 @@ int drang_cond_timedwait(struct drang_cond *cond, struct drang_mutex *mutex, uin // Add timeout milliseconds to current time - abs_timeout.tv_sec += (time_t)(timeout_ms / 1000); - abs_timeout.tv_nsec += (time_t)((timeout_ms % 1000) * 1000000); + abs_timeout.tv_sec += (time_t) (timeout_ms / 1000); + abs_timeout.tv_nsec += (time_t) ((timeout_ms % 1000) * 1000000); // Handle nanosecond overflow if (abs_timeout.tv_nsec >= 1000000000) { diff --git a/Source/DrangPlatform/Source/linux/sync/mutex.c b/Source/DrangPlatform/Source/linux/sync/mutex.c index 54291fb..2510a96 100644 --- a/Source/DrangPlatform/Source/linux/sync/mutex.c +++ b/Source/DrangPlatform/Source/linux/sync/mutex.c @@ -9,7 +9,6 @@ size_t drang_mutex_size(void) return sizeof(struct drang_mutex); } - size_t drang_mutex_alignment(void) { return alignof(struct drang_mutex); @@ -28,7 +27,6 @@ int drang_mutex_init(struct drang_mutex *mutex) } mutex->initialized = true; - DRANG_END_TRY_IGNORE(); } diff --git a/Source/DrangPlatform/Source/linux/sync/rwlock.c b/Source/DrangPlatform/Source/linux/sync/rwlock.c index 007315e..cd0093b 100644 --- a/Source/DrangPlatform/Source/linux/sync/rwlock.c +++ b/Source/DrangPlatform/Source/linux/sync/rwlock.c @@ -14,7 +14,6 @@ size_t drang_rwlock_alignment(void) return alignof(struct drang_rwlock); } - int drang_rwlock_init(struct drang_rwlock *rwlock) { DRANG_BEGIN_TRY() @@ -26,7 +25,6 @@ int drang_rwlock_init(struct drang_rwlock *rwlock) } rwlock->initialized = true; DRANG_END_TRY_IGNORE(); - } void drang_rwlock_fini(struct drang_rwlock *rwlock) diff --git a/Source/DrangPlatform/Source/sync/cond_var.c b/Source/DrangPlatform/Source/sync/cond_var.c index 36477d4..cc56ad5 100644 --- a/Source/DrangPlatform/Source/sync/cond_var.c +++ b/Source/DrangPlatform/Source/sync/cond_var.c @@ -2,7 +2,6 @@ #include "drang/error.h" #include - int drang_cond_new(struct drang_cond **cond) { struct drang_cond *c = NULL; @@ -10,7 +9,7 @@ int drang_cond_new(struct drang_cond **cond) DRANG_CHECK(cond != NULL, DRANG_EINVAL); - c = DRANG_TRY_ALLOC_ALIGNED(drang_cond_size(), drang_cond_alignment()); + c = DRANG_TRY_ALLOC_ALIGNED(drang_cond_size(), drang_cond_alignment()); DRANG_TRY(drang_cond_init(c)); @@ -33,4 +32,4 @@ void drang_cond_free(struct drang_cond *cond) drang_cond_fini(cond); drang_free(cond); -} \ No newline at end of file +} diff --git a/Source/DrangPlatform/Source/sync/mutex.c b/Source/DrangPlatform/Source/sync/mutex.c index aaef7e8..6761be8 100644 --- a/Source/DrangPlatform/Source/sync/mutex.c +++ b/Source/DrangPlatform/Source/sync/mutex.c @@ -2,10 +2,9 @@ #include "drang/error.h" #include - int drang_mutex_new(struct drang_mutex **mutex) { - struct drang_mutex* m = NULL; + struct drang_mutex *m = NULL; DRANG_BEGIN_TRY(); DRANG_CHECK(mutex != NULL, DRANG_EINVAL); @@ -33,4 +32,4 @@ void drang_mutex_free(struct drang_mutex *mutex) } drang_mutex_fini(mutex); drang_free(mutex); -} \ No newline at end of file +} diff --git a/Source/DrangPlatform/Source/sync/rwlock.c b/Source/DrangPlatform/Source/sync/rwlock.c index 47f7470..b35c2e9 100644 --- a/Source/DrangPlatform/Source/sync/rwlock.c +++ b/Source/DrangPlatform/Source/sync/rwlock.c @@ -1,7 +1,6 @@ -#include -#include #include - +#include +#include int drang_rwlock_new(struct drang_rwlock **rwlock) { @@ -33,4 +32,4 @@ void drang_rwlock_free(struct drang_rwlock *rwlock) drang_rwlock_fini(rwlock); drang_free(rwlock); -} \ No newline at end of file +} diff --git a/Source/DrangPlatform/Source/win32/sync/mutex.c b/Source/DrangPlatform/Source/win32/sync/mutex.c index 3864515..9d0bafd 100644 --- a/Source/DrangPlatform/Source/win32/sync/mutex.c +++ b/Source/DrangPlatform/Source/win32/sync/mutex.c @@ -12,7 +12,6 @@ size_t drang_mutex_alignment(void) return alignof(struct drang_mutex); } - int drang_mutex_init(struct drang_mutex *mutex) { DRANG_BEGIN_TRY();