]> git.lizzy.rs Git - dragonstd.git/commitdiff
Merge branch 'main' of https://github.com/dragonblocks/dragonstd
authorElias Fleckenstein <eliasfleckenstein@web.de>
Wed, 13 Apr 2022 17:55:01 +0000 (19:55 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Wed, 13 Apr 2022 17:55:01 +0000 (19:55 +0200)
bits/wrappers.h
flag.c
map.c
queue.c
refcount.c
test/test_flag.c
test/test_refcount_map.c
tree.c

index 652becbc7f1178bc80bdb533a5d394c131c37c32..9169053e0366ab6475e8a2ca6471d36a2408ab79 100644 (file)
@@ -14,7 +14,7 @@
        { \
                Type ## Node **node = prefix ## nfd(self, key, cmp); \
  \
-               if (! *node) \
+               if (!*node) \
                        return NULL; \
  \
                return trans ? trans((*node)->dat) : (*node)->dat; \
@@ -24,7 +24,7 @@
        { \
                Type ## Node **node = prefix ## nfd(self, key, cmp); \
  \
-               if (! *node) \
+               if (!*node) \
                        return false; \
  \
                if (call) \
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 c45069fdef5945bf5f9ec201ba3c61cc0685d53d..abdd7052ed7d36e77662899932d6b5a1389d47e3 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(type, name, write, CallbackType, null) \
        type map_ ## name(Map *map, void *dat, Comparator cmp, CallbackType func) \
        { \
-               if (! get_lock(map, write)) \
+               if (!get_lock(map, write)) \
                        return null; \
  \
                type ret = tree_ ## name(&map->tre, dat, cmp, func); \
@@ -62,7 +62,7 @@ WRAP_TREE_FUNC(bool,   del, true,  Callback,    false)
 
 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 8473787e7ba1ec7b6a4b5c23aa40de507d0813bc..dcb5b18565c390ac0028275b89b5a513694e8b2a 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)
                rc->del(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 84dc1abecf7d55b5c0c8c895af56c370d12fc2b6..8e951f8ce478022969394eba58ecaeb47682f90b 100644 (file)
@@ -43,7 +43,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();
 
@@ -64,7 +64,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]) {
@@ -72,7 +72,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);
                }
@@ -92,7 +92,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);