• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ALLOC_HASHTABLE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PHP_RINIT_FUNCTION

static PHP_RINIT_FUNCTION(protobuf) {
  ALLOC_HASHTABLE(upb_def_to_php_obj_map);
  zend_hash_init(upb_def_to_php_obj_map, 16, NULL, ZVAL_PTR_DTOR, 0);

  ALLOC_HASHTABLE(ce_to_php_obj_map);
  zend_hash_init(ce_to_php_obj_map, 16, NULL, ZVAL_PTR_DTOR, 0);

  generated_pool = NULL;
  generated_pool_php = NULL;
}
开发者ID:maniacs-ops,项目名称:protobuf,代码行数:10,代码来源:protobuf.c


示例2: _hprose_class_manager_register

void _hprose_class_manager_register(char *name, int32_t nlen, char *alias, int32_t alen TSRMLS_DC) {
    hprose_bytes_io *_name = hprose_bytes_io_create(name, nlen);
    hprose_bytes_io *_alias = hprose_bytes_io_create(alias, alen);
    if (!HPROSE_G(cache1)) {
        ALLOC_HASHTABLE(HPROSE_G(cache1));
        zend_hash_init(HPROSE_G(cache1), 64, NULL, hprose_bytes_io_dtor, 0);
    }
    if (!HPROSE_G(cache2)) {
        ALLOC_HASHTABLE(HPROSE_G(cache2));
        zend_hash_init(HPROSE_G(cache2), 64, NULL, hprose_bytes_io_dtor, 0);
    }
    zend_hash_str_update_ptr(HPROSE_G(cache1), name, nlen, _alias);
    zend_hash_str_update_ptr(HPROSE_G(cache2), alias, alen, _name);
}
开发者ID:hakiu,项目名称:hprose-pecl,代码行数:14,代码来源:hprose_class_manager.c


示例3: ALLOC_HASHTABLE

static HashTable *browscap_entry_to_array(browser_data *bdata, browscap_entry *entry) {
	zval tmp;
	uint32_t i;

	HashTable *ht;
	ALLOC_HASHTABLE(ht);
	zend_hash_init(ht, 8, NULL, ZVAL_PTR_DTOR, 0);

	ZVAL_STR(&tmp, browscap_convert_pattern(entry->pattern, 0));
	zend_hash_str_add(ht, "browser_name_regex", sizeof("browser_name_regex")-1, &tmp);

	ZVAL_STR_COPY(&tmp, entry->pattern);
	zend_hash_str_add(ht, "browser_name_pattern", sizeof("browser_name_pattern")-1, &tmp);

	if (entry->parent) {
		ZVAL_STR_COPY(&tmp, entry->parent);
		zend_hash_str_add(ht, "parent", sizeof("parent")-1, &tmp);
	}

	for (i = entry->kv_start; i < entry->kv_end; i++) {
		ZVAL_STR_COPY(&tmp, bdata->kv[i].value);
		zend_hash_add(ht, bdata->kv[i].key, &tmp);
	}

	return ht;
}
开发者ID:Synchro,项目名称:php-src,代码行数:26,代码来源:browscap.c


示例4: msgfmt_do_format

/* {{{ */
static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *return_value)
{
	int count;
	UChar* formatted = NULL;
	int formatted_len = 0;
	HashTable *args_copy;

	count = zend_hash_num_elements(Z_ARRVAL_P(args));

	ALLOC_HASHTABLE(args_copy);
	zend_hash_init(args_copy, count, NULL, ZVAL_PTR_DTOR, 0);
	zend_hash_copy(args_copy, Z_ARRVAL_P(args), (copy_ctor_func_t)zval_add_ref);

	umsg_format_helper(mfo, args_copy, &formatted, &formatted_len);

	zend_hash_destroy(args_copy);
	efree(args_copy);

	if (formatted && U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) {
			efree(formatted);
	}

	if (U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) {
		RETURN_FALSE;
	} else {
		INTL_METHOD_RETVAL_UTF8(mfo, formatted, formatted_len, 1);
	}
}
开发者ID:AmesianX,项目名称:php-src,代码行数:29,代码来源:msgformat_format.c


