|
|
| version 1.1.1.1, 2012/02/21 23:47:52 | version 1.1.1.2, 2012/05/29 12:34:36 |
|---|---|
| Line 25 | Line 25 |
| ZEND_API int zend_stack_init(zend_stack *stack) | ZEND_API int zend_stack_init(zend_stack *stack) |
| { | { |
| stack->top = 0; | stack->top = 0; |
| stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE); | stack->max = 0; |
| if (!stack->elements) { | stack->elements = NULL; |
| return FAILURE; | return SUCCESS; |
| } else { | |
| stack->max = STACK_BLOCK_SIZE; | |
| return SUCCESS; | |
| } | |
| } | } |
| ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size) | ZEND_API int zend_stack_push(zend_stack *stack, const void *element, int size) |
| Line 100 ZEND_API int zend_stack_destroy(zend_stack *stack) | Line 96 ZEND_API int zend_stack_destroy(zend_stack *stack) |
| for (i = 0; i < stack->top; i++) { | for (i = 0; i < stack->top; i++) { |
| efree(stack->elements[i]); | efree(stack->elements[i]); |
| } | } |
| efree(stack->elements); | efree(stack->elements); |
| stack->elements = NULL; | |
| } | } |
| return SUCCESS; | return SUCCESS; |