summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysys/lf_alloc-pin.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c
index 51c4df7c94a..e89e071d8bd 100644
--- a/mysys/lf_alloc-pin.c
+++ b/mysys/lf_alloc-pin.c
@@ -318,9 +318,9 @@ static int match_pins(LF_PINS *el, void *addr)
}
#if STACK_DIRECTION < 0
-#define available_stack_size(END,CUR) (long) ((char*)(CUR) - (char*)(END))
+#define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END))
#else
-#define available_stack_size(END,CUR) (long) ((char*)(END) - (char*)(CUR))
+#define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR))
#endif
/*
@@ -413,15 +413,16 @@ LF_REQUIRE_PINS(1);
first->el->el->....->el->last. Use first==last to free only one element.
*/
static void alloc_free(struct st_lf_alloc_node *first,
- struct st_lf_alloc_node *last,
+ struct st_lf_alloc_node volatile *last,
LF_ALLOCATOR *allocator)
{
- struct st_lf_alloc_node *tmp;
+ struct st_lf_alloc_node * volatile tmp;
tmp= allocator->top;
do
{
last->next= tmp;
- } while (!my_atomic_casptr((void **)&allocator->top, (void **)&tmp, first) &&
+ } while (!my_atomic_casptr((void **)(char *)&allocator->top,
+ (void **)(char *)&tmp, first) &&
LF_BACKOFF);
}
@@ -494,12 +495,13 @@ void *_lf_alloc_new(LF_PINS *pins)
{
node= (void *)my_malloc(allocator->element_size, MYF(MY_WME));
#ifdef MY_LF_EXTRA_DEBUG
- if (likely(node))
+ if (likely(node != 0))
my_atomic_add32(&allocator->mallocs, 1);
#endif
break;
}
- if (my_atomic_casptr((void **)&allocator->top, (void *)&node, node->next))
+ if (my_atomic_casptr((void **)(char *)&allocator->top,
+ (void *)&node, node->next))
break;
}
_lf_unpin(pins, 0);