示例5: ZEND_ASSERT

static inline zend_long *pthreads_get_guard(zend_object *zobj, zval *member) /* {{{ */
{
    HashTable *guards;
    zend_long stub, *guard;
    zval tmp;

    ZEND_ASSERT(GC_FLAGS(zobj) & IS_OBJ_USE_GUARDS);
    if (GC_FLAGS(zobj) & IS_OBJ_HAS_GUARDS) {
        guards = Z_PTR(zobj->properties_table[zobj->ce->default_properties_count]);
        ZEND_ASSERT(guards != NULL);
		if (Z_TYPE_P(member) == IS_LONG) {
			if ((guard = (zend_long *)zend_hash_index_find_ptr(guards, Z_LVAL_P(member))) != NULL) {
            	return guard;
        	}
		} else {
			if ((guard = (zend_long *)zend_hash_find_ptr(guards, Z_STR_P(member))) != NULL) {
            	return guard;
        	}
		}
        
    } else {
        ALLOC_HASHTABLE(guards);
        zend_hash_init(guards, 8, NULL, pthreads_guard_dtor, 0);
        ZVAL_PTR(&tmp, guards);
        Z_PTR(zobj->properties_table[zobj->ce->default_properties_count]) = guards;
        GC_FLAGS(zobj) |= IS_OBJ_HAS_GUARDS;
    }

    stub = 0;
	if (Z_TYPE_P(member) == IS_LONG) {
		return (zend_long *)zend_hash_index_add_mem(guards, Z_LVAL_P(member), &stub, sizeof(zend_ulong));
	} else return (zend_long *)zend_hash_add_mem(guards, Z_STR_P(member), &stub, sizeof(zend_ulong));
}
开发者ID:MHelius,项目名称:pthreads,代码行数:33,代码来源:handlers.c


示例6: luasandbox_timer_enable_profiler

int luasandbox_timer_enable_profiler(luasandbox_timer_set * lts, struct timespec * period)
{
	if (lts->profiler_running) {
		luasandbox_timer_stop_one(lts->profiler_timer, NULL);
		lts->profiler_running = 0;
	}
	lts->profiler_period = *period;
	if (lts->function_counts) {
		zend_hash_destroy(lts->function_counts);
		FREE_HASHTABLE(lts->function_counts);
		lts->function_counts = NULL;
	}
	lts->total_count = 0;
	lts->overrun_count = 0;
	if (period->tv_sec || period->tv_nsec) {
		ALLOC_HASHTABLE(lts->function_counts);
		zend_hash_init(lts->function_counts, 0, NULL, NULL, 0);
		luasandbox_timer * timer = luasandbox_timer_create_one(
			lts->sandbox, LUASANDBOX_TIMER_PROFILER);
		if (!timer) {
			return 0;
		}
		lts->profiler_running = 1;
		lts->profiler_timer = timer;
		luasandbox_timer_set_periodic(timer, &lts->profiler_period);
	}
	return 1;
}
开发者ID:wikimedia,项目名称:mediawiki-php-luasandbox,代码行数:28,代码来源:timer.c


示例7: switch

/* {{{ php_oci_lob_create()
 Create LOB descriptor and allocate all the resources needed */
