All of lore.kernel.org
 help / color / mirror / Atom feed
From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/datastruct btree.c
Date: 8 Apr 2011 14:14:58 -0000	[thread overview]
Message-ID: <20110408141458.10572.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac at 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))))



                 reply	other threads:[~2011-04-08 14:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110408141458.10572.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.