Author: Whiteknight
Date: Thu Aug 7 17:55:36 2008
New Revision: 30113
Modified:
branches/gsoc_pdd09/include/parrot/headers.h
branches/gsoc_pdd09/src/headers.c
Log:
[gsoc_pdd09] add a new macro to help with indexing into the sized_header_pools
array. may or may not actually fix anything.
Modified: branches/gsoc_pdd09/include/parrot/headers.h
==============================================================================
--- branches/gsoc_pdd09/include/parrot/headers.h (original)
+++ branches/gsoc_pdd09/include/parrot/headers.h Thu Aug 7 17:55:36 2008
@@ -28,6 +28,8 @@
# define BUFFER_ALIGNMENT 8
#endif
+#define SIZED_POOL_INDEX(s) ((s) / sizeof(void *))
+
#define BUFFER_ALIGN_1 (BUFFER_ALIGNMENT - 1)
#define BUFFER_ALIGN_MASK ~BUFFER_ALIGN_1
Modified: branches/gsoc_pdd09/src/headers.c
==============================================================================
--- branches/gsoc_pdd09/src/headers.c (original)
+++ branches/gsoc_pdd09/src/headers.c Thu Aug 7 17:55:36 2008
@@ -252,7 +252,7 @@
Small_Object_Pool **sized_pools =
interp->arena_base->sized_header_pools;
- const UINTVAL idx = (buffer_size - sizeof (Buffer)) / sizeof (void *);
+ const UINTVAL idx = SIZED_POOL_INDEX(buffer_size);
/* Expand the array of sized resource pools, if necessary */
if (num_old <= idx) {
@@ -296,7 +296,7 @@
Small_Object_Pool ** const sized_pools =
interp->arena_base->sized_header_pools;
- return sized_pools[ (buffer_size - sizeof (Buffer)) / sizeof (void *) ];
+ return sized_pools[ SIZED_POOL_INDEX(buffer_size) ];
}
/*