php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC)
{
	php_oci_descriptor *descriptor;

	switch (type) {
		case OCI_DTYPE_FILE:
		case OCI_DTYPE_LOB:
		case OCI_DTYPE_ROWID:
			/* these three are allowed */
			break;
		default:
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown descriptor type %ld", type);
			return NULL;
			break;
	}

	descriptor = ecalloc(1, sizeof(php_oci_descriptor));
	descriptor->type = type;
	descriptor->connection = connection;
	zend_list_addref(descriptor->connection->rsrc_id);

	PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));

	if (OCI_G(errcode) != OCI_SUCCESS) {
		OCI_G(errcode) = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
		PHP_OCI_HANDLE_ERROR(connection, OCI_G(errcode));
		efree(descriptor);
		return NULL;
	}

	PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor);
	
	descriptor->lob_current_position = 0;
	descriptor->lob_size = -1;				/* we should set it to -1 to know, that it's just not initialized */
	descriptor->buffering = PHP_OCI_LOB_BUFFER_DISABLED;				/* buffering is off by default */
	descriptor->charset_form = SQLCS_IMPLICIT;	/* default value */
	descriptor->charset_id = connection->charset;
	descriptor->is_open = 0;

	if (descriptor->type == OCI_DTYPE_LOB || descriptor->type == OCI_DTYPE_FILE) {
		/* add Lobs & Files to hash. we'll flush them at the end */
		if (!connection->descriptors) {
			ALLOC_HASHTABLE(connection->descriptors);
			zend_hash_init(connection->descriptors, 0, NULL, php_oci_descriptor_flush_hash_dtor, 0);
			connection->descriptor_count = 0;
		}
		
		descriptor->index = (connection->descriptor_count)++;
		if (connection->descriptor_count == LONG_MAX) {
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal descriptor counter has reached limit");
			php_oci_connection_descriptors_free(connection TSRMLS_CC);
			return NULL;
		}

		zend_hash_index_update(connection->descriptors,descriptor->index,&descriptor,sizeof(php_oci_descriptor *),NULL);
	}
	return descriptor;

} /* }}} */
开发者ID:NobleGaz,项目名称:PHP,代码行数:61,代码来源:oci8_lob.c


示例8: ecalloc

/* {{{ xsl_objects_new */
zend_object *xsl_objects_new(zend_class_entry *class_type)
{
	xsl_object *intern;

	intern = ecalloc(1, sizeof(xsl_object) + sizeof(zval) * (class_type->default_properties_count - 1));
	intern->securityPrefs = XSL_SECPREF_DEFAULT;

	zend_object_std_init(&intern->std, class_type);
	object_properties_init(&intern->std, class_type);
	ALLOC_HASHTABLE(intern->parameter);
	zend_hash_init(intern->parameter, 0, NULL, ZVAL_PTR_DTOR, 0);
	ALLOC_HASHTABLE(intern->registered_phpfunctions);
	zend_hash_init(intern->registered_phpfunctions, 0, NULL, ZVAL_PTR_DTOR, 0);

	intern->std.handlers = &xsl_object_handlers;
	return &intern->std;
}
开发者ID:AmesianX,项目名称:php-src,代码行数:18,代码来源:php_xsl.c


示例9: ALLOC_HASHTABLE

static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{ */
{
	zend_closure *closure = (zend_closure *)Z_OBJ_P(object);
	zval val;
	struct _zend_arg_info *arg_info = closure->func.common.arg_info;

	*is_temp = 0;

	if (closure->debug_info == NULL) {
		ALLOC_HASHTABLE(closure->debug_info);
		zend_hash_init(closure->debug_info, 8, NULL, ZVAL_PTR_DTOR, 0);
	}
	if (closure->debug_info->u.v.nApplyCount == 0) {
		if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) {
			HashTable *static_variables = closure->func.op_array.static_variables;
			ZVAL_ARR(&val, zend_array_dup(static_variables));
			zend_hash_str_update(closure->debug_info, "static", sizeof("static")-1, &val);
		}

		if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
			Z_ADDREF(closure->this_ptr);
			zend_hash_str_update(closure->debug_info, "this", sizeof("this")-1, &closure->this_ptr);
		}

		if (arg_info &&
		    (closure->func.common.num_args ||
		     (closure->func.common.fn_flags & ZEND_ACC_VARIADIC))) {
			uint32_t i, num_args, required = closure->func.common.required_num_args;

			array_init(&val);

			num_args = closure->func.common.num_args;
			if (closure->func.common.fn_flags & ZEND_ACC_VARIADIC) {
				num_args++;
			}
			for (i = 0; i < num_args; i++) {
				zend_string *name;
				zval info;
				if (arg_info->name) {
					name = zend_strpprintf(0, "%s$%s",
							arg_info->pass_by_reference ? "&" : "",
							arg_info->name->val);
				} else {
					name = zend_strpprintf(0, "%s$param%d",
							arg_info->pass_by_reference ? "&" : "",
							i + 1);
				}
				ZVAL_NEW_STR(&info, zend_strpprintf(0, "%s", i >= required ? "<optional>" : "<required>"));
				zend_hash_update(Z_ARRVAL(val), name, &info);
				zend_string_release(name);
				arg_info++;
			}
			zend_hash_str_update(closure->debug_info, "parameter", sizeof("parameter")-1, &val);
		}
	}

	return closure->debug_info;
}
开发者ID:Crell,项目名称:php-src,代码行数:58,代码来源:zend_closures.c


