From 3cfae6cfce9c591923864fe13c560c145469bc9c Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 25 Oct 2001 13:08:29 +0000 Subject: [PATCH] o Remove a couple of warnings, and one bug in ttree. Spotted by the optimiser --- lib/config/config.c | 4 ++-- lib/format1/format1.c | 2 +- lib/regex/ttree.c | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/config/config.c b/lib/config/config.c index 815d5388a..51b869beb 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -231,7 +231,7 @@ int write_config(struct config_file *cf, const char *file) */ static struct config_node *_file(struct parser *p) { - struct config_node *root = 0, *n, *l; + struct config_node *root = NULL, *n, *l = NULL; while (p->t != TOK_EOF) { if (!(n = _section(p))) { stack; @@ -250,7 +250,7 @@ static struct config_node *_file(struct parser *p) static struct config_node *_section(struct parser *p) { /* IDENTIFIER '{' VALUE* '}' */ - struct config_node *root, *n, *l; + struct config_node *root, *n, *l = NULL; if (!(root = _create_node(p))) { stack; return 0; diff --git a/lib/format1/format1.c b/lib/format1/format1.c index f9db6016d..1c7167f85 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -16,7 +16,7 @@ static int _check_vgs(struct list_head *pvs) { struct list_head *tmp; - struct disk_list *dl; + struct disk_list *dl = NULL; struct disk_list *first = NULL; int pv_count = 0; diff --git a/lib/regex/ttree.c b/lib/regex/ttree.c index c9307d57e..90436dc5e 100644 --- a/lib/regex/ttree.c +++ b/lib/regex/ttree.c @@ -67,11 +67,13 @@ int ttree_insert(struct ttree *tt, unsigned int *key, void *data) int count = tt->klen; unsigned int k; - while (*c && count) { + do { k = *key++; c = _lookup_single(c, k); count--; - } + + } while (*c && count); + if (!*c) { count++;