您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ zval_copy_ctor函数代码示例

51自学网 2021-06-03 12:02:35
  C++
这篇教程C++ zval_copy_ctor函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中zval_copy_ctor函数的典型用法代码示例。如果您正苦于以下问题:C++ zval_copy_ctor函数的具体用法?C++ zval_copy_ctor怎么用?C++ zval_copy_ctor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了zval_copy_ctor函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: phalcon_array_update_long

/** * Updates values on arrays by long indexes only */int phalcon_array_update_long(zval **arr, ulong index, zval **value, int flags TSRMLS_DC){	if (Z_TYPE_PP(arr) != IS_ARRAY) {		php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot use a scalar value as an array");		return FAILURE;	}	if ((flags & PH_CTOR) == PH_CTOR) {		zval *new_zv;		Z_DELREF_PP(value);		ALLOC_ZVAL(new_zv);		INIT_PZVAL_COPY(new_zv, *value);		*value = new_zv;		zval_copy_ctor(new_zv);	}	if ((flags & PH_SEPARATE) == PH_SEPARATE) {		if (Z_REFCOUNT_PP(arr) > 1) {			zval *new_zv;			Z_DELREF_PP(arr);			ALLOC_ZVAL(new_zv);			INIT_PZVAL_COPY(new_zv, *arr);			*arr = new_zv;			zval_copy_ctor(new_zv);	    }	}	if ((flags & PH_COPY) == PH_COPY) {		Z_ADDREF_PP(value);	}	return zend_hash_index_update(Z_ARRVAL_PP(arr), index, value, sizeof(zval *), NULL);}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:36,


示例2: phalcon_array_update_zval

/** * Updates values on arrays by string or long indexes */int phalcon_array_update_zval(zval **arr, zval *index, zval **value, int flags TSRMLS_DC){	if (Z_TYPE_PP(arr) != IS_ARRAY) {		php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot use a scalar value as an array");		return FAILURE;	}	if (Z_TYPE_P(index) == IS_NULL) {		convert_to_string(index);	} else {		if (Z_TYPE_P(index) == IS_BOOL || Z_TYPE_P(index) == IS_DOUBLE) {			convert_to_long(index);		}	}	if ((flags & PH_CTOR) == PH_CTOR) {		zval *new_zv;		Z_DELREF_PP(value);		ALLOC_ZVAL(new_zv);		INIT_PZVAL_COPY(new_zv, *value);		*value = new_zv;		zval_copy_ctor(new_zv);	}	if ((flags & PH_SEPARATE) == PH_SEPARATE) {		if (Z_REFCOUNT_PP(arr) > 1) {			zval *new_zv;			Z_DELREF_PP(arr);			ALLOC_ZVAL(new_zv);			INIT_PZVAL_COPY(new_zv, *arr);			*arr = new_zv;			zval_copy_ctor(new_zv);	    }	}	if ((flags & PH_COPY) == PH_COPY) {		Z_ADDREF_PP(value);	} 	if(Z_TYPE_P(index) == IS_STRING){		return zend_hash_update(Z_ARRVAL_PP(arr), Z_STRVAL_P(index), Z_STRLEN_P(index)+1, value, sizeof(zval *), NULL);	} else {		if (Z_TYPE_P(index) == IS_LONG) {			return zend_hash_index_update(Z_ARRVAL_PP(arr), Z_LVAL_P(index), value, sizeof(zval *), NULL);		} else {			php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Illegal offset type");		}	}	return FAILURE;}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:54,


示例3: xmlreader_write_property

/* {{{ xmlreader_write_property */void xmlreader_write_property(zval *object, zval *member, zval *value, void **cache_slot){	xmlreader_object *obj;	zval tmp_member;	xmlreader_prop_handler *hnd = NULL;	zend_object_handlers *std_hnd; 	if (Z_TYPE_P(member) != IS_STRING) {		tmp_member = *member;		zval_copy_ctor(&tmp_member);		convert_to_string(&tmp_member);		member = &tmp_member;	}	obj = Z_XMLREADER_P(object);	if (obj->prop_handler != NULL) {		hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));	}	if (hnd != NULL) {		php_error_docref(NULL, E_WARNING, "Cannot write to read-only property");	} else {		std_hnd = zend_get_std_object_handlers();		std_hnd->write_property(object, member, value, cache_slot);	}	if (member == &tmp_member) {		zval_dtor(member);	}}
开发者ID:LTD-Beget,项目名称:php-src,代码行数:31,