示例10: PHP_METHOD

/* {{{ proto void SolrInputDocument::__clone(void)
  Clones the current object. Not to be called directly. */
PHP_METHOD(SolrInputDocument, __clone)
{
	zval *objptr = getThis();
	solr_document_t new_solr_doc;
	solr_document_t *new_doc_entry = NULL, *old_doc_entry = NULL;
	ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX();

	new_doc_entry = &new_solr_doc;

	new_doc_entry = (solr_document_t *) pemalloc(sizeof(solr_document_t), SOLR_DOCUMENT_PERSISTENT);
	memset(&new_solr_doc, 0, sizeof(solr_document_t));

	/* Retrieve the document entry for the original SolrDocument */
	if (solr_fetch_document_entry(objptr, &old_doc_entry TSRMLS_CC) == FAILURE) {

		return ;
	}

	/* Duplicate the doc_entry contents */
	memcpy(new_doc_entry, old_doc_entry, sizeof(solr_document_t));

	/* Override the document index with a new one and create a new HashTable */
	new_doc_entry->document_index = document_index;

	/* Allocate new memory for the fields HashTable, using fast cache for HashTables */
	ALLOC_HASHTABLE(new_doc_entry->fields);
	ALLOC_HASHTABLE(new_doc_entry->children);

	/* Initializing the hash table used for storing fields in this SolrDocument */
	zend_hash_init(new_doc_entry->fields, old_doc_entry->fields->nTableSize, NULL, (dtor_func_t) solr_destroy_field_list_ht_dtor, SOLR_DOCUMENT_FIELD_PERSISTENT);
	zend_hash_init(new_doc_entry->children, old_doc_entry->children->nTableSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT);

	/* Copy the contents of the old fields HashTable to the new SolrDocument */
	zend_hash_copy(new_doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor);
	zend_hash_copy(new_doc_entry->children, old_doc_entry->children, (copy_ctor_func_t) zval_add_ref);

	/* Add the document entry to the directory of documents */
	zend_hash_index_update_ptr(SOLR_GLOBAL(documents), document_index, (void *) new_doc_entry);

	/* Set the value of the internal id property */
	zend_update_property_long(solr_ce_SolrInputDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC);

	/* Keep track of how many SolrDocument instances we currently have */
	SOLR_GLOBAL(document_count)++;
}
开发者ID:0mars,项目名称:pecl-search_engine-solr,代码行数:47,代码来源:php_solr_input_document.c


示例11: PHP_METHOD

/* {{{ proto void SolrInputDocument::__construct()
	SolrInputDocument constructor */
