diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2011-04-08 14:14:57 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2011-04-08 14:14:57 +0000 |
commit | 040cdff1d4cdffe026bbbd04cfaa93b2ffc15302 (patch) | |
tree | 07d9ef0b6214e1ca37d090a35ce4041e73a447ce /lib/datastruct | |
parent | 45109d497c7aa7c3359588771148f536001e1e10 (diff) | |
download | lvm2-040cdff1d4cdffe026bbbd04cfaa93b2ffc15302.tar.gz |
Better const cast logic
(although still gcc gives const violation warning)
Diffstat (limited to 'lib/datastruct')
-rw-r--r-- | lib/datastruct/btree.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/datastruct/btree.c b/lib/datastruct/btree.c index bfcdca604..9942f1a66 100644 --- a/lib/datastruct/btree.c +++ b/lib/datastruct/btree.c @@ -55,7 +55,7 @@ static uint32_t _shuffle(uint32_t k) #endif } -static struct node **_lookup(struct node *const *c, uint32_t key, +static struct node *const *_lookup(struct node *const *c, uint32_t key, struct node **p) { *p = NULL; @@ -71,20 +71,20 @@ static struct node **_lookup(struct node *const *c, uint32_t key, c = &(*c)->r; } - return (struct node **)c; + return c; } void *btree_lookup(const struct btree *t, uint32_t k) { uint32_t key = _shuffle(k); - struct node *p, **c = _lookup(&t->root, key, &p); + struct node *p, *const *c = _lookup(&t->root, key, &p); return (*c) ? (*c)->data : NULL; } int btree_insert(struct btree *t, uint32_t k, void *data) { uint32_t key = _shuffle(k); - struct node *p, **c = _lookup(&t->root, key, &p), *n; + struct node *p, **c = (struct node **) _lookup(&t->root, key, &p), *n; if (!*c) { if (!(n = dm_pool_alloc(t->mem, sizeof(*n)))) |