示例4: zval_copy_ctor

/* {{{ xmlreader_get_property_ptr_ptr */zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot){	xmlreader_object *obj;	zval tmp_member;	zval *retval = NULL;	xmlreader_prop_handler *hnd = NULL;	zend_object_handlers *std_hnd; 	if (Z_TYPE_P(member) != IS_STRING) {		tmp_member = *member;		zval_copy_ctor(&tmp_member);		convert_to_string(&tmp_member);		member = &tmp_member;	}	obj = Z_XMLREADER_P(object);	if (obj->prop_handler != NULL) {		hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));	}	if (hnd == NULL) {		std_hnd = zend_get_std_object_handlers();		retval = std_hnd->get_property_ptr_ptr(object, member, type, cache_slot);	}	if (member == &tmp_member) {		zval_dtor(member);	}	return retval;}
开发者ID:LTD-Beget,项目名称:php-src,代码行数:33,


示例5: zephir_array_update_long

/** * @brief Updates value in @a arr at position @a index with @a value * @param[in,out] arr Array * @param index Index * @param[in,out] value Value * @param flags Flags * @return Whether the operation succeeded * @retval @c FAILURE Failure, @a arr is not an array * @retval @c SUCCESS Success * @throw @c E_WARNING if @c arr is not an array * * Equivalent to <tt>$arr[$index] = $value</tt> in PHP where @c $index is an integer. * Flags may be a bitwise OR of the following values: * @arg @c PH_CTOR: create a copy of @a value and work with that copy; @c *value will be updated with the newly constructed value * @arg @c PH_SEPARATE: separate @a arr if its reference count is greater than 1; @c *arr will contain the separated version * @arg @c PH_COPY: increment the reference count on @c **value */int zephir_array_update_long(zval **arr, unsigned long index, zval **value, int flags ZEPHIR_DEBUG_PARAMS) {    if (Z_TYPE_PP(arr) != IS_ARRAY) {        zend_error(E_WARNING, "Cannot use a scalar value as an array in %s on line %d", file, line);        return FAILURE;    }    if ((flags & PH_CTOR) == PH_CTOR) {        zval *new_zv;        Z_DELREF_PP(value);        ALLOC_ZVAL(new_zv);        INIT_PZVAL_COPY(new_zv, *value);        *value = new_zv;        zval_copy_ctor(new_zv);    }    if ((flags & PH_SEPARATE) == PH_SEPARATE) {        SEPARATE_ZVAL_IF_NOT_REF(arr);    }    if ((flags & PH_COPY) == PH_COPY) {        Z_ADDREF_PP(value);    }    return zend_hash_index_update(Z_ARRVAL_PP(arr), index, value, sizeof(zval *), NULL);}
开发者ID:golovanov,项目名称:php-ext-zendxml,代码行数:43,


示例6: php_mimepart_alloc

static php_mimepart *alloc_new_child_part(php_mimepart *parentpart, size_t startpos, int inherit){	php_mimepart *child = php_mimepart_alloc();	zval child_z;	parentpart->parsedata.lastpart = child;	child->parent = parentpart;	child->source.kind = parentpart->source.kind;	if (parentpart->source.kind != mpNONE) {		child->source.zval = parentpart->source.zval;		zval_copy_ctor(&child->source.zval);	}        ZVAL_RES(&child_z, child->rsrc);	zend_hash_next_index_insert(&parentpart->children, &child_z);	child->startpos = child->endpos = child->bodystart = child->bodyend = startpos;	if (inherit) {		if (parentpart->content_transfer_encoding)			child->content_transfer_encoding = estrdup(parentpart->content_transfer_encoding);		if (parentpart->charset)			child->charset = estrdup(parentpart->charset);	}	return child;}
开发者ID:php,项目名称:pecl-mail-mailparse,代码行数:27,


示例7: PHP_METHOD