PHP_METHOD(SolrInputDocument, __construct)
{
	zval *objptr = getThis();
	uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE;
	ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX();
	auto solr_document_t solr_doc;
	solr_document_t *doc_entry = NULL, *doc_ptr = NULL;

	memset(&solr_doc, 0, sizeof(solr_document_t));

	doc_entry = &solr_doc;

	doc_entry->document_index  = document_index;
	doc_entry->field_count     = 0L;
	doc_entry->document_boost  = 0.0f;

	/* Allocated memory for the fields HashTable using fast cache for HashTables */
	ALLOC_HASHTABLE(doc_entry->fields);
	ALLOC_HASHTABLE(doc_entry->children);

	/* Initializing the hash table used for storing fields in this SolrDocument */
	zend_hash_init(doc_entry->fields, nSize, NULL, (dtor_func_t) solr_destroy_field_list, SOLR_DOCUMENT_FIELD_PERSISTENT);
	zend_hash_init(doc_entry->children, nSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT);

	/* Let's check one more time before insert into the HashTable */
	if (zend_hash_index_exists(SOLR_GLOBAL(documents), document_index)) {

		pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT);
		pefree(doc_entry->children, SOLR_DOCUMENT_FIELD_PERSISTENT);

		return;
	}

	/* Add the document entry to the directory of documents */
	zend_hash_index_update(SOLR_GLOBAL(documents), document_index, (void *) doc_entry, sizeof(solr_document_t), (void **) &doc_ptr);

	/* Set the value of the internal id property */
	zend_update_property_long(solr_ce_SolrInputDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC);

	/* Keep track of how many SolrDocument instances we currently have */
	SOLR_GLOBAL(document_count)++;

	/* Overriding the default object handlers */
	Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers;
}
开发者ID:cfgxy,项目名称:php-solr,代码行数:47,代码来源:php_solr_input_document.c


示例12: php_stream_filter_register_factory_volatile

/* API for registering VOLATILE wrappers */
PHPAPI int php_stream_filter_register_factory_volatile(const char *filterpattern, php_stream_filter_factory *factory)
{
	if (!FG(stream_filters)) {
		ALLOC_HASHTABLE(FG(stream_filters));
		zend_hash_init(FG(stream_filters), zend_hash_num_elements(&stream_filters_hash), NULL, NULL, 1);
		zend_hash_copy(FG(stream_filters), &stream_filters_hash, NULL);
	}

	return zend_hash_str_add_ptr(FG(stream_filters), (char*)filterpattern, strlen(filterpattern), factory) ? SUCCESS : FAILURE;
}
开发者ID:PeeHaa,项目名称:php-src,代码行数:11,代码来源:filter.c


示例13: PHP_METHOD

PHP_METHOD(MIME, load) {
	zval *array, *arg, retval;

	/* Fetch allowHEAD */
	MAKE_STD_ZVAL(array);
	array_init_size(array, 2);
	add_next_index_stringl(array, "Pancake\\Config", sizeof("Pancake\\Config") - 1, 1);
	add_next_index_stringl(array, "get", 3, 1);

	MAKE_STD_ZVAL(arg);
	Z_TYPE_P(arg) = IS_STRING;
	Z_STRLEN_P(arg) = 4;
	Z_STRVAL_P(arg) = estrndup("mime", 4);

	call_user_function(CG(function_table), NULL, array, &retval, 1, &arg TSRMLS_CC);

	if(Z_TYPE(retval) != IS_ARRAY) {
		zend_error(E_ERROR, "Bad MIME type array - Please check Pancake MIME type configuration");
	}

	ALLOC_HASHTABLE(PANCAKE_GLOBALS(mimeTable));
	zend_hash_init(PANCAKE_GLOBALS(mimeTable), 0, NULL, ZVAL_PTR_DTOR, 0);

	zval **data, **ext;
	char *key;

	for(zend_hash_internal_pointer_reset(Z_ARRVAL(retval));
		zend_hash_get_current_data(Z_ARRVAL(retval), (void**) &data) == SUCCESS &&
		zend_hash_get_current_key(Z_ARRVAL(retval), &key, NULL, 0) == HASH_KEY_IS_STRING;
		zend_hash_move_forward(Z_ARRVAL(retval))) {

		for(zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data));
			zend_hash_get_current_data(Z_ARRVAL_PP(data), (void**) &ext) == SUCCESS;
			zend_hash_move_forward(Z_ARRVAL_PP(data))) {

			zval *zkey;
			MAKE_STD_ZVAL(zkey);
			Z_TYPE_P(zkey) = IS_STRING;
			Z_STRLEN_P(zkey) = strlen(key);
			Z_STRVAL_P(zkey) = estrndup(key, Z_STRLEN_P(zkey));

			zend_hash_add(PANCAKE_GLOBALS(mimeTable), Z_STRVAL_PP(ext), Z_STRLEN_PP(ext), (void*) &zkey, sizeof(zval*), NULL);
		}
	}

	MAKE_STD_ZVAL(PANCAKE_GLOBALS(defaultMimeType));
	Z_TYPE_P(PANCAKE_GLOBALS(defaultMimeType)) = IS_STRING;
	Z_STRLEN_P(PANCAKE_GLOBALS(defaultMimeType)) = sizeof("application/octet-stream") - 1;
	Z_STRVAL_P(PANCAKE_GLOBALS(defaultMimeType)) = estrndup("application/octet-stream", sizeof("application/octet-stream") - 1);

	free:
	zval_dtor(&retval);
	zval_ptr_dtor(&array);
	zval_ptr_dtor(&arg);
}
开发者ID:nhnam,项目名称:Pancake,代码行数:55,代码来源:Pancake_MIME.c


