Changeset 344
Legend:
- Unmodified
- Added
- Removed
-
trunk/utils.c
r305 r344 1 1 2 2 #include "xcache.h" 3 #include "stack.h" 4 #include "xcache_globals.h" 3 5 #include "utils.h" 4 6 #ifdef ZEND_ENGINE_2_1 … … 531 533 { 532 534 HashTable *h; 535 zend_function tmp_func; 536 xc_cest_t tmp_cest; 537 533 538 if (sandbox) { 534 539 memset(sandbox, 0, sizeof(sandbox[0])); … … 567 572 h = OG(function_table); 568 573 zend_hash_init_ex(&TG(function_table), 128, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 574 zend_hash_copy(&TG(function_table), &XG(internal_function_table), NULL, (void *) &tmp_func, sizeof(tmp_func)); 575 TG(internal_class_tail) = TG(function_table).pListTail; 576 569 577 h = OG(class_table); 570 578 zend_hash_init_ex(&TG(class_table), 16, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 579 zend_hash_copy(&TG(class_table), &XG(internal_class_table), NULL, (void *) &tmp_cest, sizeof(tmp_cest)); 580 TG(internal_class_tail) = TG(class_table).pListTail; 581 571 582 #ifdef ZEND_ENGINE_2_1 572 583 /* shallow copy, don't destruct */ … … 613 624 #endif 614 625 615 b = TG( function_table).pListHead;626 b = TG(internal_function_tail) ? TG(internal_function_tail)->pListNext : TG(function_table).pListHead; 616 627 /* install function */ 617 628 while (b != NULL) { … … 622 633 } 623 634 624 b = TG( class_table).pListHead;635 b = TG(internal_class_tail) ? TG(internal_class_tail)->pListNext : TG(class_table).pListHead; 625 636 /* install class */ 626 637 while (b != NULL) { -
trunk/utils.h
r305 r344 71 71 HashTable tmp_class_table; 72 72 HashTable tmp_auto_globals; 73 Bucket *tmp_internal_function_tail; 74 Bucket *tmp_internal_class_tail; 73 75 } xc_sandbox_t; 74 76 -
trunk/xcache.c
r341 r344 1025 1025 Bucket *b; 1026 1026 unsigned int i; 1027 unsigned int j; 1027 1028 1028 1029 #define COPY_H(vartype, var, cnt, name, datatype) do { \ 1029 for (i = 0 ; b; i ++, b = b->pListNext) {\1030 vartype *data = &php->var[ i]; \1030 for (i = 0, j = 0; b; i ++, b = b->pListNext) { \ 1031 vartype *data = &php->var[j]; \ 1031 1032 \ 1032 1033 if (i < old_##cnt) { \ 1033 1034 continue; \ 1034 1035 } \ 1036 j ++; \ 1035 1037 \ 1036 1038 assert(i < old_##cnt + php->cnt); \ … … 1603 1605 int i; 1604 1606 1607 if (XG(internal_function_table).nTableSize == 0) { 1608 zend_function tmp_func; 1609 xc_cest_t tmp_cest; 1610 1611 zend_hash_init_ex(&XG(internal_function_table), 100, NULL, NULL, 1, 0); 1612 zend_hash_copy(&XG(internal_function_table), CG(function_table), NULL, &tmp_func, sizeof(tmp_func)); 1613 1614 zend_hash_init_ex(&XG(internal_class_table), 10, NULL, NULL, 1, 0); 1615 zend_hash_copy(&XG(internal_class_table), CG(class_table), NULL, &tmp_cest, sizeof(tmp_cest)); 1616 } 1605 1617 if (xc_php_hcache.size && !XG(php_holds)) { 1606 1618 XG(php_holds) = calloc(xc_php_hcache.size, sizeof(xc_stack_t)); … … 1676 1688 xcache_globals->var_holds = NULL; 1677 1689 } 1690 1691 zend_hash_destroy(&xcache_globals->internal_function_table); 1692 zend_hash_destroy(&xcache_globals->internal_class_table); 1678 1693 } 1679 1694 /* }}} */ -
trunk/xcache_globals.h
r204 r344 15 15 time_t request_time; 16 16 long var_ttl; 17 18 HashTable internal_function_table; 19 HashTable internal_class_table; 17 20 ZEND_END_MODULE_GLOBALS(xcache) 18 21