/* {{{ proto int error.next()   Returns a ref to the next errorObj in the list, or NULL if we reached the last one */PHP_METHOD(errorObj, next){  zval *zobj = getThis();  php_error_object *php_error;  errorObj *error = NULL;  PHP_MAPSCRIPT_ERROR_HANDLING(TRUE);  if (zend_parse_parameters_none() == FAILURE) {    PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);    return;  }  PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE);  php_error = (php_error_object *) zend_object_store_get_object(zobj TSRMLS_CC);  if (php_error->error->next == NULL)    RETURN_NULL();  /* Make sure 'self' is still valid.  It may have been deleted by   * msResetErrorList() */  error = msGetErrorObj();  while(error != php_error->error) {    if (error->next == NULL) {      mapscript_throw_exception("Trying to access an errorObj that has expired." TSRMLS_CC);      return;    }    error = error->next;  }  php_error->error = php_error->error->next;  *return_value = *zobj;  zval_copy_ctor(return_value);  INIT_PZVAL(return_value);}
开发者ID:AsgerPetersen,项目名称:mapserver,代码行数:36,


示例8: copy_zend_constant

void copy_zend_constant(zend_constant *c){	c->name = zend_strndup(c->name, c->name_len - 1);	if (!(c->flags & CONST_PERSISTENT)) {		zval_copy_ctor(&c->value);	}}
开发者ID:m4ster-git,项目名称:nginx-on-heroku,代码行数:7,


示例9: pthreads_has_property

