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