Пример #1
0
static PHP_RINIT_FUNCTION(phalcon){

	php_phalcon_init_globals(PHALCON_VGLOBAL TSRMLS_CC);
	phalcon_init_interned_strings(TSRMLS_C);

	return SUCCESS;
}
Пример #2
0
static PHP_RINIT_FUNCTION(phalcon){

	zend_phalcon_globals *phalcon_globals_ptr = PHALCON_VGLOBAL;

	php_phalcon_init_globals(phalcon_globals_ptr TSRMLS_CC);
	phalcon_init_interned_strings(TSRMLS_C);

	phalcon_initialize_memory(phalcon_globals_ptr TSRMLS_CC);

	return SUCCESS;
}
Пример #3
0
static PHP_GINIT_FUNCTION(phalcon)
{
	phalcon_memory_entry *start;

	php_phalcon_init_globals(phalcon_globals TSRMLS_CC);

	start = (phalcon_memory_entry *) pecalloc(1, sizeof(phalcon_memory_entry), 1);
/* pecalloc() will take care of these members
	start->pointer      = 0;
	start->hash_pointer = 0;
	start->prev = NULL;
	start->next = NULL;
*/
	start->addresses       = pecalloc(24, sizeof(zval*), 1);
	start->capacity        = 24;
	start->hash_addresses  = pecalloc(8, sizeof(zval*), 1);
	start->hash_capacity   = 8;

	phalcon_globals->start_memory = start;
}
Пример #4
0
static PHP_GINIT_FUNCTION(phalcon)
{
	php_phalcon_init_globals(phalcon_globals TSRMLS_CC);
}
Пример #5
0
static PHP_RINIT_FUNCTION(phalcon){

	phalcon_memory_entry *start;
	zend_phalcon_globals *phalcon_globals_ptr = PHALCON_VGLOBAL;
	size_t i;

	php_phalcon_init_globals(phalcon_globals_ptr TSRMLS_CC);
	phalcon_init_interned_strings(TSRMLS_C);

	start = (phalcon_memory_entry *) pecalloc(num_preallocated_frames, sizeof(phalcon_memory_entry), 1);
/* pecalloc() will take care of these members for every frame
	start->pointer      = 0;
	start->hash_pointer = 0;
	start->prev = NULL;
	start->next = NULL;
*/
	for (i = 0; i < num_preallocated_frames; ++i) {
		start[i].addresses       = pecalloc(24, sizeof(zval*), 1);
		start[i].capacity        = 24;
		start[i].hash_addresses  = pecalloc(8, sizeof(zval*), 1);
		start[i].hash_capacity   = 8;

#ifndef PHALCON_RELEASE
		start[i].permanent = 1;
#endif
	}

	start[0].next = &start[1];
	start[num_preallocated_frames - 1].prev = &start[num_preallocated_frames - 2];

	for (i = 1; i < num_preallocated_frames - 1; ++i) {
		start[i].next = &start[i + 1];
		start[i].prev = &start[i - 1];
	}

	phalcon_globals_ptr->start_memory = start;
	phalcon_globals_ptr->end_memory   = start + num_preallocated_frames;

	phalcon_globals_ptr->fcache = pemalloc(sizeof(HashTable), 1);
#ifndef PHALCON_RELEASE
	zend_hash_init(phalcon_globals_ptr->fcache, 128, NULL, phalcon_fcall_cache_dtor, 1);
#else
	zend_hash_init(phalcon_globals_ptr->fcache, 128, NULL, NULL, 1);
#endif

	/* 'Allocator sizeof operand mismatch' warning can be safely ignored */
	ALLOC_INIT_ZVAL(phalcon_globals_ptr->z_null);
	Z_SET_REFCOUNT_P(phalcon_globals_ptr->z_null, 2);

	/* 'Allocator sizeof operand mismatch' warning can be safely ignored */
	ALLOC_INIT_ZVAL(phalcon_globals_ptr->z_false);
	Z_SET_REFCOUNT_P(phalcon_globals_ptr->z_false, 2);
	ZVAL_FALSE(phalcon_globals_ptr->z_false);

	/* 'Allocator sizeof operand mismatch' warning can be safely ignored */
	ALLOC_INIT_ZVAL(phalcon_globals_ptr->z_true);
	Z_SET_REFCOUNT_P(phalcon_globals_ptr->z_true, 2);
	ZVAL_TRUE(phalcon_globals_ptr->z_true);

	/* 'Allocator sizeof operand mismatch' warning can be safely ignored */
	ALLOC_INIT_ZVAL(phalcon_globals_ptr->z_zero);
	Z_SET_REFCOUNT_P(phalcon_globals_ptr->z_zero, 2);
	ZVAL_LONG(phalcon_globals_ptr->z_zero, 0);

	/* 'Allocator sizeof operand mismatch' warning can be safely ignored */
	ALLOC_INIT_ZVAL(phalcon_globals_ptr->z_one);
	Z_SET_REFCOUNT_P(phalcon_globals_ptr->z_one, 2);
	ZVAL_LONG(phalcon_globals_ptr->z_one, 1);

	return SUCCESS;
}