/* {{{ check if a thread has a property set, wherever it is available */int pthreads_has_property(PTHREADS_HAS_PROPERTY_PASSTHRU_D) {	int isset = 0;	zval *mstring = NULL;	PTHREAD pthreads = PTHREADS_FETCH_FROM(object);	if (Z_TYPE_P(member) != IS_STRING) {		ALLOC_ZVAL(mstring);		*mstring = *member;		zval_copy_ctor(			mstring		);		INIT_PZVAL(mstring);		convert_to_string(mstring);		member = mstring;#if PHP_VERSION_ID > 50399		key = NULL;#endif	}	if (Z_TYPE_P(member) == IS_STRING) {		isset = pthreads_store_isset(pthreads->store, Z_STRVAL_P(member), Z_STRLEN_P(member), has_set_exists TSRMLS_CC);	} else zend_error(E_WARNING, "pthreads has detected an attempt to use an unsupported kind of key in %s", Z_OBJCE_P(object)->name);	if (mstring != NULL) {		zval_ptr_dtor(&mstring);	}	return isset;}
开发者ID:ArkeologeN,项目名称:pthreads,代码行数:31,


示例10: pthreads_unset_property

/* {{{ unset an object property */void pthreads_unset_property(PTHREADS_UNSET_PROPERTY_PASSTHRU_D) {	zval *mstring = NULL;	PTHREAD pthreads = PTHREADS_FETCH_FROM(object);	if (Z_TYPE_P(member) != IS_STRING) {		ALLOC_ZVAL(mstring);		*mstring = *member;		zval_copy_ctor(			mstring		);		INIT_PZVAL(mstring);		convert_to_string(mstring);		member = mstring;#if PHP_VERSION_ID > 50399		key = NULL;#endif	}	if (Z_TYPE_P(member) == IS_STRING) {		if (pthreads_store_delete(pthreads->store, Z_STRVAL_P(member), Z_STRLEN_P(member) TSRMLS_CC)!=SUCCESS){			zend_error(				E_WARNING, 				"pthreads has experienced an internal error while deleting %s::$%s", 				Z_OBJCE_P(object)->name, Z_STRVAL_P(member)			);		}	} else zend_error(E_WARNING, "pthreads detected an attempt to use an unsupported kind of key in %s", Z_OBJCE_P(object)->name);		if (mstring != NULL) {		zval_ptr_dtor(&mstring);	}}
开发者ID:ArkeologeN,项目名称:pthreads,代码行数:33,


示例11: on_data_available

static size_t on_data_available(char *data, size_t size, size_t nmemb, void *ctx){	php_stream *stream = (php_stream *) ctx;	php_curl_stream *curlstream = (php_curl_stream *) stream->abstract;	size_t wrote;	TSRMLS_FETCH();	/* TODO: I'd like to deprecate this.	 * This code is here because until we start getting real data, we don't know	 * if we have had all of the headers 	 * */	if (curlstream->readbuffer.writepos == 0) {		zval *sym;		if (!EG(active_symbol_table)) {			zend_rebuild_symbol_table(TSRMLS_C);		}		MAKE_STD_ZVAL(sym);		*sym = *curlstream->headers;		zval_copy_ctor(sym);		ZEND_SET_SYMBOL(EG(active_symbol_table), "http_response_header", sym);	}		php_stream_seek(curlstream->readbuffer.buf, curlstream->readbuffer.writepos, SEEK_SET);	wrote = php_stream_write(curlstream->readbuffer.buf, data, size * nmemb);	curlstream->readbuffer.writepos = php_stream_tell(curlstream->readbuffer.buf);	return wrote;}
开发者ID:Calado,项目名称:php-src,代码行数:29,


示例12: php_config_ini_parser_cb

static void php_config_ini_parser_cb(zval *arg1, zval *arg2, int callback_type, void *arg){	switch (callback_type) {		case ZEND_INI_PARSER_ENTRY: {				zval *entry;				if (!arg2) {					break;				}				if (!strcasecmp(Z_STRVAL_P(arg1), "extension")) { /* load function module */					zval copy;										copy = *arg2;					zval_copy_ctor(&copy);					copy.refcount = 0;					zend_llist_add_element(&extension_lists.functions, &copy); 				} else if (!strcasecmp(Z_STRVAL_P(arg1), ZEND_EXTENSION_TOKEN)) { /* load Zend extension */					char *extension_name = estrndup(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2));										zend_llist_add_element(&extension_lists.engine, &extension_name);				} else {					zend_hash_update(&configuration_hash, Z_STRVAL_P(arg1), Z_STRLEN_P(arg1)+1, arg2, sizeof(zval), (void **) &entry);					Z_STRVAL_P(entry) = zend_strndup(Z_STRVAL_P(entry), Z_STRLEN_P(entry));				}			}			break;		case ZEND_INI_PARSER_SECTION:			break;	}}
开发者ID:jehurodrig,项目名称:PHP-4.0.6-16-07-2009,代码行数:30,


示例13: zend_get_parameters_array

ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_array){	void **p;	int arg_count;	zval *param_ptr;	ELS_FETCH();	p = EG(argument_stack).top_element-2;	arg_count = (ulong) *p;	if (param_count>arg_count) {		return FAILURE;	}	while (param_count-->0) {		param_ptr = *(p-arg_count);		if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {			zval *new_tmp;			ALLOC_ZVAL(new_tmp);			*new_tmp = *param_ptr;			zval_copy_ctor(new_tmp);			INIT_PZVAL(new_tmp);			param_ptr = new_tmp;			((zval *) *(p-arg_count))->refcount--;			*(p-arg_count) = param_ptr;		}		*(argument_array++) = param_ptr;		arg_count--;	}	return SUCCESS;}
开发者ID:jehurodrig,项目名称:PHP-4.0.6-16-07-2009,代码行数:33,


示例14: util_array_flatten

void util_array_flatten(zval* arr, zval* result, zend_bool preserve_keys) {	zval **zvalue;	char *key;	uint keylen;	ulong idx;	int type;	HashTable* arr_hash;	HashPosition pointer;	// Copy a temp array	zval temp;	temp = *arr;	zval_copy_ctor(&temp);	arr_hash = Z_ARRVAL_P(&temp);	zend_hash_internal_pointer_reset_ex(arr_hash, &pointer);	while (zend_hash_get_current_data_ex(arr_hash, (void**) &zvalue, &pointer) == SUCCESS) {		if (Z_TYPE_P(*zvalue) == IS_ARRAY) {			util_array_flatten(*zvalue, result, preserve_keys);		} else {			type = zend_hash_get_current_key_ex(arr_hash, &key, &keylen, &idx, 0, &pointer);			if (preserve_keys && type != HASH_KEY_IS_LONG) {				add_assoc_zval(result, key, *zvalue);			} else {				add_next_index_zval(result, *zvalue);			}		}		zend_hash_move_forward_ex(arr_hash, &pointer);		//ALLOC_INIT_ZVAL(*zvalue);	}}
开发者ID:CraryPrimitiveMan,项目名称:util,代码行数:31,


示例15: zephir_array_update_quick_string

/** * @brief Updates value in @a arr at position @a index with @a value using the precomputed hash @a key * @param[in,out] arr Array * @param index Index * @param index_length Length of the index, should include the trailing zero * @param key Precomputed hash of @c value * @param value Value * @param flags Flags * @return Whether the operation succeeded * @retval @c FAILURE Failure, @a arr is not an array * @retval @c SUCCESS Success * @throw @c E_WARNING if @a arr is not an array * * Equivalent to <tt>$arr[$index] = $value</tt> in PHP. * * Flags may be a bitwise OR of the following values: * @arg @c PH_CTOR: create a copy of @a value and work with that copy; @c *value will be updated with the newly constructed value * @arg @c PH_SEPARATE: separate @a arr if its reference count is greater than 1; @c *arr will contain the separated version * @arg @c PH_COPY: increment the reference count on @c **value */int zephir_array_update_quick_string(zval **arr, const char *index, uint index_length, unsigned long key, zval **value, int flags) {    if (Z_TYPE_PP(arr) != IS_ARRAY) {        zend_error(E_WARNING, "Cannot use a scalar value as an array (3)");        return FAILURE;    }    if ((flags & PH_CTOR) == PH_CTOR) {        zval *new_zv;        Z_DELREF_PP(value);        ALLOC_ZVAL(new_zv);        INIT_PZVAL_COPY(new_zv, *value);        *value = new_zv;        zval_copy_ctor(new_zv);    }    if ((flags & PH_SEPARATE) == PH_SEPARATE) {        SEPARATE_ZVAL_IF_NOT_REF(arr);    }    if ((flags & PH_COPY) == PH_COPY) {        Z_ADDREF_PP(value);    }    return zend_hash_quick_update(Z_ARRVAL_PP(arr), index, index_length, key, value, sizeof(zval *), NULL);}
开发者ID:golovanov,项目名称:php-ext-zendxml,代码行数:46,


示例16: zend_make_printable_zval

ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy){	if (expr->type==IS_STRING) {		*use_copy = 0;		return;	}	switch (expr->type) {		case IS_NULL:			expr_copy->value.str.len = 0;			expr_copy->value.str.val = empty_string;			break;		case IS_BOOL:			if (expr->value.lval) {				expr_copy->value.str.len = 1;				expr_copy->value.str.val = estrndup("1", 1);			} else {				expr_copy->value.str.len = 0;				expr_copy->value.str.val = empty_string;			}			break;		case IS_RESOURCE:			expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);			expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval);			break;		case IS_ARRAY:			expr_copy->value.str.len = sizeof("Array")-1;			expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len);			break;		case IS_OBJECT:			expr_copy->value.str.len = sizeof("Object")-1;			expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);			break;		case IS_DOUBLE: 			*expr_copy = *expr;			zval_copy_ctor(expr_copy);			zend_locale_sprintf_double(expr_copy ZEND_FILE_LINE_CC);			break;			default:			*expr_copy = *expr;			zval_copy_ctor(expr_copy);			convert_to_string(expr_copy);			break;	}	expr_copy->type = IS_STRING;	*use_copy = 1;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:46,


