Commit 08d8a294 authored by Nils Goroll's avatar Nils Goroll

Rename VRB_ -> VRBT_ for red/black tree macros

sed 's:VRB_:VRBT_:g' -i "$FILES_CHANGED[@]"

Closes #2812
parent ba2bd1b4
......@@ -8,8 +8,8 @@
-e732 // Loss of sign (arg. no. 2) (int to unsigned
-e713 // Loss of precision (assignment) (unsigned long long to long long)
-sem(t_order_VRB_INSERT, custodial(2))
-sem(t_key_VRB_INSERT, custodial(2))
-sem(t_order_VRBT_INSERT, custodial(2))
-sem(t_key_VRBT_INSERT, custodial(2))
///////////////////////////////////////////////////////////////////////
// Varnishstat specific
......
......@@ -70,8 +70,8 @@ struct top {
char *rec_buf;
int clen;
unsigned hash;
VRB_ENTRY(top) e_order;
VRB_ENTRY(top) e_key;
VRBT_ENTRY(top) e_order;
VRBT_ENTRY(top) e_key;
double count;
};
......@@ -85,8 +85,8 @@ static const char *ident;
static volatile sig_atomic_t quit = 0;
static VRB_HEAD(t_order, top) h_order = VRB_INITIALIZER(&h_order);
static VRB_HEAD(t_key, top) h_key = VRB_INITIALIZER(&h_key);
static VRBT_HEAD(t_order, top) h_order = VRBT_INITIALIZER(&h_order);
static VRBT_HEAD(t_key, top) h_key = VRBT_INITIALIZER(&h_key);
static inline int
cmp_key(const struct top *a, const struct top *b)
......@@ -110,10 +110,10 @@ cmp_order(const struct top *a, const struct top *b)
return (cmp_key(a, b));
}
VRB_PROTOTYPE_STATIC(t_order, top, e_order, cmp_order)
VRB_GENERATE_STATIC(t_order, top, e_order, cmp_order)
VRB_PROTOTYPE_STATIC(t_key, top, e_key, cmp_key)
VRB_GENERATE_STATIC(t_key, top, e_key, cmp_key)
VRBT_PROTOTYPE_STATIC(t_order, top, e_order, cmp_order)
VRBT_GENERATE_STATIC(t_order, top, e_order, cmp_order)
VRBT_PROTOTYPE_STATIC(t_key, top, e_key, cmp_key)
VRBT_GENERATE_STATIC(t_key, top, e_key, cmp_key)
static int v_matchproto_(VSLQ_dispatch_f)
accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
......@@ -155,12 +155,12 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
t.rec_data = VSL_CDATA(tr->c->rec.ptr);
AZ(pthread_mutex_lock(&mtx));
tp = VRB_FIND(t_key, &h_key, &t);
tp = VRBT_FIND(t_key, &h_key, &t);
if (tp) {
VRB_REMOVE(t_order, &h_order, tp);
VRBT_REMOVE(t_order, &h_order, tp);
tp->count += 1.0;
/* Reinsert to rebalance */
VRB_INSERT(t_order, &h_order, tp);
VRBT_INSERT(t_order, &h_order, tp);
} else {
ntop++;
tp = calloc(1, sizeof *tp);
......@@ -172,8 +172,8 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
tp->rec_buf = strdup(t.rec_data);
tp->rec_data = tp->rec_buf;
AN(tp->rec_data);
VRB_INSERT(t_key, &h_key, tp);
VRB_INSERT(t_order, &h_order, tp);
VRBT_INSERT(t_key, &h_key, tp);
VRBT_INSERT(t_order, &h_order, tp);
}
AZ(pthread_mutex_unlock(&mtx));
......@@ -226,8 +226,8 @@ update(int p)
else
AC(mvprintw(0, len - 1, "%s", q));
AC(mvprintw(0, 0, "list length %u", ntop));
for (tp = VRB_MIN(t_order, &h_order); tp != NULL; tp = tp2) {
tp2 = VRB_NEXT(t_order, &h_order, tp);
for (tp = VRBT_MIN(t_order, &h_order); tp != NULL; tp = tp2) {
tp2 = VRBT_NEXT(t_order, &h_order, tp);
if (++l < LINES) {
len = tp->clen;
......@@ -243,8 +243,8 @@ update(int p)
continue;
tp->count += (1.0/3.0 - tp->count) / (double)n;
if (tp->count * 10 < t || l > LINES * 10) {
VRB_REMOVE(t_key, &h_key, tp);
VRB_REMOVE(t_order, &h_order, tp);
VRBT_REMOVE(t_key, &h_key, tp);
VRBT_REMOVE(t_order, &h_order, tp);
free(tp->rec_buf);
free(tp);
ntop--;
......@@ -316,8 +316,8 @@ static void
dump(void)
{
struct top *tp, *tp2;
for (tp = VRB_MIN(t_order, &h_order); tp != NULL; tp = tp2) {
tp2 = VRB_NEXT(t_order, &h_order, tp);
for (tp = VRBT_MIN(t_order, &h_order); tp != NULL; tp = tp2) {
tp2 = VRBT_NEXT(t_order, &h_order, tp);
printf("%9.2f %s %*.*s\n",
tp->count, VSL_tags[tp->tag],
tp->clen, tp->clen, tp->rec_data);
......
......@@ -142,9 +142,9 @@
///////////////////////////////////////////////////////////////////////
// <vtree.h>
-emacro(801, VRB_*) // goto considered bad
-esym(534, *_VRB_REMOVE) // ignore retval
-esym(534, *_VRB_INSERT) // ignore retval
-emacro(801, VRBT_*) // goto considered bad
-esym(534, *_VRBT_REMOVE) // ignore retval
-esym(534, *_VRBT_INSERT) // ignore retval
///////////////////////////////////////////////////////////////////////
// <vqueue.h>
......
This diff is collapsed.
......@@ -135,9 +135,9 @@ struct vslc_vtx {
struct vtx_key {
unsigned vxid;
VRB_ENTRY(vtx_key) entry;
VRBT_ENTRY(vtx_key) entry;
};
VRB_HEAD(vtx_tree, vtx_key);
VRBT_HEAD(vtx_tree, vtx_key);
struct vtx {
struct vtx_key key;
......@@ -222,8 +222,8 @@ vtx_keycmp(const struct vtx_key *a, const struct vtx_key *b)
return (0);
}
VRB_PROTOTYPE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp)
VRB_GENERATE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp)
VRBT_PROTOTYPE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp)
VRBT_GENERATE_STATIC(vtx_tree, vtx_key, entry, vtx_keycmp)
static enum vsl_status v_matchproto_(vslc_next_f)
vslc_raw_next(const struct VSL_cursor *cursor)
......@@ -549,7 +549,7 @@ vtx_retire(struct VSLQ *vslq, struct vtx **pvtx)
AZ(vtx->n_child);
AZ(vtx->n_descend);
vtx->n_childready = 0;
AN(VRB_REMOVE(vtx_tree, &vslq->tree, &vtx->key));
AN(VRBT_REMOVE(vtx_tree, &vslq->tree, &vtx->key));
vtx->key.vxid = 0;
vtx->flags = 0;
......@@ -594,7 +594,7 @@ vtx_lookup(const struct VSLQ *vslq, unsigned vxid)
AN(vslq);
lkey.vxid = vxid;
key = VRB_FIND(vtx_tree, &vslq->tree, &lkey);
key = VRBT_FIND(vtx_tree, &vslq->tree, &lkey);
if (key == NULL)
return (NULL);
CAST_OBJ_NOTNULL(vtx, (void *)key, VTX_MAGIC);
......@@ -611,7 +611,7 @@ vtx_add(struct VSLQ *vslq, unsigned vxid)
vtx = vtx_new(vslq);
AN(vtx);
vtx->key.vxid = vxid;
AZ(VRB_INSERT(vtx_tree, &vslq->tree, &vtx->key));
AZ(VRBT_INSERT(vtx_tree, &vslq->tree, &vtx->key));
VTAILQ_INSERT_TAIL(&vslq->incomplete, vtx, list_vtx);
vslq->n_outstanding++;
return (vtx);
......@@ -1080,7 +1080,7 @@ VSLQ_New(struct VSL_data *vsl, struct VSL_cursor **cp,
vslq->query = query;
/* Setup normal mode */
VRB_INIT(&vslq->tree);
VRBT_INIT(&vslq->tree);
VTAILQ_INIT(&vslq->ready);
VTAILQ_INIT(&vslq->incomplete);
VTAILQ_INIT(&vslq->shmrefs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment