[svn:parrot] r47160 - branches/gc_massacre/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun May 30 14:57:15 UTC 2010
Author: bacek
Date: Sun May 30 14:57:15 2010
New Revision: 47160
URL: https://trac.parrot.org/parrot/changeset/47160
Log:
Fix Pool_Allocator.is_owned slighly by almost copy logic from contained_in_pool
Modified:
branches/gc_massacre/src/gc/pool_allocator.c
Modified: branches/gc_massacre/src/gc/pool_allocator.c
==============================================================================
--- branches/gc_massacre/src/gc/pool_allocator.c Sun May 30 14:56:52 2010 (r47159)
+++ branches/gc_massacre/src/gc/pool_allocator.c Sun May 30 14:57:15 2010 (r47160)
@@ -166,13 +166,19 @@
PARROT_EXPORT
int
-Parrot_gc_pool_is_owned(ARGMOD(Pool_Allocator *pool), ARGMOD(void *data))
+Parrot_gc_pool_is_owned(ARGMOD(Pool_Allocator *pool), ARGMOD(void *ptr))
{
ASSERT_ARGS(Parrot_gc_pool_is_owned)
Pool_Allocator_Arena *arena = pool->top_arena;
while (arena) {
- if (((char*)data - (char*)arena) < GC_FIXED_SIZE_POOL_SIZE)
+ const ptrdiff_t ptr_diff =
+ (ptrdiff_t)ptr - (ptrdiff_t)(arena + sizeof (Pool_Allocator_Arena));
+
+ if (0 <= ptr_diff
+ && ptr_diff < GC_FIXED_SIZE_POOL_SIZE // It's wrong check.
+ ) //&& ptr_diff % pool->attr_size == 0)
return 1;
+
arena = arena->prev;
}
More information about the parrot-commits
mailing list