public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/datastruct btree.c
@ 2011-04-08 14:14 zkabelac
0 siblings, 0 replies; only message in thread
From: zkabelac @ 2011-04-08 14:14 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-04-08 14:14:58
Modified files:
lib/datastruct : btree.c
Log message:
Better const cast logic
(although still gcc gives const violation warning)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/datastruct/btree.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
--- LVM2/lib/datastruct/btree.c 2010/12/20 13:19:13 1.14
+++ LVM2/lib/datastruct/btree.c 2011/04/08 14:14:57 1.15
@@ -55,7 +55,7 @@
#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 @@
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))))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-08 14:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-08 14:14 LVM2/lib/datastruct btree.c zkabelac
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).