style: run flang-format

This commit is contained in:
MechSlayer 2025-09-05 22:03:02 +02:00
parent 9bd6be2c2c
commit 1c196dd658
9 changed files with 21 additions and 31 deletions

View file

@ -10,17 +10,17 @@ DRANG_BEGIN_DECLS
*/ */
DRANG_PLATFORM_API const char *drang_error_str(int err); DRANG_PLATFORM_API const char *drang_error_str(int err);
#define DRANG_EOK (0) // Success #define DRANG_EOK (0) // Success
#define DRANG_EINVAL (-1) // Invalid argument #define DRANG_EINVAL (-1) // Invalid argument
#define DRANG_ENOMEM (-2) // Out of memory #define DRANG_ENOMEM (-2) // Out of memory
#define DRANG_EIO (-3) // I/O error #define DRANG_EIO (-3) // I/O error
#define DRANG_NOTSUP (-4) // Operation not supported #define DRANG_NOTSUP (-4) // Operation not supported
#define DRANG_EAGAIN (-5) // Resource temporarily unavailable #define DRANG_EAGAIN (-5) // Resource temporarily unavailable
#define DRANG_ENOENT (-6) // No such file or directory #define DRANG_ENOENT (-6) // No such file or directory
#define DRANG_EDEADLK (-7) // Resource deadlock would occur #define DRANG_EDEADLK (-7) // Resource deadlock would occur
#define DRANG_EPERM (-8) // Operation not permitted #define DRANG_EPERM (-8) // Operation not permitted
#define DRANG_ETIMEDOUT (-9) // Connection timed out #define DRANG_ETIMEDOUT (-9) // Connection timed out
#define DRANG_EBUSY (-10) // Device or resource busy #define DRANG_EBUSY (-10) // Device or resource busy
#define DRANG_EPLATFORM (-1000) // An unknown platform-specific error occurred #define DRANG_EPLATFORM (-1000) // An unknown platform-specific error occurred
/** /**

View file

@ -1,10 +1,8 @@
#pragma once #pragma once
#include <drang/platform.h> #include <drang/platform.h>
DRANG_BEGIN_DECLS DRANG_BEGIN_DECLS
int drang_error_to_errno(int error); int drang_error_to_errno(int error);
int drang_errno_to_error(int errnum); int drang_errno_to_error(int errnum);

View file

@ -88,8 +88,8 @@ int drang_cond_timedwait(struct drang_cond *cond, struct drang_mutex *mutex, uin
// Add timeout milliseconds to current time // Add timeout milliseconds to current time
abs_timeout.tv_sec += (time_t)(timeout_ms / 1000); abs_timeout.tv_sec += (time_t) (timeout_ms / 1000);
abs_timeout.tv_nsec += (time_t)((timeout_ms % 1000) * 1000000); abs_timeout.tv_nsec += (time_t) ((timeout_ms % 1000) * 1000000);
// Handle nanosecond overflow // Handle nanosecond overflow
if (abs_timeout.tv_nsec >= 1000000000) { if (abs_timeout.tv_nsec >= 1000000000) {

View file

@ -9,7 +9,6 @@ size_t drang_mutex_size(void)
return sizeof(struct drang_mutex); return sizeof(struct drang_mutex);
} }
size_t drang_mutex_alignment(void) size_t drang_mutex_alignment(void)
{ {
return alignof(struct drang_mutex); return alignof(struct drang_mutex);
@ -28,7 +27,6 @@ int drang_mutex_init(struct drang_mutex *mutex)
} }
mutex->initialized = true; mutex->initialized = true;
DRANG_END_TRY_IGNORE(); DRANG_END_TRY_IGNORE();
} }

View file

@ -14,7 +14,6 @@ size_t drang_rwlock_alignment(void)
return alignof(struct drang_rwlock); return alignof(struct drang_rwlock);
} }
int drang_rwlock_init(struct drang_rwlock *rwlock) int drang_rwlock_init(struct drang_rwlock *rwlock)
{ {
DRANG_BEGIN_TRY() DRANG_BEGIN_TRY()
@ -26,7 +25,6 @@ int drang_rwlock_init(struct drang_rwlock *rwlock)
} }
rwlock->initialized = true; rwlock->initialized = true;
DRANG_END_TRY_IGNORE(); DRANG_END_TRY_IGNORE();
} }
void drang_rwlock_fini(struct drang_rwlock *rwlock) void drang_rwlock_fini(struct drang_rwlock *rwlock)

View file

@ -2,7 +2,6 @@
#include "drang/error.h" #include "drang/error.h"
#include <drang/sync.h> #include <drang/sync.h>
int drang_cond_new(struct drang_cond **cond) int drang_cond_new(struct drang_cond **cond)
{ {
struct drang_cond *c = NULL; struct drang_cond *c = NULL;
@ -10,7 +9,7 @@ int drang_cond_new(struct drang_cond **cond)
DRANG_CHECK(cond != NULL, DRANG_EINVAL); 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)); DRANG_TRY(drang_cond_init(c));

View file

@ -2,10 +2,9 @@
#include "drang/error.h" #include "drang/error.h"
#include <drang/sync.h> #include <drang/sync.h>
int drang_mutex_new(struct drang_mutex **mutex) int drang_mutex_new(struct drang_mutex **mutex)
{ {
struct drang_mutex* m = NULL; struct drang_mutex *m = NULL;
DRANG_BEGIN_TRY(); DRANG_BEGIN_TRY();
DRANG_CHECK(mutex != NULL, DRANG_EINVAL); DRANG_CHECK(mutex != NULL, DRANG_EINVAL);

View file

@ -1,7 +1,6 @@
#include <drang/sync.h>
#include <drang/error.h>
#include <drang/alloc.h> #include <drang/alloc.h>
#include <drang/error.h>
#include <drang/sync.h>
int drang_rwlock_new(struct drang_rwlock **rwlock) int drang_rwlock_new(struct drang_rwlock **rwlock)
{ {

View file

@ -12,7 +12,6 @@ size_t drang_mutex_alignment(void)
return alignof(struct drang_mutex); return alignof(struct drang_mutex);
} }
int drang_mutex_init(struct drang_mutex *mutex) int drang_mutex_init(struct drang_mutex *mutex)
{ {
DRANG_BEGIN_TRY(); DRANG_BEGIN_TRY();