]> git.lizzy.rs Git - dragonstd.git/commitdiff
Style: no longer put space after unary operators
authorElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 9 Apr 2022 20:41:49 +0000 (22:41 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Sat, 9 Apr 2022 20:41:49 +0000 (22:41 +0200)
bits/wrappers.h
flag.c
map.c
queue.c
refcount.c
test/test_flag.c
test/test_refcount_map.c
tree.c

index 66093a212deec4df5ed56c01b70763cf62f96af2..cfeb0091465ca1ea5d3494560e0bd65553838314 100644 (file)
@@ -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 a8bb87888f5ee67f3b7752f80269718fe1d108ea..6937e5f04e3a1b58746d5eb7c54a1aefb8b8ccf7 100644 (file)
--- 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 61e971cd24368098a86fbefb1b4076550c2b5b2e..fa9b073afcdcce67ef966f66b268a62d7aa4eed2 100644 (file)
--- 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 a05dae672362e012ee737d24e3bebde3ee503569..606989c4ae79acc8fdd8c17c222bf0a253874aa6 100644 (file)
--- 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;
index e0b354cfcf571e8f556c085ccf05b573ec5111ae..eef329785ae5d599d36cc9fccc78c22658da418d 100644 (file)
@@ -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;
index dfe0bb4dc974084c9330c4ceff7cc9bdf3f3109b..d7429237e1b7b27d1fc85b9f328996bd04a0ef5c 100644 (file)
@@ -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);
index 642f15b6bd799eb2f8de73db17ad80e2b765cb0b..c972ce5c250ebbeb99fc813c84801e9205387409 100644 (file)
@@ -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 e4206b2238a7a83421f2ec3cf8b61ee63be127c5..60c73ccb1eb7ee8020faa4ccecfd7a5a379dbfe8 100644 (file)
--- 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);