summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2016-02-09 12:41:23 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-02-09 12:41:23 (GMT)
commitac197363fa8b345e464f4179c2a51fd37e89f1eb (patch) (side-by-side diff)
treebe39bc7a5aacd1e96bc3cf49a7fe732162ce018c
parent26ebbda9d6440498731ee6980945bfc0a18f6dc1 (diff)
downloadvmod-tbf-ac197363fa8b345e464f4179c2a51fd37e89f1eb.tar.gz
vmod-tbf-ac197363fa8b345e464f4179c2a51fd37e89f1eb.tar.bz2
Cleanup
* src/tbf.c: Use %zu to log size_t values; remove unused variables and functions.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/tbf.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/tbf.c b/src/tbf.c
index 211db79..a058f92 100644
--- a/src/tbf.c
+++ b/src/tbf.c
@@ -497,6 +497,7 @@ key_to_str(uint8_t key[], char *buf)
*buf = 0;
}
+#if 0
static void
node_to_keystr(struct node *node, char *buf)
{
@@ -505,6 +506,7 @@ node_to_keystr(struct node *node, char *buf)
else
*buf = 0;
}
+#endif
static void
node_dump_ord(struct node *node, FILE *fp)
@@ -559,7 +561,6 @@ static void
tree_dump_unlocked(struct tree *tree, char const *file)
{
struct node *node;
- char keybuf[3][2*SHA256_LEN+1];
FILE *fp;
int err = 0;
struct dump_header header;
@@ -656,7 +657,6 @@ tree_load_nodes(struct tree *tree, struct dump_header *hdr,
struct node **nodes, FILE *fp)
{
size_t i;
- uint32_t root_idx;
uint32_t ord[2];
size_t incomplete = 0;
@@ -763,7 +763,7 @@ tree_load_nodes(struct tree *tree, struct dump_header *hdr,
}
if (incomplete) {
- syslog(LOG_DAEMON|LOG_ERR, "tbf.%s: %lu incomplete nodes left",
+ syslog(LOG_DAEMON|LOG_ERR, "tbf.%s: %zu incomplete nodes left",
__FUNCTION__, incomplete);
return 1;
}
@@ -775,7 +775,7 @@ struct tree *
tree_load(char const *filename)
{
FILE *fp;
- struct tree *tree;
+ struct tree *tree = NULL;
int rc;
struct dump_header header;
@@ -849,6 +849,7 @@ tbf_init(struct vmod_priv *priv, const struct VCL_conf *vclconf)
{
tbf_tree = tree_create();
atexit(tbf_exit);
+ return 0;
}
VCL_VOID
@@ -1007,12 +1008,12 @@ log_node(struct node *node, void *data)
char kbuf[2*SHA256_LEN+1];
key_to_str(node->key, kbuf);
#ifdef DEBUG
- syslog(tc->prio, "%d: %p(%p,%p): %lu %s: %s", tc->num, node,
+ syslog(tc->prio, "%d: %p(%p,%p): %zu %s: %s", tc->num, node,
node->child[CHILD_LEFT], node->child[CHILD_RIGHT], node->ord,
kbuf,
node->keystr);
#else
- syslog(tc->prio, "%d: %p(%p,%p): %lu %s", tc->num, node,
+ syslog(tc->prio, "%d: %p(%p,%p): %zu %s", tc->num, node,
node->child[CHILD_LEFT], node->child[CHILD_RIGHT], node->ord,
kbuf);
#endif
@@ -1039,9 +1040,9 @@ vmod_log_stats(MOD_CTX ctx, VCL_INT prio)
struct tree *tree = tbf_get_tree();
tree_compute_stats(tree, &st);
tbf_release_tree(&tree);
- syslog(prio, "Number of nodes: %lu", st.num_nodes);
- syslog(prio, "Number of leaves: %lu", st.num_leaves);
- syslog(prio, "Shortest path: %lu", st.shortest_path);
- syslog(prio, "Longest path: %lu", st.longest_path);
+ syslog(prio, "Number of nodes: %zu", st.num_nodes);
+ syslog(prio, "Number of leaves: %zu", st.num_leaves);
+ syslog(prio, "Shortest path: %zu", st.shortest_path);
+ syslog(prio, "Longest path: %zu", st.longest_path);
syslog(prio, "Avg path: %f", st.avg_path);
}

Return to:

Send suggestions and report system problems to the System administrator.