style: run clang-format

This commit is contained in:
MechSlayer 2025-09-05 17:03:59 +02:00
parent e857d1a896
commit c6925914e3
2 changed files with 6 additions and 4 deletions

View file

@ -36,7 +36,7 @@ DRANG_PLATFORM_API char *drang_strndup(const char *str, size_t n);
* @remarks The returned string must be freed using drang_free() when no longer needed.
* This macro should only be used within a DRANG error handling context.
*/
#define DRANG_TRY_STRDUP(_Str_) (char*)(DRANG_ALLOC_TRY_IMPL(drang_strdup((_Str_))))
#define DRANG_TRY_STRDUP(_Str_) (char *) (DRANG_ALLOC_TRY_IMPL(drang_strdup((_Str_))))
/**
* @brief Duplicates at most n characters of a string with automatic error handling.
@ -49,6 +49,6 @@ DRANG_PLATFORM_API char *drang_strndup(const char *str, size_t n);
* @remarks The returned string is always null-terminated and must be freed using drang_free().
* This macro should only be used within a DRANG error handling context.
*/
#define DRANG_TRY_STRNDUP(_Str_, _N_) (char*)(DRANG_ALLOC_TRY_IMPL(drang_strndup((_Str_), (_N_))))
#define DRANG_TRY_STRNDUP(_Str_, _N_) (char *) (DRANG_ALLOC_TRY_IMPL(drang_strndup((_Str_), (_N_))))
DRANG_END_DECLS

View file

@ -3,7 +3,8 @@
char *drang_strdup(const char *str)
{
if (!str) return NULL;
if (!str)
return NULL;
const size_t len = strlen(str);
char *dup = DRANG_ALLOC_T_N(char, len + 1);
if (dup) {
@ -14,7 +15,8 @@ char *drang_strdup(const char *str)
}
char *drang_strndup(const char *str, size_t n)
{
if (!str) return NULL;
if (!str)
return NULL;
const size_t len = strnlen(str, n);
char *dup = DRANG_ALLOC_T_N(char, len + 1);
if (dup) {