示例14: ALLOC_HASHTABLE

/* {{{ get_debug_info handler for TimeZone */
static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
{
	zval			zv;
	TimeZone_object	*to;
	const TimeZone	*tz;
	UnicodeString	ustr;
	char			*str;
	size_t			str_len;
	HashTable 		*debug_info;
	UErrorCode		uec = U_ZERO_ERROR;

	*is_temp = 1;
	
	ALLOC_HASHTABLE(debug_info);
	zend_hash_init(debug_info, 8, NULL, ZVAL_PTR_DTOR, 0);

	to = Z_INTL_TIMEZONE_P(object);
	tz = to->utimezone;

	if (tz == NULL) {
		ZVAL_FALSE(&zv);
		zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);
		return debug_info;
	}

	ZVAL_TRUE(&zv);
	zend_hash_str_update(debug_info, "valid", sizeof("valid") - 1, &zv);

	tz->getID(ustr);
	intl_convert_utf16_to_utf8(&str, &str_len,
		ustr.getBuffer(), ustr.length(), &uec);
	if (U_FAILURE(uec)) {
		return debug_info;
	}
	ZVAL_STRINGL(&zv, str, str_len);
	zend_hash_str_update(debug_info, "id", sizeof("id") - 1, &zv);
	// TODO: avoid reallocation ???
	efree(str);

	int32_t rawOffset, dstOffset;
	UDate now = Calendar::getNow();
	tz->getOffset(now, FALSE, rawOffset, dstOffset, uec);
	if (U_FAILURE(uec)) {
		return debug_info;
	}
	
	ZVAL_LONG(&zv, (zend_long)rawOffset);
	zend_hash_str_update(debug_info,"rawOffset", sizeof("rawOffset") - 1, &zv); 
	ZVAL_LONG(&zv, (zend_long)(rawOffset + dstOffset));
	zend_hash_str_update(debug_info,"currentOffset", sizeof("currentOffset") - 1, &zv); 

	return debug_info;
}
开发者ID:Tyrael,项目名称:php-src,代码行数:54,代码来源:timezone_class.cpp


示例15: msgpack_serialize_var_init

void msgpack_serialize_var_init(msgpack_serialize_data_t *var_hash)
{
    HashTable **var_hash_ptr = (HashTable **)var_hash;
    TSRMLS_FETCH();

    if (MSGPACK_G(serialize).level) {
        *var_hash_ptr = MSGPACK_G(serialize).var_hash;
    } else {
        ALLOC_HASHTABLE(*var_hash_ptr);
        zend_hash_init(*var_hash_ptr, 10, NULL, NULL, 0);
        MSGPACK_G(serialize).var_hash = *var_hash_ptr;
    }
    ++MSGPACK_G(serialize).level;
}
开发者ID:capcomvertigo,项目名称:msgpack-php,代码行数:14,代码来源:msgpack_unpack.c


