From bd5129cb740a4286b6b1bbaef41db0c4156e072c Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sat, 9 Apr 2022 22:41:49 +0200 Subject: [PATCH] Style: no longer put space after unary operators --- bits/wrappers.h | 6 +++--- flag.c | 2 +- map.c | 6 +++--- queue.c | 4 ++-- refcount.c | 2 +- test/test_flag.c | 4 ++-- test/test_refcount_map.c | 8 ++++---- tree.c | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bits/wrappers.h b/bits/wrappers.h index 66093a2..cfeb009 100644 --- a/bits/wrappers.h +++ b/bits/wrappers.h @@ -3,7 +3,7 @@ { \ Type ## Node **node = prefix ## nfd(self, dat, cmp); \ \ - if (! *node) \ + if (!*node) \ prefix ## nmk(self, node, trans ? trans(dat) : dat); \ \ return (*node)->dat; \ @@ -13,7 +13,7 @@ { \ Type ## Node **node = prefix ## nfd(self, key, cmp); \ \ - if (! *node) \ + if (!*node) \ return NULL; \ \ return trans ? trans((*node)->dat) : (*node)->dat; \ @@ -23,7 +23,7 @@ { \ Type ## Node **node = prefix ## nfd(self, key, cmp); \ \ - if (! *node) \ + if (!*node) \ return NULL; \ \ void *dat = trans ? trans((*node)->dat) : (*node)->dat; \ diff --git a/flag.c b/flag.c index a8bb878..6937e5f 100644 --- a/flag.c +++ b/flag.c @@ -44,7 +44,7 @@ void flag_set(Flag *flag) void flag_slp(Flag *flag) { pthread_mutex_lock(&flag->mtx); - if (! flag->set) + if (!flag->set) pthread_cond_wait(&flag->cnd, &flag->mtx); pthread_mutex_unlock(&flag->mtx); } diff --git a/map.c b/map.c index 61e971c..fa9b073 100644 --- a/map.c +++ b/map.c @@ -6,7 +6,7 @@ static bool get_lock(Map *map, bool write) pthread_rwlock_rdlock(&map->clk); - if ((success = ! map->cnl)) { + if ((success = !map->cnl)) { if (write) pthread_rwlock_wrlock(&map->tlk); else @@ -48,7 +48,7 @@ void map_cnl(Map *map, Iterator iter, void *arg, Transformer trans, TreeTraversi #define WRAP_TREE_FUNC(name, write) \ void *map_ ## name(Map *map, void *dat, Comparator cmp, Transformer trans) \ { \ - if (! get_lock(map, write)) \ + if (!get_lock(map, write)) \ return NULL; \ \ dat = tree_ ## name(&map->tre, dat, cmp, trans); \ @@ -62,7 +62,7 @@ WRAP_TREE_FUNC(del, true) void map_trv(Map *map, Iterator iter, void *arg, Transformer trans, TreeTraversionOrder order) { - if (! get_lock(map, false)) + if (!get_lock(map, false)) return; tree_trv(&map->tre, iter, arg, trans, order); diff --git a/queue.c b/queue.c index a05dae6..606989c 100644 --- a/queue.c +++ b/queue.c @@ -25,7 +25,7 @@ bool queue_enq(Queue *queue, void *dat) bool success = false; pthread_mutex_lock(&queue->mtx); - if (! queue->fin) { + if (!queue->fin) { success = true; list_apd(&queue->lst, dat); pthread_cond_signal(&queue->cnd); @@ -40,7 +40,7 @@ void *queue_deq(Queue *queue, Transformer trans) void *dat = NULL; pthread_mutex_lock(&queue->mtx); - while (! queue->cnl && ! dat) { + while (!queue->cnl && !dat) { ListNode **node = &queue->lst.fst; if (*node) { dat = (*node)->dat; diff --git a/refcount.c b/refcount.c index e0b354c..eef3297 100644 --- a/refcount.c +++ b/refcount.c @@ -36,7 +36,7 @@ void *refcount_drp(void *refcount) unsigned short count = --rc->cnt; pthread_mutex_unlock(&rc->mtx); - if (! count) + if (!count) return rc->del(rc->obj); return rc->obj; diff --git a/test/test_flag.c b/test/test_flag.c index dfe0bb4..d742923 100644 --- a/test/test_flag.c +++ b/test/test_flag.c @@ -21,7 +21,7 @@ void *start_thread(__attribute__((unused)) void *val) bool is_finished() { - ITER_FLAGS if (! flags[i].set) + ITER_FLAGS if (!flags[i].set) return false; return true; @@ -39,7 +39,7 @@ int main() pthread_t thread; pthread_create(&thread, NULL, &start_thread, NULL); - while (! is_finished()) { + while (!is_finished()) { int i = rand() % NUM_FLAGS; printf("setting flag %d\n", i); diff --git a/test/test_refcount_map.c b/test/test_refcount_map.c index 642f15b..c972ce5 100644 --- a/test/test_refcount_map.c +++ b/test/test_refcount_map.c @@ -44,7 +44,7 @@ int data_object_compare_id(const void *pa, const void *pb) static void *thread_create(unsigned int *result) { - while (! cancel) { + while (!cancel) { DataObject *obj = malloc(sizeof *obj); obj->id = rand_id(); @@ -65,7 +65,7 @@ static void *thread_access(unsigned int *result) { DataObject *objs[NUM_OBJS] = {NULL}; - while (! cancel) { + while (!cancel) { int i = rand() % NUM_OBJS; if (objs[i]) { @@ -73,7 +73,7 @@ static void *thread_access(unsigned int *result) objs[i] = NULL; } - while (! objs[i] && ! cancel) { + while (!objs[i] && !cancel) { int id = rand_id(); objs[i] = map_get(&map, &id, &data_object_compare_id, &refcount_grb); } @@ -93,7 +93,7 @@ static void *thread_access(unsigned int *result) static void *thread_delete(unsigned int *result) { - while (! cancel) { + while (!cancel) { unsigned int id = rand_id(); if (map_del(&map, &id, &data_object_compare_id, &refcount_drp)) diff --git a/tree.c b/tree.c index e4206b2..60c73cc 100644 --- a/tree.c +++ b/tree.c @@ -4,7 +4,7 @@ static inline TreeNode **search(TreeNode **node, void *key, Comparator cmp) { - if (! *node) + if (!*node) return node; int rel = cmp((*node)->dat, key); @@ -19,7 +19,7 @@ static inline TreeNode **search(TreeNode **node, void *key, Comparator cmp) static inline void traverse(TreeNode *node, Iterator iter, void *arg, Transformer trans, TreeTraversionOrder order, int delete) { - if (! node) + if (!node) return; if (iter && order == TRAVERSION_PREORDER ) iter(trans ? trans(node->dat) : node->dat, arg); -- 2.44.0