summaryrefslogtreecommitdiff
path: root/mysys/lf_hash.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
committerSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
commit65ca700def99289cc31a7040537f5aa6e12bf485 (patch)
tree97b3a07299b626c519da0e80c122b5b79b933914 /mysys/lf_hash.c
parent2ab57de38d13d927ddff2d51aed4af34e13998f5 (diff)
parent6e5bcca7935d3c62f84bb640e5357664a210ee12 (diff)
downloadmariadb-git-65ca700def99289cc31a7040537f5aa6e12bf485.tar.gz
merge.
checkpoint. does not compile.
Diffstat (limited to 'mysys/lf_hash.c')
-rw-r--r--mysys/lf_hash.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index e7bf82fc6ca..2c89f5ca7ca 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -41,6 +41,8 @@ typedef struct {
*/
} LF_SLIST;
+const int LF_HASH_OVERHEAD= sizeof(LF_SLIST);
+
/*
a structure to pass the context (pointers two the three successive elements
in a list) from lfind to linsert/ldelete
@@ -121,8 +123,8 @@ retry:
we found a deleted node - be nice, help the other thread
and remove this deleted node
*/
- if (my_atomic_casptr((void **)cursor->prev,
- (void **)&cursor->curr, cursor->next))
+ if (my_atomic_casptr((void **) cursor->prev,
+ (void **)(char*) &cursor->curr, cursor->next))
_lf_alloc_free(pins, cursor->curr);
else
{
@@ -168,7 +170,8 @@ static LF_SLIST *linsert(LF_SLIST * volatile *head, CHARSET_INFO *cs,
node->link= (intptr)cursor.curr;
DBUG_ASSERT(node->link != (intptr)node); /* no circular references */
DBUG_ASSERT(cursor.prev != &node->link); /* no circular references */
- if (my_atomic_casptr((void **)cursor.prev, (void **)&cursor.curr, node))
+ if (my_atomic_casptr((void **) cursor.prev,
+ (void **)(char*) &cursor.curr, node))
{
res= 1; /* inserted ok */
break;
@@ -215,13 +218,13 @@ static int ldelete(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
else
{
/* mark the node deleted */
- if (my_atomic_casptr((void **)&(cursor.curr->link),
- (void **)&cursor.next,
+ if (my_atomic_casptr((void **) (char*) &(cursor.curr->link),
+ (void **) (char*) &cursor.next,
(void *)(((intptr)cursor.next) | 1)))
{
/* and remove it from the list */
if (my_atomic_casptr((void **)cursor.prev,
- (void **)&cursor.curr, cursor.next))
+ (void **)(char*)&cursor.curr, cursor.next))
_lf_alloc_free(pins, cursor.curr);
else
{
@@ -490,7 +493,7 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
my_free(dummy);
dummy= cur;
}
- my_atomic_casptr((void **)node, (void **)&tmp, dummy);
+ my_atomic_casptr((void **)node, (void **)(char*) &tmp, dummy);
/*
note that if the CAS above failed (after linsert() succeeded),
it would mean that some other thread has executed linsert() for