summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-05 14:43:58 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-06 11:09:10 +0100
commit5b57ab6332edc407524a353d3965a4870c33fe00 (patch)
tree238659ca8e218307fff1476d427c94194bc24fad /toxcore/util.c
parentaad1e0ad3f96786e0fb10d8dd144e5e6ebe93258 (diff)
Improve C standard compliance.
- Don't cast between object and function pointers. - Use standard compliant `__VA_ARGS__` in macros. - Add explicit `__extension__` on unnamed union in struct (it's a GNU extension). - Remove ; after function definitions. - Replace `const T foo = 3;` for integral types `T` with `enum { foo = 3 };`. Folding integral constants like that as compile time constants is a GNU extension. Arrays allocated with `foo` as dimension are VLAs on strictly compliant C99 compilers. - Replace empty initialiser list `{}` with zero-initialiser-list `{0}`. The former is a GNU extension meaning the latter. - Cast `T*` (where `T != void`) to `void *` in format arguments. While any object pointer can be implicitly converted to and from `void *`, this conversion does not happen in variadic function calls. - Replace arithmetic on `void *` with arithmetic on `char *`. The former is non-compliant. - Replace non-`int`-derived types (like `uint16_t`, which is `short`-derived) in bit fields with `int`-derived types. Using any type other than `int` or `unsigned int` (or any of their aliases) in bit fields is a GNU extension.
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index 285bba9b..9f1a7e28 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -169,7 +169,7 @@ int load_state(load_state_callback_func load_state_callback, void *outer,
169 } 169 }
170 170
171 return length == 0 ? 0 : -1; 171 return length == 0 ? 0 : -1;
172}; 172}
173 173
174int create_recursive_mutex(pthread_mutex_t *mutex) 174int create_recursive_mutex(pthread_mutex_t *mutex)
175{ 175{