示例17: wkhtmltox_set_object_params

int wkhtmltox_set_object_params(void *settings, fp set_function, zval *params, zval *input){    zval **data;    HashTable *params_hash;    HashPosition pointer;    int params_count;    char *key;    int key_len;    long index;    int page = 0;    int html = 0;    params_hash = Z_ARRVAL_P(params);    params_count = zend_hash_num_elements(params_hash);    for(zend_hash_internal_pointer_reset_ex(params_hash, &pointer);            zend_hash_get_current_data_ex(params_hash, (void **)&data, &pointer) == SUCCESS;            zend_hash_move_forward_ex(params_hash, &pointer)) {        zval temp = **data;        zval_copy_ctor(&temp);        if (zend_hash_get_current_key_ex(params_hash, &key, &key_len, &index, 0, &pointer) == HASH_KEY_IS_STRING) {            switch (Z_TYPE(temp)) {                case IS_BOOL:                    set_function(settings, key, Z_BVAL(temp) ? "true" : "false");                    break;                default:                    convert_to_string(&temp);                case IS_STRING:		    if (strcmp(key, "page") == 0 || strcmp(key, "out") == 0) {			//TODO do checking of page/out url/file according to php security settings like open_basedir, allow_url_fopen a.s.o			// php main fopenwrapper ?! php_check_specific_open_basedir php_check_open_basedir			//php_printf("key: %s, val: %s/n", key, Z_STRVAL(temp));		    }		    if (strcmp(key, "page") == 0 && Z_STRLEN(temp) > 0) {			page = 1;		    }		    if (strcmp(key, "html") == 0 && Z_STRLEN(temp) > 0) {			ZVAL_STRING(input, Z_STRVAL(temp), 1);			html = 1;		    }                    set_function(settings, key, Z_STRVAL(temp));                    break;            }        }        zval_dtor(&temp);    }    if (page == 1) {	return 0;    } else if (page == 0 && html == 1) {	return 1;    } else {	return 2;    }}
开发者ID:jymboche,项目名称:php-wkhtmltox,代码行数:58,


示例18: php_ssh2_set_callback

/* {{{ php_ssh2_set_callback * Try to set a method if it's passed in with the hash table */static int php_ssh2_set_callback(LIBSSH2_SESSION *session, HashTable *ht, char *callback, int callback_len, int callback_type, php_ssh2_session_data *data){	zval *handler, *copyval;	void *internal_handler;	zend_string *callback_zstring;	callback_zstring = zend_string_init(callback, callback_len, 0);	if ((handler = zend_hash_find(ht, callback_zstring)) == NULL) {			zend_string_release(callback_zstring);		return 0;	}	zend_string_release(callback_zstring);	if (!zend_is_callable(handler, 0, NULL)) {		return -1;	}	copyval = handler;	zval_copy_ctor(copyval);	switch (callback_type) {		case LIBSSH2_CALLBACK_IGNORE:			internal_handler = php_ssh2_ignore_cb;			if (data->ignore_cb) {				zval_ptr_dtor(data->ignore_cb);			}			data->ignore_cb = copyval;			break;		case LIBSSH2_CALLBACK_DEBUG:			internal_handler = php_ssh2_debug_cb;			if (data->debug_cb) {				zval_ptr_dtor(data->debug_cb);			}			data->debug_cb = copyval;			break;		case LIBSSH2_CALLBACK_MACERROR:			internal_handler = php_ssh2_macerror_cb;			if (data->macerror_cb) {				zval_ptr_dtor(data->macerror_cb);			}			data->macerror_cb = copyval;			break;		case LIBSSH2_CALLBACK_DISCONNECT:			internal_handler = php_ssh2_disconnect_cb;			if (data->disconnect_cb) {				zval_ptr_dtor(data->disconnect_cb);			}			data->disconnect_cb = copyval;			break;		default:			zval_ptr_dtor(copyval);			return -1;	}	libssh2_session_callback_set(session, callback_type, internal_handler);	return 0;}
开发者ID:Sean-Der,项目名称:pecl-networking-ssh2,代码行数:61,


示例19: ZEND_METHOD

//数组覆盖ZEND_METHOD( alinq_class , Concat ){    zval *concat_array;    zend_class_entry *ce;    ce = Z_OBJCE_P(getThis());    zval * reArrVal;    MAKE_STD_ZVAL(reArrVal);    array_init(reArrVal);    zval *dataSource, **tmpns;    ALLOC_INIT_ZVAL(reArrVal);      //持久化分配内存    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &concat_array) == FAILURE) {        return;    }         dataSource = zend_read_property(ce, getThis(), "dataSource", sizeof("dataSource")-1, 0 TSRMLS_DC);        //重新copy一个zval,防止破坏原数据        reArrVal = dataSource;        zval_copy_ctor(reArrVal);        // INIT_PZVAL(reArrVal);    while (zend_hash_get_current_data(Z_ARRVAL_P(concat_array), (void **)&tmpns) == SUCCESS) {        char *key;        uint keylen;        ulong idx;        int type;        zval **ppzval, *tmpcopy;        MAKE_STD_ZVAL(tmpcopy);        type = zend_hash_get_current_key_ex(Z_ARRVAL_P(concat_array), &key, &keylen,&idx, 0, NULL);        //重新copy一个zval,防止破坏原数据        tmpcopy = *tmpns;        zval_copy_ctor(tmpcopy);        // INIT_PZVAL(tmpcopy);        add_assoc_zval(reArrVal, key, tmpcopy);         // zval_dtor(&tmpcopy);        // PHPWRITE(key,keylen);          // RETURN_ZVAL(reArrVal,1,1);         zend_hash_move_forward(Z_ARRVAL_P(concat_array));    }        RETURN_ZVAL(reArrVal,1,1);}
开发者ID:wosiwo,项目名称:clinq,代码行数:46,


示例20: ZEND_METHOD

/* {{{ proto Closure Closure::bind(Closure $old, object $to [, mixed $scope = "static" ] )   Create a closure from another one and bind to another object and scope */ZEND_METHOD(Closure, bind) /* {{{ */{	zval *newthis, *zclosure, *scope_arg = NULL;	zend_closure *closure;	zend_class_entry *ce, **ce_p;	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) {		RETURN_NULL();	}	closure = (zend_closure *)zend_object_store_get_object(zclosure TSRMLS_CC);		if ((newthis != NULL) && (closure->func.common.fn_flags & ZEND_ACC_STATIC)) {		zend_error(E_WARNING, "Cannot bind an instance to a static closure");	}	if (scope_arg != NULL) { /* scope argument was given */		if (IS_ZEND_STD_OBJECT(*scope_arg)) {			ce = Z_OBJCE_P(scope_arg);		} else if (Z_TYPE_P(scope_arg) == IS_NULL) {			ce = NULL;		} else {			char *class_name;			int class_name_len;			zval tmp_zval;			INIT_ZVAL(tmp_zval);			if (Z_TYPE_P(scope_arg) == IS_STRING) {				class_name = Z_STRVAL_P(scope_arg);				class_name_len = Z_STRLEN_P(scope_arg);			} else {				tmp_zval = *scope_arg;				zval_copy_ctor(&tmp_zval);				convert_to_string(&tmp_zval);				class_name = Z_STRVAL(tmp_zval);				class_name_len = Z_STRLEN(tmp_zval);			}			if ((class_name_len == sizeof("static") - 1) &&				(memcmp("static", class_name, sizeof("static") - 1) == 0)) {				ce = closure->func.common.scope;			}			else if (zend_lookup_class_ex(class_name, class_name_len, NULL, 1, &ce_p TSRMLS_CC) == FAILURE) {				zend_error(E_WARNING, "Class '%s' not found", class_name);				zval_dtor(&tmp_zval);				RETURN_NULL();			} else {				ce = *ce_p;			}			zval_dtor(&tmp_zval);		}	} else { /* scope argument not given; do not change the scope by default */		ce = closure->func.common.scope;	}	zend_create_closure(return_value, &closure->func, ce, newthis TSRMLS_CC);}
开发者ID:0,项目名称:php-src,代码行数:59,


示例21: clone_indices

static inline void clone_indices(php_com_saproxy *dest, php_com_saproxy *src, int ndims){	int i;	for (i = 0; i < ndims; i++) {		MAKE_STD_ZVAL(dest->indices[i]);		*dest->indices[i] = *src->indices[i];		zval_copy_ctor(dest->indices[i]);	}}
开发者ID:Doap,项目名称:php-src,代码行数:10,


示例22: php_array_add_sum_long

void php_array_add_sum_long(zval *row, zval *data1, zval *data2){    long x1, x2;    zval temp;    temp = *data1;    zval_copy_ctor(&temp);    convert_to_long(&temp);    x1 = Z_LVAL(temp);    zval_dtor(&temp);    temp = *data2;    zval_copy_ctor(&temp);    convert_to_long(&temp);    x2 = Z_LVAL(temp);    zval_dtor(&temp);    add_next_index_long(row, x1 + x2);}
开发者ID:konovaltsev,项目名称:php_matrix,代码行数:19,


示例23: php_array_add_sum_double

void php_array_add_sum_double(zval *row, zval *data1, zval *data2){    double x1, x2;    zval temp;    temp = *data1;    zval_copy_ctor(&temp);    convert_to_double(&temp);    x1 = Z_DVAL(temp);    zval_dtor(&temp);    temp = *data2;    zval_copy_ctor(&temp);    convert_to_double(&temp);    x2 = Z_DVAL(temp);    zval_dtor(&temp);    add_next_index_double(row, x1 + x2);}
开发者ID:konovaltsev,项目名称:php_matrix,代码行数:19,


示例24: zend_optimizer_get_collected_constant

static int zend_optimizer_get_collected_constant(HashTable *constants, zval *name, zval* value){	zval *val;	if (zend_hash_find(constants, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, (void**)&val) == SUCCESS) {		*value = *val;		zval_copy_ctor(value);		return 1;	}	return 0;}
开发者ID:TeixeiraHub,项目名称:php-src,代码行数:11,


示例25: curlfile_get_property

static void curlfile_get_property(char *name, INTERNAL_FUNCTION_PARAMETERS){	zval *res;	if (zend_parse_parameters_none() == FAILURE) {		return;	}	res = zend_read_property(curl_CURLFile_class, getThis(), name, strlen(name), 1 TSRMLS_CC);	*return_value = *res;	zval_copy_ctor(return_value);	INIT_PZVAL(return_value);}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:11,


示例26: php_map_from_HasTable

/** * Convert a php Array to a map * * @param t the php Array to convert * @return the created map */map* php_map_from_HasTable(HashTable* t){#ifdef DEBUG  fprintf(stderr,"mapsFromPHPArray start/n");#endif  map* final_res=(map*)malloc(MAP_SIZE);  final_res=NULL;  char key[1024];  for(zend_hash_internal_pointer_reset(t);      zend_hash_has_more_elements(t) == SUCCESS;      zend_hash_move_forward(t)) {    char *key;    uint keylen;    ulong idx;    int type;    int len;    zval **ppzval, tmpcopy;    type = zend_hash_get_current_key_ex(t, &key, &keylen, &idx, 0, NULL);     if (zend_hash_get_current_data(t, (void**)&ppzval) == FAILURE) {       /* Should never actually fail * since the key is known to exist. */       continue;     }    /**     * Duplicate the zval so that * the orignal’s contents are not destroyed      */     tmpcopy = **ppzval;     zval_copy_ctor(&tmpcopy);     /**     * Reset refcount & Convert      */     INIT_PZVAL(&tmpcopy);     convert_to_string(&tmpcopy);    if(strncmp(key,"value",5)==0){      len=Z_STRLEN_P(&tmpcopy);      	  final_res = addToMapWithSize(final_res,key,Z_STRVAL_P(&tmpcopy),len);    }    else{      if(final_res==NULL){#ifdef DEBUG	fprintf(stderr,"%s => %s/n",key,Z_STRVAL(tmpcopy));#endif	final_res=createMap(key,Z_STRVAL(tmpcopy));      }      else{#ifdef DEBUG	fprintf(stderr,"%s => %s/n",key,Z_STRVAL(tmpcopy));#endif	addToMap(final_res,key,Z_STRVAL(tmpcopy));      }    }    /* Toss out old copy */     zval_dtor(&tmpcopy);   }  return final_res;}
开发者ID:OSGeo,项目名称:zoo-project,代码行数:60,


示例27: zend_optimizer_collect_constant

static void zend_optimizer_collect_constant(HashTable **constants, zval *name, zval* value){	zval val;	if (!*constants) {		*constants = emalloc(sizeof(HashTable));		zend_hash_init(*constants, 16, NULL, (void (*)(void *))zend_optimizer_zval_dtor_wrapper, 0);	}	val = *value;	zval_copy_ctor(&val);	zend_hash_add(*constants, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, (void**)&val, sizeof(zval), NULL);}
开发者ID:TeixeiraHub,项目名称:php-src,代码行数:12,



注:本文中的zval_copy_ctor函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ zval_dtor函数代码示例
C++ zval_add_ref函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。