示例16: PHP_METHOD

PHP_METHOD(SolrCollapseFunction, __construct)
{
    long int index = SOLR_UNIQUE_FUNCTION_INDEX();
    uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE;
    solr_function_t *solr_function_dest = NULL;
    solr_function_t solr_function;
    zval *index_prop, *zvfield = NULL;

    solr_char_t *param_name = (solr_char_t *)"field";
    int param_name_len = sizeof("field");

    solr_string_t field_str;

    solr_char_t *field_name = NULL;
    int field_name_len = 0;

    memset(&solr_function, 0, sizeof(solr_function_t));

    if (zend_hash_index_update(SOLR_GLOBAL(functions),index,(void *) &solr_function, sizeof(solr_function_t), (void **) &solr_function_dest) == FAILURE)
    {
        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering query parameters in HashTable");

        return ;
    }
    index_prop = zend_read_property(Z_OBJCE_P(getThis()), getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1 TSRMLS_CC);
    Z_LVAL_P(index_prop) = index;

    solr_function_dest->function_index = index;
    solr_function_dest->name = (solr_char_t *)"collapse";
    solr_function_dest->name_length = sizeof(solr_function_dest->name);

    /* Allocated memory for the params HashTable using fast cache for HashTables */
    ALLOC_HASHTABLE(solr_function_dest->params);
    zend_hash_init(solr_function_dest->params, nSize, NULL, (dtor_func_t) solr_string_free_ex, SOLR_FUNCTIONS_PERSISTENT);

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE)
    {
        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error Parsing Parameters");
        return;
    }

    if (field_name_len > 0 ) {
        memset(&field_str, 0, sizeof(solr_string_t));
        solr_string_set(&field_str, (solr_char_t *)field_name, field_name_len);
        if(zend_hash_update(solr_function_dest->params, param_name, param_name_len, (void **)&field_str, sizeof(solr_string_t), NULL) == FAILURE)
        {
            php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field");
        }
    }
}
开发者ID:marcosptf,项目名称:pecl-search_engine-solr,代码行数:50,代码来源:php_solr_collapse_function.c


示例17: _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();
开发者ID:AxiosCros,项目名称:php-src,代码行数:50,代码来源:proc_open.c


示例18: spl_dllist_object_get_debug_info

