本文整理汇总了C++中TSRMLS_FETCH函数的典型用法代码示例。如果您正苦于以下问题:C++ TSRMLS_FETCH函数的具体用法?C++ TSRMLS_FETCH怎么用?C++ TSRMLS_FETCH使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TSRMLS_FETCH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: php_phpdbg_destroy_bp_condition
static void php_phpdbg_destroy_bp_condition(void *data) /* {{{ */
{
phpdbg_breakcond_t *brake = (phpdbg_breakcond_t*) data;
if (brake) {
if (brake->ops) {
TSRMLS_FETCH();
destroy_op_array(
brake->ops TSRMLS_CC);
efree(brake->ops);
}
efree((char*)brake->code);
}
} /* }}} */
示例2: msgpack_init_globals
static void msgpack_init_globals(zend_msgpack_globals *msgpack_globals)
{
TSRMLS_FETCH();
if (PG(display_errors))
{
msgpack_globals->error_display = 1;
}
else
{
msgpack_globals->error_display = 0;
}
msgpack_globals->php_only = 1;
}
示例3: himote_info_write_wrapper
static int himote_info_write_wrapper(const char *str, uint str_length)
{
int new_len, written;
char *elem_esc;
TSRMLS_FETCH();
elem_esc = himote_escape_html_entities((unsigned char *)str, str_length, &new_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
written = himote_body_write(elem_esc, new_len TSRMLS_CC);
efree(elem_esc);
return written;
}
示例4: createObject
// Create a PHP object given a typename and call the ctor, optionally passing up to 2 arguments
void createObject(char* obj_typename, zval* return_value, int nargs = 0, zval* arg1 = NULL, zval* arg2 = NULL) {
TSRMLS_FETCH();
size_t obj_typename_len = strlen(obj_typename);
zend_class_entry* ce = zend_fetch_class(obj_typename, obj_typename_len, ZEND_FETCH_CLASS_DEFAULT TSRMLS_CC);
if (! ce) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", obj_typename);
RETURN_NULL();
}
object_and_properties_init(return_value, ce, NULL);
zend_function* constructor = zend_std_get_constructor(return_value TSRMLS_CC);
zval* ctor_rv = NULL;
zend_call_method(&return_value, ce, &constructor, NULL, 0, &ctor_rv, nargs, arg1, arg2 TSRMLS_CC);
zval_ptr_dtor(&ctor_rv);
}
示例5: php_rl_callback_handler
static void php_rl_callback_handler(char *the_line)
{
zval *params[1];
zval dummy;
TSRMLS_FETCH();
ZVAL_NULL(&dummy);
params[0] = _readline_string_zval(the_line);
call_user_function(CG(function_table), NULL, _prepped_callback, &dummy, 1, params TSRMLS_CC);
zval_ptr_dtor(¶ms[0]);
zval_dtor(&dummy);
}
示例6: assert
void ZendObjectStore::freeObject(zend_object_handle handle) {
zend_object_store_bucket & bucket = m_store.at(handle);
assert(bucket.valid);
auto & obj = bucket.bucket.obj;
if (obj.free_storage) {
TSRMLS_FETCH();
HPHP::JIT::VMRegAnchor _;
obj.free_storage(obj.object TSRMLS_CC);
}
bucket.bucket.free_list.next = m_free_list_head;
m_free_list_head = handle;
bucket.valid = 0;
}
示例7: TSRMLS_FETCH
/**
* Constructor
*
* The constructor receives a filename as parameter. It uses the normal
* PHP include path resolve algorithms to find the location of the file.
*
* @param name the filename
* @param size length of the filename
*/
File::File(const char *name, size_t size)
{
// we need the tsrm_ls variable
TSRMLS_FETCH();
// resolve the path
_path = zend_resolve_path(name, size TSRMLS_CC);
// the resolve-path function sometimes returns the original pointer, we
// do not want that because we may have to store the pathname in this object
if (_path != name) return;
// make a full copy of the pathname
_path = estrndup(name, size);
}
示例8: file_magwarn
/*VARARGS*/
protected void
file_magwarn(struct magic_set *ms, const char *f, ...)
{
va_list va;
char *expanded_format;
TSRMLS_FETCH();
va_start(va, f);
vasprintf(&expanded_format, f, va);
va_end(va);
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
free(expanded_format);
}
示例9: zend_accel_destroy_zend_function
static void zend_accel_destroy_zend_function(zval *zv)
{
zend_function *function = Z_PTR_P(zv);
TSRMLS_FETCH();
if (function->type == ZEND_USER_FUNCTION) {
if (function->op_array.static_variables) {
FREE_HASHTABLE(function->op_array.static_variables);
function->op_array.static_variables = NULL;
}
}
destroy_zend_function(function TSRMLS_CC);
}
示例10: php_info_printf
static int php_info_printf(const char *fmt, ...) /* {{{ */
{
char *buf;
int len, written;
va_list argv;
TSRMLS_FETCH();
va_start(argv, fmt);
len = vspprintf(&buf, 0, fmt, argv);
va_end(argv);
written = php_output_write(buf, len TSRMLS_CC);
efree(buf);
return written;
}
示例11: zend_list_insert
ZEND_API int zend_list_insert(void *ptr, int type)
{
int index;
zend_rsrc_list_entry le;
TSRMLS_FETCH();
le.ptr=ptr;
le.type=type;
le.refcount=1;
index = zend_hash_next_free_element(&EG(regular_list));
zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL);
return index;
}
示例12: construct_with_zval
void construct_with_zval(zval* _p, size_t _buffer_size) {
buffer = reinterpret_cast<char*>(emalloc(_buffer_size));
buffer_ptr = buffer;
buffer_used = 0;
buffer_size = _buffer_size;
p = _p;
// Get the transport for the passed protocol
zval gettransport;
ZVAL_STRING(&gettransport, "getTransport", 0);
MAKE_STD_ZVAL(t);
ZVAL_NULL(t);
TSRMLS_FETCH();
call_user_function(EG(function_table), &p, &gettransport, t, 0, NULL TSRMLS_CC);
}
示例13: TSRMLS_FETCH
DIR *opendir(const char *dir)
{
DIR *dp;
char *filespec;
HANDLE handle;
int index;
char resolved_path_buff[MAXPATHLEN];
TSRMLS_FETCH();
if (!VCWD_REALPATH(dir, resolved_path_buff)) {
return NULL;
}
filespec = (char *)malloc(strlen(resolved_path_buff) + 2 + 1);
if (filespec == NULL) {
return NULL;
}
strcpy(filespec, resolved_path_buff);
index = (int)strlen(filespec) - 1;
if (index >= 0 && (filespec[index] == '/' ||
(filespec[index] == '\\' && (index == 0 || !IsDBCSLeadByte(filespec[index-1])))))
filespec[index] = '\0';
strcat(filespec, "\\*");
dp = (DIR *) malloc(sizeof(DIR));
if (dp == NULL) {
free(filespec);
return NULL;
}
dp->offset = 0;
dp->finished = 0;
if ((handle = FindFirstFile(filespec, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) {
DWORD err = GetLastError();
if (err == ERROR_NO_MORE_FILES || err == ERROR_FILE_NOT_FOUND) {
dp->finished = 1;
} else {
free(dp);
free(filespec);
return NULL;
}
}
dp->dir = strdup(resolved_path_buff);
dp->handle = handle;
free(filespec);
return dp;
}
示例14: luasandbox_timer_alloc
static luasandbox_timer * luasandbox_timer_alloc()
{
int status;
size_t old_hash_size;
off_t i;
luasandbox_timer *lt;
luasandbox_timer **old_hash;
status = pthread_rwlock_wrlock(&timer_hash_rwlock);
if (status != SUCCESS) {
// Some other error
TSRMLS_FETCH();
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"Unable to acquire timer rwlock for writing: %s", strerror(errno));
return NULL;
}
// Allocate the timer and set its id
lt = (luasandbox_timer*)pecalloc(1, sizeof(*lt), 1);
lt->id = timer_next_id;
if (++timer_next_id < 0) {
timer_next_id = 1;
}
// Is it time to increase the hash table size?
timer_hash_entries++;
if (timer_hash_entries >= timer_hash_size * TIMER_HASH_LOAD_FACTOR) {
old_hash = timer_hash;
old_hash_size = timer_hash_size;
if (timer_hash_size == 0) {
timer_hash_size = 10;
} else {
timer_hash_size = timer_hash_size * 2;
}
timer_hash = (luasandbox_timer**)pecalloc(timer_hash_size, sizeof(*timer_hash), 1);
for (i = 0; i < old_hash_size; i++) {
if (old_hash[i]) {
timer_hash_insert(old_hash[i]);
}
}
}
// Insert the new timer into the hash table
timer_hash_insert(lt);
pthread_rwlock_unlock(&timer_hash_rwlock);
return lt;
}
示例15: dcc_php
void dcc_php(struct network *net, struct trigger *trig, struct irc_data *data, struct dcc_session *dcc, const char *dccbuf)
{
zval *ret;
TSRMLS_FETCH();
ALLOC_INIT_ZVAL(ret);
zend_try
{
if(zend_eval_string_ex(troll_makearg(dccbuf,trig->mask),&ret,"DCC Code",1 TSRMLS_CC) != SUCCESS)
{
}
}
}