Changeset 378
- Timestamp:
- 2007-05-07T19:21:35+02:00 (6 years ago)
- Location:
- branches/1.2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2
-
branches/1.2/NEWS
r377 r378 8 8 * #86: remove/edit variable in admin page 9 9 * fixed #77: hits/misses was not updated 10 * fixed #59: pass by reference for internal function was broken 10 11 * fixed #56: xcache_set segfaults when xcache.var_size=0 11 12 -
branches/1.2/utils.c
r295 r378 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 … … 534 536 /* }}} */ 535 537 #endif 538 539 void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce)) 540 { 541 #ifdef ZEND_ENGINE_2 542 (*ce)->refcount++; 543 #else 544 (*ce->refcount)++; 545 #endif 546 } 547 536 548 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /* {{{ */ 537 549 { 538 550 HashTable *h; 551 539 552 if (sandbox) { 540 553 memset(sandbox, 0, sizeof(sandbox[0])); … … 573 586 h = OG(function_table); 574 587 zend_hash_init_ex(&TG(function_table), 128, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 588 { 589 zend_function tmp_func; 590 zend_hash_copy(&TG(function_table), &XG(internal_function_table), (copy_ctor_func_t) function_add_ref, (void *) &tmp_func, sizeof(tmp_func)); 591 } 592 TG(internal_class_tail) = TG(function_table).pListTail; 593 575 594 h = OG(class_table); 576 595 zend_hash_init_ex(&TG(class_table), 16, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 596 #if 0 && TODO 597 { 598 xc_cest_t tmp_cest; 599 zend_hash_copy(&TG(class_table), &XG(internal_class_table), (copy_ctor_func_t) xc_zend_class_add_ref, (void *) &tmp_cest, sizeof(tmp_cest)); 600 } 601 #endif 602 TG(internal_class_tail) = TG(class_table).pListTail; 603 577 604 #ifdef ZEND_ENGINE_2_1 578 605 /* shallow copy, don't destruct */ … … 619 646 #endif 620 647 621 b = TG( function_table).pListHead;648 b = TG(internal_function_tail) ? TG(internal_function_tail)->pListNext : TG(function_table).pListHead; 622 649 /* install function */ 623 650 while (b != NULL) { … … 628 655 } 629 656 630 b = TG( class_table).pListHead;657 b = TG(internal_class_tail) ? TG(internal_class_tail)->pListNext : TG(class_table).pListHead; 631 658 /* install class */ 632 659 while (b != NULL) { -
branches/1.2/utils.h
r268 r378 53 53 HashTable tmp_class_table; 54 54 HashTable tmp_auto_globals; 55 Bucket *tmp_internal_function_tail; 56 Bucket *tmp_internal_class_tail; 55 57 } xc_sandbox_t; 56 58 59 void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce)); 57 60 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC); 58 61 void xc_sandbox_free(xc_sandbox_t *sandbox, int install TSRMLS_DC); -
branches/1.2/xcache.c
r377 r378 1023 1023 Bucket *b; 1024 1024 unsigned int i; 1025 unsigned int j; 1025 1026 1026 1027 #define COPY_H(vartype, var, cnt, name, datatype) do { \ 1027 for (i = 0 ; b; i ++, b = b->pListNext) {\1028 vartype *data = &php .var[i];\1028 for (i = 0, j = 0; b; i ++, b = b->pListNext) { \ 1029 vartype *data = &php->var[j]; \ 1029 1030 \ 1030 1031 if (i < old_##cnt) { \ 1031 1032 continue; \ 1032 1033 } \ 1034 j ++; \ 1033 1035 \ 1034 1036 assert(i < old_##cnt + php.cnt); \ … … 1443 1445 int i; 1444 1446 1447 if (XG(internal_function_table).nTableSize == 0) { 1448 zend_function tmp_func; 1449 xc_cest_t tmp_cest; 1450 1451 zend_hash_init_ex(&XG(internal_function_table), 100, NULL, NULL, 1, 0); 1452 zend_hash_copy(&XG(internal_function_table), CG(function_table), (copy_ctor_func_t) function_add_ref, &tmp_func, sizeof(tmp_func)); 1453 1454 zend_hash_init_ex(&XG(internal_class_table), 10, NULL, NULL, 1, 0); 1455 zend_hash_copy(&XG(internal_class_table), CG(class_table), (copy_ctor_func_t) xc_zend_class_add_ref, &tmp_cest, sizeof(tmp_cest)); 1456 } 1445 1457 if (xc_php_hcache.size && !XG(php_holds)) { 1446 1458 XG(php_holds) = calloc(xc_php_hcache.size, sizeof(xc_stack_t)); … … 1516 1528 xcache_globals->var_holds = NULL; 1517 1529 } 1530 1531 zend_hash_destroy(&xcache_globals->internal_function_table); 1532 zend_hash_destroy(&xcache_globals->internal_class_table); 1518 1533 } 1519 1534 /* }}} */ -
branches/1.2/xcache_globals.h
r367 r378 16 16 long var_ttl; 17 17 zend_bool auth_enabled; 18 19 HashTable internal_function_table; 20 HashTable internal_class_table; 18 21 ZEND_END_MODULE_GLOBALS(xcache) 19 22
Note: See TracChangeset
for help on using the changeset viewer.

