diff options
| author | 2024-12-26 15:13:32 -0500 | |
|---|---|---|
| committer | 2024-12-26 15:13:32 -0500 | |
| commit | 97a20386f6e95923a24a30818e00685999298ddc (patch) | |
| tree | 7abb3f73c228ddc91ce125f0a17688468b368f4c /src | |
| parent | bb4d5418f2173bf9a2fa1c0be31c3eb9f2025a21 (diff) | |
| download | libalabaster-97a20386f6e95923a24a30818e00685999298ddc.tar.gz libalabaster-97a20386f6e95923a24a30818e00685999298ddc.tar.bz2 libalabaster-97a20386f6e95923a24a30818e00685999298ddc.zip | |
Revise style
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src')
| -rw-r--r-- | src/array.c | 18 | ||||
| -rw-r--r-- | src/lib.c | 5 | ||||
| -rw-r--r-- | src/log.c | 4 | ||||
| -rw-r--r-- | src/ring_buffer.c | 4 | ||||
| -rw-r--r-- | src/str.c | 11 |
5 files changed, 27 insertions, 15 deletions
diff --git a/src/array.c b/src/array.c index 0459c96..58d3c7f 100644 --- a/src/array.c +++ b/src/array.c @@ -87,13 +87,14 @@ AL_MACRO_WRAP \ } \ }) -#define al_array_remove_all(arr, elem) \ -AL_MACRO_WRAP \ -({ \ - for (u32 i = (arr).size; i-- > 0;) { \ - if (al_array_at(arr, i) == elem) \ - al_array_remove_at(arr, i); \ - } \ +#define al_array_remove_all(arr, elem) \ +AL_MACRO_WRAP \ +({ \ + for (u32 i = (arr).size; i-- > 0;) { \ + if (al_array_at(arr, i) == elem) { \ + al_array_remove_at(arr, i); \ + } \ + } \ }) #define al_array_remove_at(arr, i) \ @@ -149,8 +150,9 @@ AL_UNUSED_FUNCTION_PUSH static inline u32 _al_array_reserve(void **ptr, u32 item_size, u32 prev_size, u32 size) { - if (size <= prev_size) + if (size <= prev_size) { return prev_size; + } size = size < al_grow_step ? al_next_power_of_two(size) : (size + al_grow_step) & ~al_grow_step; @@ -44,8 +44,9 @@ static size_t total_alloc = 0; #define current_changed_by(n) \ current_alloc += (n); \ - if (current_alloc > peak_alloc) \ - peak_alloc = current_alloc; + if (current_alloc > peak_alloc) { \ + peak_alloc = current_alloc; \ + } void al_malloc_init(void) { @@ -92,7 +92,9 @@ s32 _al_logv(u8 level, const char *section, const char *name, const s32 line, co ret += al_printf(AL_LOG_TEMPLATE, name, line, func, level); #endif ret += al_vprintf(fmt, args); - if (strcspn(fmt, "\r\n") == al_strlen(fmt)) ret += al_printf("\n"); + if (strcspn(fmt, "\r\n") == al_strlen(fmt)) { + ret += al_printf("\n"); + } #else char *buffer = get_message_buffer(level, section, fmt, name, line, func, args); #endif diff --git a/src/ring_buffer.c b/src/ring_buffer.c index cf72d2b..1c39b7b 100644 --- a/src/ring_buffer.c +++ b/src/ring_buffer.c @@ -14,7 +14,9 @@ void al_ring_buffer_init(struct al_ring_buffer *buf, u8 *data, size_t length) static inline u8 *previous(struct al_ring_buffer *buf, u8 *ptr) { - if (ptr == buf->start) ptr = buf->end; + if (ptr == buf->start) { + ptr = buf->end; + } return --ptr; } @@ -7,7 +7,9 @@ s64 al_str_to_long(str *s, s32 base) u32 i = 0; s32 neg = 0; - while (al_isspace(al_str_at(s, i)) && i < s->len) i++; + while (al_isspace(al_str_at(s, i)) && i < s->len) { + i++; + } if (al_str_at(s, i) == '-') { neg = 1; @@ -50,8 +52,11 @@ s64 al_str_to_long(str *s, s32 base) ret = ret * base + c; } - if (error) ret = neg ? INT64_MIN : INT64_MAX; - else if (neg) ret = -ret; + if (error) { + ret = neg ? INT64_MIN : INT64_MAX; + } else if (neg) { + ret = -ret; + } return ret; } |