diff options
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/bits.c | 8 | ||||
| -rw-r--r-- | src/util/memory.c | 2 | ||||
| -rw-r--r-- | src/util/random.c | 5 | ||||
| -rw-r--r-- | src/util/str.c | 3 | ||||
| -rw-r--r-- | src/util/timeout.c | 8 | ||||
| -rw-r--r-- | src/util/timeout.h | 8 |
6 files changed, 18 insertions, 16 deletions
diff --git a/src/util/bits.c b/src/util/bits.c index 0d60c26..b73a55d 100644 --- a/src/util/bits.c +++ b/src/util/bits.c @@ -174,16 +174,18 @@ char *bits_to_hex(const bits_t *bits) { // else // 0 0 | a b | c d | e // ^-----^ (8-offset zero bits, offset bits from first byte) - // ^-----^ (8-offset bits from first byte, offset bits from second byte) + // ^-----^ (8-offset bits from first byte, offset bits from second + // byte) // .... - // ^-----^ (8-offset bits from second to last byte, offset bits from last byte) + // ^-----^ (8-offset bits from second to last byte, offset bits + // from last byte) for (size_t i = 0; i < BYTE_LEN(bits->bitlen); ++i) { size_t pos = (i * 2) + (bits->sign ? 1 : 0); unsigned char value; if (offset) { value = bits->bits[i] >> (8 - offset); if (i != 0) { - value |= (bits->bits[i-1] & ~(1 << (8 - offset))) << offset; + value |= (bits->bits[i - 1] & ~(1 << (8 - offset))) << offset; } } else { value = bits->bits[i]; diff --git a/src/util/memory.c b/src/util/memory.c index f05efae..b84a4c4 100644 --- a/src/util/memory.c +++ b/src/util/memory.c @@ -72,4 +72,4 @@ void set_mem_funcs(void *(*malloc_fun)(size_t), void *(*calloc_fun)(size_t), calloc_func = calloc_fun; realloc_func = realloc_fun; free_func = free_fun; -}
\ No newline at end of file +} diff --git a/src/util/random.c b/src/util/random.c index b88bb50..844e0f6 100644 --- a/src/util/random.c +++ b/src/util/random.c @@ -5,8 +5,8 @@ #define _POSIX_C_SOURCE 200809L #include "random.h" -#include <time.h> #include <stdint.h> +#include <time.h> void random_reseed(void) { pari_ulong seed = 0; @@ -15,7 +15,8 @@ void random_reseed(void) { if (rand) { size_t read = 0; while (read < sizeof(pari_ulong)) { - read += fread(((uint8_t*) &seed) + read, 1, sizeof(pari_ulong) - read, rand); + read += fread(((uint8_t *)&seed) + read, 1, + sizeof(pari_ulong) - read, rand); } fclose(rand); diff --git a/src/util/str.c b/src/util/str.c index ff075f2..ade97a9 100644 --- a/src/util/str.c +++ b/src/util/str.c @@ -68,7 +68,6 @@ char *str_concat(char **strings, size_t len) { size_t str_cnt(const char *str, const char c) { size_t result = 0; - for (; str[result]; str[result] == c ? result++ : *str++) - ; + for (; str[result]; str[result] == c ? result++ : *str++); return result; } diff --git a/src/util/timeout.c b/src/util/timeout.c index 6fdbf16..5cfa552 100644 --- a/src/util/timeout.c +++ b/src/util/timeout.c @@ -19,17 +19,17 @@ void timeout_handle(int signum, siginfo_t *siginfo, void *other) { if (timeout_in) siglongjmp(timeout_ptr, 1); } -void timeout_thread_init() { +void timeout_thread_init(void) { timeout_timer = try_calloc(sizeof(timer_t)); sevp = try_calloc(sizeof(struct sigevent)); } -void timeout_thread_quit() { +void timeout_thread_quit(void) { try_free(timeout_timer); try_free(sevp); } -bool timeout_init() { +bool timeout_init(void) { // init for the main thread. timeout_thread_init(); struct sigaction new_action; @@ -42,7 +42,7 @@ bool timeout_init() { return true; } -void timeout_quit() { +void timeout_quit(void) { // deinit the main thread. timeout_thread_quit(); } diff --git a/src/util/timeout.h b/src/util/timeout.h index 57e3d22..6f6805b 100644 --- a/src/util/timeout.h +++ b/src/util/timeout.h @@ -69,19 +69,19 @@ extern __thread struct sigevent *sevp; } \ } -void timeout_thread_init(); +void timeout_thread_init(void); -void timeout_thread_quit(); +void timeout_thread_quit(void); /** * @brief Initialize the timeout system. * @return whether the initalization was successful */ -bool timeout_init(); +bool timeout_init(void); /** * @brief Deinitialize the timeout system. */ -void timeout_quit(); +void timeout_quit(void); #endif // ECGEN_UTIL_TIMEOUT_H |
