CLEANUP: atomic/tree-wide: replace single increments/decrements with inc/dec
This patch replaces roughly all occurrences of an HA_ATOMIC_ADD(&foo, 1)
or HA_ATOMIC_SUB(&foo, 1) with the equivalent HA_ATOMIC_INC(&foo) and
HA_ATOMIC_DEC(&foo) respectively. These are 507 changes over 45 files.
diff --git a/src/session.c b/src/session.c
index f4593ba..1038a36 100644
--- a/src/session.c
+++ b/src/session.c
@@ -50,8 +50,8 @@
sess->task = NULL;
sess->t_handshake = -1; /* handshake not done yet */
sess->t_idle = -1;
- _HA_ATOMIC_ADD(&totalconn, 1);
- _HA_ATOMIC_ADD(&jobs, 1);
+ _HA_ATOMIC_INC(&totalconn);
+ _HA_ATOMIC_INC(&jobs);
LIST_INIT(&sess->srv_list);
sess->idle_conns = 0;
sess->flags = SESS_FL_NONE;
@@ -90,7 +90,7 @@
pool_free(pool_head_sess_srv_list, srv_list);
}
pool_free(pool_head_session, sess);
- _HA_ATOMIC_SUB(&jobs, 1);
+ _HA_ATOMIC_DEC(&jobs);
}
/* callback used from the connection/mux layer to notify that a connection is
@@ -118,7 +118,7 @@
ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_CNT);
if (ptr)
- HA_ATOMIC_ADD(&stktable_data_cast(ptr, sess_cnt), 1);
+ HA_ATOMIC_INC(&stktable_data_cast(ptr, sess_cnt));
ptr = stktable_data_ptr(stkctr->table, stkctr_entry(stkctr), STKTABLE_DT_SESS_RATE);
if (ptr)