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);
#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
/**

View file

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

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
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) {

View file

@ -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();
}

View file

@ -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)

View file

@ -2,7 +2,6 @@
#include "drang/error.h"
#include <drang/sync.h>
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);
}
}

View file

@ -2,10 +2,9 @@
#include "drang/error.h"
#include <drang/sync.h>
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);
}
}

View file

@ -1,7 +1,6 @@
#include <drang/sync.h>
#include <drang/error.h>
#include <drang/alloc.h>
#include <drang/error.h>
#include <drang/sync.h>
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);
}
}

View file

@ -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();