本文整理汇总了C++中zend_string_release函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_string_release函数的具体用法?C++ zend_string_release怎么用?C++ zend_string_release使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zend_string_release函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zend_print_zval_r_ex
ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
{
ZVAL_DEREF(expr);
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS_EX("Array\n");
if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr)) &&
++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
ZEND_PUTS_EX(" *RECURSION*");
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
return;
}
print_hash(write_func, Z_ARRVAL_P(expr), indent, 0);
if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr))) {
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
}
break;
case IS_OBJECT:
{
HashTable *properties;
int is_temp;
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
ZEND_PUTS_EX(ZSTR_VAL(class_name));
zend_string_release(class_name);
ZEND_PUTS_EX(" Object\n");
if (Z_OBJ_APPLY_COUNT_P(expr) > 0) {
ZEND_PUTS_EX(" *RECURSION*");
return;
}
if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) {
break;
}
Z_OBJ_INC_APPLY_COUNT_P(expr);
print_hash(write_func, properties, indent, 1);
Z_OBJ_DEC_APPLY_COUNT_P(expr);
if (is_temp) {
zend_hash_destroy(properties);
FREE_HASHTABLE(properties);
}
break;
}
default:
zend_print_zval_ex(write_func, expr, indent);
break;
}
}
示例2: phpdbg_switch_frame
void phpdbg_switch_frame(int frame) /* {{{ */
{
zend_execute_data *execute_data = PHPDBG_FRAME(num) ? PHPDBG_FRAME(execute_data) : EG(current_execute_data);
int i = 0;
if (PHPDBG_FRAME(num) == frame) {
phpdbg_notice("frame", "id=\"%d\"", "Already in frame #%d", frame);
return;
}
phpdbg_try_access {
while (execute_data) {
if (i++ == frame) {
break;
}
do {
execute_data = execute_data->prev_execute_data;
} while (execute_data && execute_data->opline == NULL);
}
} phpdbg_catch_access {
phpdbg_error("signalsegv", "", "Couldn't switch frames, invalid data source");
return;
} phpdbg_end_try_access();
if (execute_data == NULL) {
phpdbg_error("frame", "type=\"maxnum\" id=\"%d\"", "No frame #%d", frame);
return;
}
phpdbg_restore_frame();
if (frame > 0) {
PHPDBG_FRAME(num) = frame;
/* backup things and jump back */
PHPDBG_FRAME(execute_data) = EG(current_execute_data);
EG(current_execute_data) = execute_data;
}
phpdbg_try_access {
zend_string *s = phpdbg_compile_stackframe(EG(current_execute_data));
phpdbg_notice("frame", "id=\"%d\" frameinfo=\"%.*s\"", "Switched to frame #%d: %.*s", frame, (int) ZSTR_LEN(s), ZSTR_VAL(s));
zend_string_release(s);
} phpdbg_catch_access {
phpdbg_notice("frame", "id=\"%d\"", "Switched to frame #%d", frame);
} phpdbg_end_try_access();
phpdbg_print_cur_frame_info();
} /* }}} */
示例3: free_zend_constant
void free_zend_constant(zval *zv)
{
zend_constant *c = Z_PTR_P(zv);
if (!(c->flags & CONST_PERSISTENT)) {
zval_dtor(&c->value);
} else {
zval_internal_dtor(&c->value);
}
if (c->name) {
zend_string_release(c->name);
}
pefree(c, c->flags & CONST_PERSISTENT);
}
示例4: zend_string_init
PHP_MAILPARSE_API char *php_mimepart_attribute_get(struct php_mimeheader_with_attributes *attr, char *attrname)
{
zval *attrval;
zend_string *hash_key;
hash_key = zend_string_init(attrname, strlen(attrname), 0);
attrval = zend_hash_find(Z_ARRVAL_P(&attr->attributes), hash_key);
zend_string_release(hash_key);
if (attrval != NULL) {
return Z_STRVAL_P(attrval);
}
return NULL;
}
示例5: PHP_METHOD
/* {{{ proto SolrDocumentField SolrInputDocument::getField(string fieldname)
Returns the requested field. */
PHP_METHOD(SolrInputDocument, getField)
{
solr_char_t *field_name = NULL;
COMPAT_ARG_SIZE_T field_name_length = 0;
solr_document_t *doc_entry = NULL;
zend_string *field_str = NULL;
/* Process the parameters passed to the default constructor */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) {
RETURN_FALSE;
}
if (!field_name_length) {
RETURN_FALSE;
}
field_str = zend_string_init(field_name, field_name_length, SOLR_DOCUMENT_FIELD_PERSISTENT);
/* Retrieve the document entry for the SolrDocument instance */
if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS)
{
solr_field_list_t *field_values = NULL;
if ((field_values = zend_hash_find_ptr(doc_entry->fields, field_str)) != NULL)
{
solr_create_document_field_object(field_values, &return_value TSRMLS_CC);
/* The field was retrieved, so we're done here */
zend_string_release(field_str);
return ;
}
goto return_false;
}
return_false:
zend_string_release(field_str);
RETURN_FALSE;
}
示例6: _php_array_to_envp
/* {{{ _php_array_to_envp */
static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent)
{
zval *element;
php_process_env_t env;
zend_string *key, *str;
#ifndef PHP_WIN32
char **ep;
#endif
char *p;
size_t cnt, l, sizeenv = 0;
HashTable *env_hash;
memset(&env, 0, sizeof(env));
if (!environment) {
return env;
}
cnt = zend_hash_num_elements(Z_ARRVAL_P(environment));
if (cnt < 1) {
#ifndef PHP_WIN32
env.envarray = (char **) pecalloc(1, sizeof(char *), is_persistent);
#endif
env.envp = (char *) pecalloc(4, 1, is_persistent);
return env;
}
ALLOC_HASHTABLE(env_hash);
zend_hash_init(env_hash, cnt, NULL, NULL, 0);
/* first, we have to get the size of all the elements in the hash */
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(environment), key, element) {
str = zval_get_string(element);
if (ZSTR_LEN(str) == 0) {
zend_string_release(str);
continue;
}
sizeenv += ZSTR_LEN(str) + 1;
if (key && ZSTR_LEN(key)) {
sizeenv += ZSTR_LEN(key) + 1;
zend_hash_add_ptr(env_hash, key, str);
} else {
zend_hash_next_index_insert_ptr(env_hash, str);
}
} ZEND_HASH_FOREACH_END();
示例7: zend_print_flat_zval_r
ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
{
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS("Array (");
if (Z_REFCOUNTED_P(expr)) {
if (Z_IS_RECURSIVE_P(expr)) {
ZEND_PUTS(" *RECURSION*");
return;
}
Z_PROTECT_RECURSION_P(expr);
}
print_flat_hash(Z_ARRVAL_P(expr));
ZEND_PUTS(")");
if (Z_REFCOUNTED_P(expr)) {
Z_UNPROTECT_RECURSION_P(expr);
}
break;
case IS_OBJECT:
{
HashTable *properties = NULL;
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
zend_printf("%s Object (", ZSTR_VAL(class_name));
zend_string_release(class_name);
if (Z_IS_RECURSIVE_P(expr)) {
ZEND_PUTS(" *RECURSION*");
return;
}
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
properties = Z_OBJPROP_P(expr);
}
if (properties) {
Z_PROTECT_RECURSION_P(expr);
print_flat_hash(properties);
Z_UNPROTECT_RECURSION_P(expr);
}
ZEND_PUTS(")");
break;
}
case IS_REFERENCE:
zend_print_flat_zval_r(Z_REFVAL_P(expr));
break;
default:
zend_print_variable(expr);
break;
}
}
示例8: GenerateCryptographicallySecureRandomBytes
// Creates a buffer of |length| cryptographically secure random bytes. An error
// will be thrown if the bytes could not be generated, for example because the
// PRNG doesn't have enough entropy. Ownership of the created string is passed.
static zend_string* GenerateCryptographicallySecureRandomBytes(size_t length) {
zend_string* buffer = zend_string_alloc(length, 0);
if (!buffer) {
php_error_docref(NULL, E_ERROR, kRandomBytesAllocationError);
return NULL;
}
if (RAND_bytes(buffer->val, length) != 1) {
php_error_docref(NULL, E_ERROR, kRandomBytesEntropyError);
zend_string_release(buffer);
return NULL;
}
return buffer;
}
示例9: check_http_host
static int check_http_host(char *target)
{
zval *host, *tmp;
zend_string *host_tmp;
char *colon;
if ((tmp = zend_hash_str_find(&EG(symbol_table), ZEND_STRL("_SERVER"))) &&
(host = zend_hash_str_find(Z_ARRVAL_P(tmp), ZEND_STRL("HTTP_HOST"))) &&
Z_TYPE_P(host) == IS_STRING) {
host_tmp = zend_string_init(Z_STRVAL_P(host), Z_STRLEN_P(host), 0);
/* HTTP_HOST could be 'localhost:8888' etc. */
colon = strchr(ZSTR_VAL(host_tmp), ':');
if (colon) {
ZSTR_LEN(host_tmp) = colon - ZSTR_VAL(host_tmp);
ZSTR_VAL(host_tmp)[ZSTR_LEN(host_tmp)] = '\0';
}
if (!strcasecmp(ZSTR_VAL(host_tmp), target)) {
zend_string_release(host_tmp);
return SUCCESS;
}
zend_string_release(host_tmp);
}
return FAILURE;
}
示例10: CLASS_METHOD
/** public function ION\HTTP\Message::withProtocolVersion(string $version) : self */
CLASS_METHOD(ION_HTTP_Message, withProtocolVersion) {
ion_http_message * message = ION_THIS_OBJECT(ion_http_message);
zend_string * version = NULL;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(version)
ZEND_PARSE_PARAMETERS_END_EX(PION_ZPP_THROW);
if(message->version) {
zend_string_release(message->version);
}
message->version = zend_string_copy(version);
RETURN_THIS();
}
示例11: yac_add_multi_impl
static int yac_add_multi_impl(zend_string *prefix, zval *kvs, int ttl, int add) /* {{{ */ {
HashTable *ht = Z_ARRVAL_P(kvs);
zend_string *key;
zend_ulong idx;
zval *value;
ZEND_HASH_FOREACH_KEY_VAL(ht, idx, key, value) {
uint32_t should_free = 0;
if (!key) {
key = strpprintf(0, "%lu", idx);
should_free = 1;
}
if (yac_add_impl(prefix, key, value, ttl, add)) {
if (should_free) {
zend_string_release(key);
}
continue;
} else {
if (should_free) {
zend_string_release(key);
}
return 0;
}
} ZEND_HASH_FOREACH_END();
示例12: zend_print_flat_zval_r
ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
{
switch (Z_TYPE_P(expr)) {
case IS_ARRAY:
ZEND_PUTS("Array (");
if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr)) &&
++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
ZEND_PUTS(" *RECURSION*");
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
return;
}
print_flat_hash(Z_ARRVAL_P(expr));
ZEND_PUTS(")");
if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr))) {
Z_ARRVAL_P(expr)->u.v.nApplyCount--;
}
break;
case IS_OBJECT:
{
HashTable *properties = NULL;
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
zend_printf("%s Object (", ZSTR_VAL(class_name));
zend_string_release(class_name);
if (Z_OBJ_APPLY_COUNT_P(expr) > 0) {
ZEND_PUTS(" *RECURSION*");
return;
}
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
properties = Z_OBJPROP_P(expr);
}
if (properties) {
Z_OBJ_INC_APPLY_COUNT_P(expr);
print_flat_hash(properties);
Z_OBJ_DEC_APPLY_COUNT_P(expr);
}
ZEND_PUTS(")");
break;
}
case IS_REFERENCE:
zend_print_flat_zval_r(Z_REFVAL_P(expr));
break;
default:
zend_print_variable(expr);
break;
}
}
示例13: PHP_FUNCTION
/* {{{ proto mixed hstore_encode(array hstore)
Decodes the hStore representation into a PHP value */
static PHP_FUNCTION(hstore_encode)
{
zval *array, *value;
zend_ulong num_idx;
zend_string *str_idx;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
return;
}
smart_str buf = {};
smart_str_alloc(&buf, 2048, 0);
zend_bool need_comma = 0;
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, value) {
if (need_comma) {
smart_str_appendl(&buf, ", ", 2);
} else {
need_comma = 1;
}
smart_str_appendc(&buf, '"');
if (str_idx) {
escape_string(&buf, str_idx);
} else {
smart_str_append_long(&buf, (long) num_idx);
}
smart_str_appendl(&buf, "\"=>", 3);
if (Z_TYPE_P(value) == IS_NULL) {
smart_str_appendl(&buf, "NULL", 4);
} else {
convert_to_string_ex(value);
smart_str_appendc(&buf, '"');
zend_string *str = zval_get_string(value);
escape_string(&buf, str);
zend_string_release(str);
smart_str_appendc(&buf, '"');
}
} ZEND_HASH_FOREACH_END();
smart_str_0(&buf); /* copy? */
ZVAL_NEW_STR(return_value, buf.s);
}
示例14: autoload_func_info_dtor
static void autoload_func_info_dtor(zval *element)
{
autoload_func_info *alfi = (autoload_func_info*)Z_PTR_P(element);
if (!Z_ISUNDEF(alfi->obj)) {
zval_ptr_dtor(&alfi->obj);
}
if (alfi->func_ptr &&
UNEXPECTED(alfi->func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
zend_string_release(alfi->func_ptr->common.function_name);
zend_free_trampoline(alfi->func_ptr);
}
if (!Z_ISUNDEF(alfi->closure)) {
zval_ptr_dtor(&alfi->closure);
}
efree(alfi);
}
示例15: ZEND_METHOD
ZEND_METHOD(Closure, __invoke) /* {{{ */
{
zend_function *func = EX(func);
zval *arguments = ZEND_CALL_ARG(execute_data, 1);
if (call_user_function_ex(CG(function_table), NULL, getThis(), return_value, ZEND_NUM_ARGS(), arguments, 1, NULL) == FAILURE) {
RETVAL_FALSE;
}
/* destruct the function also, then - we have allocated it in get_method */
zend_string_release(func->internal_function.function_name);
efree(func);
#if ZEND_DEBUG
execute_data->func = NULL;
#endif
}