summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/array.c18
-rw-r--r--src/lib.c5
-rw-r--r--src/log.c4
-rw-r--r--src/ring_buffer.c4
-rw-r--r--src/str.c11
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;
diff --git a/src/lib.c b/src/lib.c
index 9a658cf..ca737e4 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -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)
{
diff --git a/src/log.c b/src/log.c
index 436ac16..c4b24f0 100644
--- a/src/log.c
+++ b/src/log.c
@@ -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;
}
diff --git a/src/str.c b/src/str.c
index 2cde190..c955d51 100644
--- a/src/str.c
+++ b/src/str.c
@@ -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;
}