style: run clang-format
This commit is contained in:
parent
e857d1a896
commit
c6925914e3
2 changed files with 6 additions and 4 deletions
|
|
@ -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.
|
* @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.
|
* 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.
|
* @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().
|
* @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.
|
* 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
|
DRANG_END_DECLS
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
char *drang_strdup(const char *str)
|
char *drang_strdup(const char *str)
|
||||||
{
|
{
|
||||||
if (!str) return NULL;
|
if (!str)
|
||||||
|
return NULL;
|
||||||
const size_t len = strlen(str);
|
const size_t len = strlen(str);
|
||||||
char *dup = DRANG_ALLOC_T_N(char, len + 1);
|
char *dup = DRANG_ALLOC_T_N(char, len + 1);
|
||||||
if (dup) {
|
if (dup) {
|
||||||
|
|
@ -14,7 +15,8 @@ char *drang_strdup(const char *str)
|
||||||
}
|
}
|
||||||
char *drang_strndup(const char *str, size_t n)
|
char *drang_strndup(const char *str, size_t n)
|
||||||
{
|
{
|
||||||
if (!str) return NULL;
|
if (!str)
|
||||||
|
return NULL;
|
||||||
const size_t len = strnlen(str, n);
|
const size_t len = strnlen(str, n);
|
||||||
char *dup = DRANG_ALLOC_T_N(char, len + 1);
|
char *dup = DRANG_ALLOC_T_N(char, len + 1);
|
||||||
if (dup) {
|
if (dup) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue