Changeset 268 for trunk/utils.c
- Timestamp:
- 2006-10-29T03:05:01+01:00 (7 years ago)
- File:
-
- 1 edited
-
trunk/utils.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/utils.c
r264 r268 511 511 #define OG(x) (sandbox->orig_##x) 512 512 /* }}} */ 513 #ifdef ZEND_ENGINE_2_1 514 static zend_bool xc_auto_global_callback(char *name, uint name_len TSRMLS_DC) /* {{{ */ 515 { 516 zend_auto_global *auto_global; 517 if (zend_u_hash_find(CG(auto_globals), UG(unicode) ? IS_UNICODE : IS_STRING, ZSTR(name), name_len + 1, (void **) &auto_global) == FAILURE) { 518 return 1; 519 } 520 return 0; 521 } 522 /* }}} */ 523 static int xc_auto_global_arm(zend_auto_global *auto_global TSRMLS_DC) /* {{{ */ 524 { 525 if (auto_global->auto_global_callback) { 526 auto_global->armed = 1; 527 auto_global->auto_global_callback = xc_auto_global_callback; 528 } 529 else { 530 auto_global->armed = 0; 531 } 532 return ZEND_HASH_APPLY_KEEP; 533 } 534 /* }}} */ 535 #endif 513 536 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /* {{{ */ 514 537 { … … 535 558 EG(class_table) = CG(class_table); 536 559 560 #ifdef ZEND_ENGINE_2_1 561 OG(auto_globals) = CG(auto_globals); 562 CG(auto_globals) = &TG(auto_globals); 563 #endif 564 537 565 TG(included_files) = &EG(included_files); 538 566 … … 543 571 zend_hash_init_ex(&TG(function_table), 128, NULL, OG(function_table)->pDestructor, 0, 0); 544 572 zend_hash_init_ex(&TG(class_table), 16, NULL, OG(class_table)->pDestructor, 0, 0); 573 #ifdef ZEND_ENGINE_2_1 574 zend_hash_init_ex(&TG(auto_globals), 8, NULL, OG(auto_globals)->pDestructor, 0, 0); 575 { 576 zend_auto_global tmp_autoglobal; 577 578 zend_hash_copy(&TG(auto_globals), OG(auto_globals), NULL, (void *) &tmp_autoglobal, sizeof(tmp_autoglobal)); 579 zend_hash_apply(&TG(auto_globals), (apply_func_t) xc_auto_global_arm TSRMLS_CC); 580 } 581 #endif 545 582 546 583 sandbox->filename = filename; … … 592 629 b = b->pListNext; 593 630 } 631 632 #ifdef ZEND_ENGINE_2_1 633 /* trigger auto_globals jit */ 634 for (b = TG(auto_globals).pListHead; b != NULL; b = b->pListNext) { 635 zend_auto_global *auto_global = (zend_auto_global *) b->pData; 636 /* check if actived */ 637 if (auto_global->auto_global_callback && !auto_global->armed) { 638 zend_u_is_auto_global(BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), auto_global->name_len TSRMLS_CC); 639 } 640 } 641 #endif 642 594 643 xc_undo_pass_two(CG(active_op_array) TSRMLS_CC); 595 644 xc_foreach_early_binding_class(CG(active_op_array), xc_early_binding_cb, (void *) sandbox TSRMLS_CC); … … 609 658 CG(class_table) = OG(class_table); 610 659 EG(class_table) = CG(class_table); 660 #ifdef ZEND_ENGINE_2_1 661 CG(auto_globals) = OG(auto_globals); 662 #endif 611 663 612 664 if (install) { … … 624 676 TG(function_table).pDestructor = NULL; 625 677 TG(class_table).pDestructor = NULL; 678 #ifdef ZEND_ENGINE_2_1 679 TG(auto_globals).pDestructor = NULL; 680 #endif 626 681 } 627 682 … … 632 687 zend_hash_destroy(&TG(function_table)); 633 688 zend_hash_destroy(&TG(class_table)); 689 #ifdef ZEND_ENGINE_2_1 690 zend_hash_destroy(&TG(auto_globals)); 691 #endif 634 692 zend_hash_destroy(TG(included_files)); 635 693
Note: See TracChangeset
for help on using the changeset viewer.