static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {{{{ */
{
	spl_dllist_object     *intern  = Z_SPLDLLIST_P(obj);
	spl_ptr_llist_element *current = intern->llist->head, *next;
	zval tmp, dllist_array;
	zend_string *pnstr;
	int  i = 0;

	*is_temp = 0;

	if (intern->debug_info == NULL) {
		ALLOC_HASHTABLE(intern->debug_info);
		zend_hash_init(intern->debug_info, 1, NULL, ZVAL_PTR_DTOR, 0);
	}

	if (intern->debug_info->u.v.nApplyCount == 0) {

		if (!intern->std.properties) {
			rebuild_object_properties(&intern->std);
		}
		zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref);

		pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "flags", sizeof("flags")-1);
		ZVAL_LONG(&tmp, intern->flags);
		zend_hash_add(intern->debug_info, pnstr, &tmp);
		zend_string_release(pnstr);

		array_init(&dllist_array);

		while (current) {
			next = current->next;

			add_index_zval(&dllist_array, i, &current->data);
			if (Z_REFCOUNTED(current->data)) {
				Z_ADDREF(current->data);
			}
			i++;

			current = next;
		}

		pnstr = spl_gen_private_prop_name(spl_ce_SplDoublyLinkedList, "dllist", sizeof("dllist")-1);
		zend_hash_add(intern->debug_info, pnstr, &dllist_array);
		zend_string_release(pnstr);
	}

	return intern->debug_info;
}
开发者ID:AmesianX,项目名称:php-src,代码行数:48,代码来源:spl_dllist.c


示例19: spl_heap_object_get_debug_info_helper

static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zval *obj, int *is_temp) { /* {{{ */
	spl_heap_object *intern  = Z_SPLHEAP_P(obj);
	zval tmp, heap_array;
	zend_string *pnstr;
	int  i;

	*is_temp = 0;

	if (!intern->std.properties) {
		rebuild_object_properties(&intern->std);
	}

	if (intern->debug_info == NULL) {
		ALLOC_HASHTABLE(intern->debug_info);
		ZEND_INIT_SYMTABLE_EX(intern->debug_info, zend_hash_num_elements(intern->std.properties) + 1, 0);
	}

	if (intern->debug_info->u.v.nApplyCount == 0) {

		zend_hash_copy(intern->debug_info, intern->std.properties, (copy_ctor_func_t) zval_add_ref);

		pnstr = spl_gen_private_prop_name(ce, "flags", sizeof("flags")-1);
		ZVAL_LONG(&tmp, intern->flags);
		zend_hash_update(intern->debug_info, pnstr, &tmp);
		zend_string_release(pnstr);

		pnstr = spl_gen_private_prop_name(ce, "isCorrupted", sizeof("isCorrupted")-1);
		ZVAL_BOOL(&tmp, intern->heap->flags&SPL_HEAP_CORRUPTED);
		zend_hash_update(intern->debug_info, pnstr, &tmp);
		zend_string_release(pnstr);

		array_init(&heap_array);

		for (i = 0; i < intern->heap->count; ++i) {
			add_index_zval(&heap_array, i, &intern->heap->elements[i]);
			if (Z_REFCOUNTED(intern->heap->elements[i])) {
				Z_ADDREF(intern->heap->elements[i]);
			}
		}

		pnstr = spl_gen_private_prop_name(ce, "heap", sizeof("heap")-1);
		zend_hash_update(intern->debug_info, pnstr, &heap_array);
		zend_string_release(pnstr);
	}

	return intern->debug_info;
}
开发者ID:AmesianX,项目名称:php-src,代码行数:47,代码来源:spl_heap.c


示例20: php_com_get_id_of_name

/* map an ID to a name */
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
		size_t namelen, DISPID *dispid)
{
	OLECHAR *olename;
	HRESULT hr;
	zval *tmp;

	if (namelen == -1) {
		namelen = strlen(name);
	}

	if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) {
		*dispid = (DISPID)Z_LVAL_P(tmp);
		return S_OK;
	}
	
	olename = php_com_string_to_olestring(name, namelen, obj->code_page);

	if (obj->typeinfo) {
		hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);
		if (FAILED(hr)) {
			hr = IDispatch_GetIDsOfNames(V_DISPATCH(&obj->v), &IID_NULL, &olename, 1, LOCALE_SYSTEM_DEFAULT, dispid);
			if (SUCCEEDED(hr)) {
				/* fall back on IDispatch direct */
				ITypeInfo_Release(obj->typeinfo);
				obj->typeinfo = NULL;
			}
		}
	} else {
		hr = IDispatch_GetIDsOfNames(V_DISPATCH(&obj->v), &IID_NULL, &olename, 1, LOCALE_SYSTEM_DEFAULT, dispid);
	}
	efree(olename);

	if (SUCCEEDED(hr)) {
		zval tmp;

		/* cache the mapping */
		if (!obj->id_of_name_cache) {
			ALLOC_HASHTABLE(obj->id_of_name_cache);
			zend_hash_init(obj->id_of_name_cache, 2, NULL, NULL, 0);
		}
		ZVAL_LONG(&tmp, *dispid);
		zend_hash_str_update(obj->id_of_name_cache, name, namelen, &tmp);
	}
	
	return hr;
}
开发者ID:AmesianX,项目名称:php-src,代码行数:48,代码来源:com_com.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ALLOC_INIT_ZVAL函数代码示例发布时间:2022-05-30
下一篇:
C++ ALLOC_GROW函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap