version 1.1.1.1, 2012/02/21 23:47:52
|
version 1.1.1.2, 2012/05/29 12:34:36
|
Line 46 END_EXTERN_C()
|
Line 46 END_EXTERN_C()
|
#define ZEND_PTR_STACK_RESIZE_IF_NEEDED(stack, count) \ |
#define ZEND_PTR_STACK_RESIZE_IF_NEEDED(stack, count) \ |
if (stack->top+count > stack->max) { \ |
if (stack->top+count > stack->max) { \ |
/* we need to allocate more memory */ \ |
/* we need to allocate more memory */ \ |
stack->max *= 2; \ | do { \ |
stack->max += count; \ | stack->max += PTR_STACK_BLO stack->max += PTR_STACK_BLOCK_SIZE; \ |
| } while (stack->top+count > stack->max); \ |
stack->elements = (void **) perealloc(stack->elements, (sizeof(void *) * (stack->max)), stack->persistent); \ |
stack->elements = (void **) perealloc(stack->elements, (sizeof(void *) * (stack->max)), stack->persistent); \ |
stack->top_element = stack->elements+stack->top; \ |
stack->top_element = stack->elements+stack->top; \ |
} |
} |
|
|
/* Not doing this with a macro because of the loop unrolling in the element assignment. |
/* Not doing this with a macro because of the loop unrolling in the element assignment. |
Just using a macro for 3 in the body for readability sake. */ |
Just using a macro for 3 in the body for readability sake. */ |
static inline void zend_ptr_stack_3_push(zend_ptr_stack *stack, void *a, void *b, void *c) | static zend_always_inline void zend_ptr_stack_3_push(zend_ptr_stack *stack, void *a, void *b, void *c) |
{ |
{ |
#define ZEND_PTR_STACK_NUM_ARGS 3 |
#define ZEND_PTR_STACK_NUM_ARGS 3 |
|
|
Line 68 static inline void zend_ptr_stack_3_push(zend_ptr_stac
|
Line 69 static inline void zend_ptr_stack_3_push(zend_ptr_stac
|
#undef ZEND_PTR_STACK_NUM_ARGS |
#undef ZEND_PTR_STACK_NUM_ARGS |
} |
} |
|
|
static inline void zend_ptr_stack_2_push(zend_ptr_stack *stack, void *a, void *b) | static zend_always_inline void zend_ptr_stack_2_push(zend_ptr_stack *stack, void *a, void *b) |
{ |
{ |
#define ZEND_PTR_STACK_NUM_ARGS 2 |
#define ZEND_PTR_STACK_NUM_ARGS 2 |
|
|
Line 81 static inline void zend_ptr_stack_2_push(zend_ptr_stac
|
Line 82 static inline void zend_ptr_stack_2_push(zend_ptr_stac
|
#undef ZEND_PTR_STACK_NUM_ARGS |
#undef ZEND_PTR_STACK_NUM_ARGS |
} |
} |
|
|
static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **b, void **c) | static zend_always_inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **b, void **c) |
{ |
{ |
*a = *(--stack->top_element); |
*a = *(--stack->top_element); |
*b = *(--stack->top_element); |
*b = *(--stack->top_element); |
Line 89 static inline void zend_ptr_stack_3_pop(zend_ptr_stack
|
Line 90 static inline void zend_ptr_stack_3_pop(zend_ptr_stack
|
stack->top -= 3; |
stack->top -= 3; |
} |
} |
|
|
static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b) | static zend_always_inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b) |
{ |
{ |
*a = *(--stack->top_element); |
*a = *(--stack->top_element); |
*b = *(--stack->top_element); |
*b = *(--stack->top_element); |
stack->top -= 2; |
stack->top -= 2; |
} |
} |
|
|
static inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr) | static zend_always_inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr) |
{ |
{ |
ZEND_PTR_STACK_RESIZE_IF_NEEDED(stack, 1) |
ZEND_PTR_STACK_RESIZE_IF_NEEDED(stack, 1) |
|
|
Line 104 static inline void zend_ptr_stack_push(zend_ptr_stack
|
Line 105 static inline void zend_ptr_stack_push(zend_ptr_stack
|
*(stack->top_element++) = ptr; |
*(stack->top_element++) = ptr; |
} |
} |
|
|
static inline void *zend_ptr_stack_pop(zend_ptr_stack *stack) | static zend_always_inline void *zend_ptr_stack_pop(zend_ptr_stack *stack) |
{ |
{ |
stack->top--; |
stack->top--; |
return *(--stack->top_element); |
return *(--stack->top_element); |