这篇教程C++ zend_hash_internal_pointer_reset_ex函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zend_hash_internal_pointer_reset_ex函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_hash_internal_pointer_reset_ex函数的具体用法?C++ zend_hash_internal_pointer_reset_ex怎么用?C++ zend_hash_internal_pointer_reset_ex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zend_hash_internal_pointer_reset_ex函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PHP_METHOD/** * Resets the request and internal values to avoid those fields will have any default value */PHP_METHOD(Phalcon_Tag, resetInput){ zval *value = NULL, *key = NULL; zval *a0 = NULL; zval *g0 = NULL; HashTable *ah0; HashPosition hp0; zval **hd; char *hash_index; uint hash_index_len; ulong hash_num; int hash_type; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(a0); array_init(a0); phalcon_update_static_property(SL("phalcon//tag"), SL("_displayValues"), a0 TSRMLS_CC); phalcon_get_global(&g0, SL("_POST")+1 TSRMLS_CC); if (!phalcon_valid_foreach(g0 TSRMLS_CC)) { return; } ALLOC_HASHTABLE(ah0); zend_hash_init(ah0, 0, NULL, NULL, 0); zend_hash_copy(ah0, Z_ARRVAL_P(g0), NULL, NULL, sizeof(zval*)); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_9b93_0: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_9b93_0; } PHALCON_INIT_VAR(key); PHALCON_GET_FOREACH_KEY(key, ah0, hp0); PHALCON_INIT_VAR(value); ZVAL_ZVAL(value, *hd, 1, 0); phalcon_array_unset(g0, key); zend_hash_move_forward_ex(ah0, &hp0); goto fes_9b93_0; fee_9b93_0: zend_hash_destroy(ah0); efree(ah0); PHALCON_MM_RESTORE();}
开发者ID:codeanu,项目名称:cphalcon,代码行数:48,
示例2: zval_to_arrayVALUE zval_to_array(zval *zv) { HashTable *ht; HashPosition pos; zval **data; VALUE ret; convert_to_array(zv); ht = Z_ARRVAL_P(zv); ret = rb_ary_new2(zend_hash_num_elements(ht)); zend_hash_internal_pointer_reset_ex(ht, &pos); while (SUCCESS == zend_hash_get_current_data_ex(ht, (void **)&data, &pos)) { rb_ary_push(ret, new_php_embed_value(*data)); zend_hash_move_forward_ex(ht, &pos); } return ret;}
开发者ID:Epictetus,项目名称:php_embed,代码行数:18,
示例3: php_mimepart_enum_child_partsPHP_MAILPARSE_API void php_mimepart_enum_child_parts(php_mimepart *part, mimepart_child_enumerator_func callback, void *ptr){ HashPosition pos; php_mimepart *childpart; zval *childpart_z; int index = 0; zend_hash_internal_pointer_reset_ex(&part->children, &pos); while ((childpart_z = zend_hash_get_current_data_ex(&part->children, &pos)) != NULL) { mailparse_fetch_mimepart_resource(childpart, childpart_z); if (FAILURE == (*callback)(part, childpart, index, ptr)) return; zend_hash_move_forward_ex(&part->children, &pos); index++; }}
开发者ID:php,项目名称:pecl-mail-mailparse,代码行数:18,
示例4: msgpack_check_ht_is_mapinline static int msgpack_check_ht_is_map(zval *array) { int count = zend_hash_num_elements(Z_ARRVAL_P(array)); if (count != (Z_ARRVAL_P(array))->nNextFreeElement) { return 1; } else { int i; HashPosition pos = {0}; zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), &pos); for (i = 0; i < count; i++) { if (zend_hash_get_current_key_type_ex(Z_ARRVAL_P(array), &pos) != HASH_KEY_IS_LONG) { return 1; } zend_hash_move_forward_ex(Z_ARRVAL_P(array), &pos); } } return 0;}
开发者ID:caoge,项目名称:php-cp,代码行数:19,
示例5: php_hash_to_rstatic SEXP php_hash_to_r(HashTable *ht) /* {{{ */{ SEXP values, keys, r_element; int n, i; HashPosition pos; zval **element; n = zend_hash_num_elements(ht); if (!n) { return 0; } PROTECT(values = NEW_LIST(n)); PROTECT(keys = NEW_CHARACTER(n)); i = 0; for (zend_hash_internal_pointer_reset_ex(ht, &pos); zend_hash_get_current_data_ex(ht, (void **) &element, &pos) == SUCCESS; zend_hash_move_forward_ex(ht, &pos) ) { char *string_key; uint string_key_len; ulong num_key; r_element = php_zval_to_r(element); switch (zend_hash_get_current_key_ex(ht, &string_key, &string_key_len, &num_key, 0, &pos)) { case HASH_KEY_IS_STRING: if (string_key_len > 0) { SET_STRING_ELT(keys, i, COPY_TO_USER_STRING(string_key)); } break; case HASH_KEY_IS_LONG: /* ignore the key */ break; } i++; } SET_NAMES(values, keys); UNPROTECT(2); return values;}
开发者ID:tony2001,项目名称:arrr,代码行数:43,
示例6: mysqlnd_minfo_print_hashPHPAPI void mysqlnd_minfo_print_hash(zval *values){ zval **values_entry; HashPosition pos_values; zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos_values); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&values_entry, &pos_values) == SUCCESS) { char *string_key; uint string_key_len; ulong num_key; zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &string_key, &string_key_len, &num_key, 0, &pos_values); convert_to_string(*values_entry); php_info_print_table_row(2, string_key, Z_STRVAL_PP(values_entry)); zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values); }}
开发者ID:66Ton99,项目名称:php5.4-ppa,代码行数:19,
示例7: oauth_provider_apply_custom_paramstatic void oauth_provider_apply_custom_param(HashTable *ht, HashTable *custom) /* {{{ */{ HashPosition custompos; zval *entry; zend_string *key; ulong num_key; zend_hash_internal_pointer_reset_ex(custom, &custompos); do { if ((entry = zend_hash_get_current_data_ex(custom, &custompos)) != NULL && HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(custom, &key, &num_key, &custompos)) { if (IS_NULL == Z_TYPE_P(entry)) { zend_hash_del(ht, key); } else { Z_ADDREF_P(entry); zend_hash_update(ht, key, entry); } } } while (SUCCESS==zend_hash_move_forward_ex(custom, &custompos));}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:19,
示例8: print_hashstatic void print_hash(zend_write_func_t write_func, HashTable *ht, int indent){ zval **tmp; char *string_key; HashPosition iterator; ulong num_key; uint str_len; int i; for (i=0; i<indent; i++) { ZEND_PUTS_EX(" "); } ZEND_PUTS_EX("(/n"); indent += PRINT_ZVAL_INDENT; zend_hash_internal_pointer_reset_ex(ht, &iterator); while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) { for (i=0; i<indent; i++) { ZEND_PUTS_EX(" "); } ZEND_PUTS_EX("["); switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { case HASH_KEY_IS_STRING: ZEND_WRITE_EX(string_key, str_len-1); break; case HASH_KEY_IS_LONG: { char key[25]; sprintf(key, "%ld", num_key); ZEND_PUTS_EX(key); } break; } ZEND_PUTS_EX("] => "); zend_print_zval_r_ex(write_func, *tmp, indent+PRINT_ZVAL_INDENT); ZEND_PUTS_EX("/n"); zend_hash_move_forward_ex(ht, &iterator); } indent -= PRINT_ZVAL_INDENT; for (i=0; i<indent; i++) { ZEND_PUTS_EX(" "); } ZEND_PUTS_EX(")/n");}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:43,
示例9: foreach_in_hashtablevoid foreach_in_hashtable(void* callingObj, void* custom_ptr, HashTable *ht, ht_entry_callback cb TSRMLS_DC){ zval **data; HashPosition pointer; HashTable *hindex = ht; uint key_len, key_type; ulong index; int cnt = 0; char *key; for(zend_hash_internal_pointer_reset_ex(hindex, &pointer); zend_hash_get_current_data_ex(hindex, (void**)&data, &pointer) == SUCCESS; zend_hash_move_forward_ex(hindex, &pointer)) { key_type = zend_hash_get_current_key_ex(hindex, &key, &key_len, &index, 0, &pointer); if (key_type == HASH_KEY_IS_STRING) { (*cb)(callingObj, custom_ptr, key, key_len, 0, data, cnt++ TSRMLS_CC); } else if (key_type == HASH_KEY_IS_LONG) { (*cb)(callingObj, custom_ptr, NULL, 0, index, data, cnt++ TSRMLS_CC); } }}
开发者ID:Elbandi,项目名称:php_riak,代码行数:20,
示例10: zend_hash_internal_pointer_reset_exPHP_MAILPARSE_API php_mimepart *php_mimepart_find_child_by_position(php_mimepart *parent, int position){ HashPosition pos; php_mimepart *childpart = NULL; zval *childpart_z; zend_hash_internal_pointer_reset_ex(&parent->children, &pos); while(position-- > 0) if (FAILURE == zend_hash_move_forward_ex(&parent->children, &pos)) return NULL; if ((childpart_z = zend_hash_get_current_data_ex(&parent->children, &pos)) != NULL) { mailparse_fetch_mimepart_resource(childpart, childpart_z); if(childpart) { return childpart; } } return NULL;}
开发者ID:php,项目名称:pecl-mail-mailparse,代码行数:20,
示例11: PHP_METHOD/* {{{ proto bool ProtocolBuffersEnum::isValid(long $value)*/PHP_METHOD(protocolbuffers_enum, isValid){#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 3) zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "ProtocolBuffersEnum::isValid can't work under PHP 5.3. please consider upgrading your PHP"); return;#else long value; zval *result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &value) == FAILURE) { return; } if (zend_call_method_with_0_params(NULL, EG(called_scope), NULL, "getenumdescriptor", &result)) { zval *values, **entry; HashPosition pos; if (!instanceof_function_ex(Z_OBJCE_P(result), php_protocol_buffers_enum_descriptor_class_entry, 0 TSRMLS_CC)) { zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "ProtocolBuffersEnum::getEnumDescriptor returns unexpected value."); zval_ptr_dtor(&result); return; } php_protocolbuffers_read_protected_property(result, ZEND_STRS("values"), &values TSRMLS_CC); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&entry, &pos) == SUCCESS) { if (Z_LVAL_PP(entry) == value) { RETVAL_TRUE; break; } zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos); } zval_ptr_dtor(&result); RETVAL_FALSE; } else { zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "cannot call ProtocolBuffersEnum::getEnumDescriptor."); return; }#endif}
开发者ID:Easthy,项目名称:php-protocolbuffers,代码行数:43,
示例12: pthreads_stack_pop/* {{{ pop for php */size_t pthreads_stack_pop(PTHREAD thread, PTHREAD work TSRMLS_DC) { zend_bool locked; int remain = 0; if (pthreads_lock_acquire(thread->lock, &locked TSRMLS_CC)) { HashTable *stack = &thread->stack->objects; if (work) { HashPosition position; PTHREAD search = NULL; for (zend_hash_internal_pointer_reset_ex(stack, &position); zend_hash_get_current_data_ex(stack, (void**)&search, &position) == SUCCESS; zend_hash_move_forward_ex(stack, &position)) { /* arghhh */ } } else zend_hash_destroy(stack); remain = zend_hash_num_elements(stack); pthreads_lock_release(thread->lock, locked TSRMLS_CC); } else remain = -1; return remain;} /* }}} */
开发者ID:Danack,项目名称:pthreads,代码行数:22,
示例13: wkhtmltox_set_paramsvoid wkhtmltox_set_params(void *settings, fp set_function, zval *params){ zval **data; HashTable *params_hash; HashPosition pointer; int params_count; char *key; int key_len; long index; 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: set_function(settings, key, Z_STRVAL(temp)); break; } /* convert_to_string(&temp); php_printf("%s => %s/n", key, Z_STRVAL(temp)); */ } zval_dtor(&temp); }}
开发者ID:char101,项目名称:php-wkhtmltox,代码行数:40,
示例14: php_dba_make_key/* {{{ php_dba_myke_key */static size_t php_dba_make_key(zval *key, char **key_str, char **key_free){ if (Z_TYPE_P(key) == IS_ARRAY) { zval *group, *name; HashPosition pos; size_t len; if (zend_hash_num_elements(Z_ARRVAL_P(key)) != 2) { php_error_docref(NULL, E_RECOVERABLE_ERROR, "Key does not have exactly two elements: (key, name)"); return 0; } zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(key), &pos); group = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos); zend_hash_move_forward_ex(Z_ARRVAL_P(key), &pos); name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos); convert_to_string_ex(group); convert_to_string_ex(name); if (Z_STRLEN_P(group) == 0) { *key_str = Z_STRVAL_P(name); *key_free = NULL; return Z_STRLEN_P(name); } len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name)); *key_free = *key_str; return len; } else { zval tmp; int len; ZVAL_COPY(&tmp, key); convert_to_string(&tmp); len = Z_STRLEN(tmp); if (len) { *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); } zval_ptr_dtor(&tmp); return len; }}
开发者ID:Apfelfrisch,项目名称:php-src,代码行数:41,
示例15: oauth_provider_remove_required_paramstatic int oauth_provider_remove_required_param(HashTable *ht, char *required_param) /* {{{ */{ zval *dest_entry; zend_string *key; ulong num_key; HashPosition hpos; if((dest_entry = zend_hash_str_find(ht, required_param, strlen(required_param))) == NULL) { return FAILURE; } else { zend_hash_internal_pointer_reset_ex(ht, &hpos); do { if(zend_hash_get_current_key_ex(ht, &key, &num_key, &hpos)!=FAILURE) { if(!strcmp(ZSTR_VAL(key), required_param)) { zend_hash_del(ht, key); return SUCCESS; } } } while(zend_hash_move_forward_ex(ht, &hpos)==SUCCESS); } return FAILURE;}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:22,
示例16: binary_serialize_specstaticvoid binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable* spec) { validate_thrift_object(zthis); HashPosition key_ptr; zval* val_ptr; for (zend_hash_internal_pointer_reset_ex(spec, &key_ptr); (val_ptr = zend_hash_get_current_data_ex(spec, &key_ptr)) != nullptr; zend_hash_move_forward_ex(spec, &key_ptr)) { zend_ulong fieldno; if (zend_hash_get_current_key_ex(spec, nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) { throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA); return; } HashTable* fieldspec = Z_ARRVAL_P(val_ptr); // field name val_ptr = zend_hash_str_find(fieldspec, "var", sizeof("var")-1); char* varname = Z_STRVAL_P(val_ptr); // thrift type val_ptr = zend_hash_str_find(fieldspec, "type", sizeof("type")-1); if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr); int8_t ttype = Z_LVAL_P(val_ptr); zval rv; zval* prop = zend_read_property(Z_OBJCE_P(zthis), zthis, varname, strlen(varname), false, &rv); if (Z_TYPE_P(prop) != IS_NULL) { transport.writeI8(ttype); transport.writeI16(fieldno); binary_serialize(ttype, transport, prop, fieldspec); } } transport.writeI8(T_STOP); // struct end}
开发者ID:apupier,项目名称:fn,代码行数:38,
示例17: activerecord_model_assign_attributesvoid activerecord_model_assign_attributes( zval * model, zval * attributes, zend_bool guard ){ zval * accessible = zend_read_static_property(activerecord_model_ce, "attr_accessible", 15, 0 TSRMLS_CC); zval * protected = zend_read_static_property(activerecord_model_ce, "attr_protected", 14, 0 TSRMLS_CC); zval ** attribute; int acc_count = zend_hash_num_elements(Z_ARRVAL_P(accessible)); int prt_count = zend_hash_num_elements(Z_ARRVAL_P(protected)); HashPosition pos; int index, key_len; char * key_name; for( zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(attributes), &pos); zend_hash_get_current_data_ex(Z_ARRVAL_P(attributes), (void **) &attribute, &pos) == SUCCESS; zend_hash_move_forward_ex(Z_ARRVAL_P(attributes), &pos) ) { /* if (array_key_exists($name,$table->columns)) { $value = $table->columns[$name]->cast($value,$connection); $name = $table->columns[$name]->inflected_name; } */ zend_hash_get_current_key_ex( Z_ARRVAL_P(attributes), &key_name, &key_len, &index, 0, &pos); if( guard ) { if( acc_count > 0 && !activerecord_model_array_search( accessible, key_name ) ) continue; if( prt_count > 0 && activerecord_model_array_search( protected, key_name ) ) continue; activerecord_model_magic_set( model, key_name, key_len, *attribute ); } else if( strcmp(key_name, "ar_rnum__") ) { activerecord_assign_attribute( model, key_name, key_len, *attribute ); } }
开发者ID:roeitell,项目名称:php-activerecord-plusplus,代码行数:38,
示例18: MAKE_STD_ZVALstatic zval *phannot_ret_zval_list(zval *list_left, zval *right_list){ zval *ret; HashPosition pos; HashTable *list; MAKE_STD_ZVAL(ret); array_init(ret); if (list_left) { list = Z_ARRVAL_P(list_left); if (zend_hash_index_exists(list, 0)) { zend_hash_internal_pointer_reset_ex(list, &pos); for (;; zend_hash_move_forward_ex(list, &pos)) { zval ** item; if (zend_hash_get_current_data_ex(list, (void**) &item, &pos) == FAILURE) { break; } Z_ADDREF_PP(item); add_next_index_zval(ret, *item); } zval_ptr_dtor(&list_left); } else { add_next_index_zval(ret, list_left); } } add_next_index_zval(ret, right_list); return ret;}
开发者ID:Diego-Brocanelli,项目名称:cphalcon,代码行数:37,
示例19: validate_thrift_object//is used to validate objects before serialization and after deserialization. For now, only required fields are validated.staticvoid validate_thrift_object(zval* object) { zend_class_entry* object_class_entry = Z_OBJCE_P(object); zval* is_validate = zend_read_static_property(object_class_entry, "isValidate", sizeof("isValidate")-1, false); zval* spec = zend_read_static_property(object_class_entry, "_TSPEC", sizeof("_TSPEC")-1, false); HashPosition key_ptr; zval* val_ptr; if (Z_TYPE_INFO_P(is_validate) == IS_TRUE) { for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(spec), &key_ptr); (val_ptr = zend_hash_get_current_data_ex(Z_ARRVAL_P(spec), &key_ptr)) != nullptr; zend_hash_move_forward_ex(Z_ARRVAL_P(spec), &key_ptr)) { zend_ulong fieldno; if (zend_hash_get_current_key_ex(Z_ARRVAL_P(spec), nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) { throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA); return; } HashTable* fieldspec = Z_ARRVAL_P(val_ptr); // field name zval* zvarname = zend_hash_str_find(fieldspec, "var", sizeof("var")-1); char* varname = Z_STRVAL_P(zvarname); zval* is_required = zend_hash_str_find(fieldspec, "isRequired", sizeof("isRequired")-1); zval rv; zval* prop = zend_read_property(object_class_entry, object, varname, strlen(varname), false, &rv); if (Z_TYPE_INFO_P(is_required) == IS_TRUE && Z_TYPE_P(prop) == IS_NULL) { char errbuf[128]; snprintf(errbuf, 128, "Required field %s.%s is unset!", ZSTR_VAL(object_class_entry->name), varname); throw_tprotocolexception(errbuf, INVALID_DATA); } } }}
开发者ID:apupier,项目名称:fn,代码行数:37,
示例20: StringList SharedStringList KPHPArrayObject::GetPropertyNames() { SharedStringList property_names = new StringList(); HashPosition pos; HashTable *ht = Z_ARRVAL_P(this->list); for (zend_hash_internal_pointer_reset_ex(ht, &pos); zend_hash_has_more_elements_ex(ht, &pos) == SUCCESS; zend_hash_move_forward_ex(ht, &pos)) { char *key; unsigned int keylen; unsigned long index; zend_hash_get_current_key_ex(ht, &key, &keylen, &index, 0, &pos); property_names->push_back(new std::string(key)); } zend_hash_destroy(ht); FREE_HASHTABLE(ht); return property_names; }
开发者ID:fossamikom,项目名称:TideSDK,代码行数:24,
示例21: oauth_provider_parse_auth_headerstatic int oauth_provider_parse_auth_header(php_oauth_provider *sop, char *auth_header) /* {{{ */{ pcre_cache_entry *pce; zval subpats, return_value, *item_param, *current_param, *current_val; HashPosition hpos; zend_string *regex = zend_string_init(OAUTH_REGEX, sizeof(OAUTH_REGEX) - 1, 0); size_t decoded_len; if(!auth_header || strncasecmp(auth_header, "oauth", 4) || !sop) { return FAILURE; } /* pass "OAuth " */ auth_header += 5; if ((pce = pcre_get_compiled_regex_cache(regex)) == NULL) { zend_string_release(regex); return FAILURE; } zend_string_release(regex); ZVAL_NULL(&subpats); ZVAL_NULL(&return_value); php_pcre_match_impl( pce, auth_header, strlen(auth_header), &return_value, &subpats, 1, /* global */ 1, /* use flags */ 2, /* PREG_SET_ORDER */ 0 ); if (0 == Z_LVAL(return_value)) { return FAILURE; } zend_hash_internal_pointer_reset_ex(Z_ARRVAL(subpats), &hpos); /* walk the oauth param names */ do { if ((item_param = zend_hash_get_current_data_ex(Z_ARRVAL(subpats), &hpos)) != NULL) { zval decoded_val; char *tmp; /* * item = array( * 1 => param name * 2 => quoted value * 3 => unquoted value (defined if matched) * ) */ current_param = zend_hash_index_find(Z_ARRVAL_P(item_param), 1); if ((current_val =zend_hash_index_find(Z_ARRVAL_P(item_param), 3)) == NULL) { current_val = zend_hash_index_find(Z_ARRVAL_P(item_param), 2); } tmp = estrndup(Z_STRVAL_P(current_val), Z_STRLEN_P(current_val)); decoded_len = php_url_decode(tmp, Z_STRLEN_P(current_val)); ZVAL_STRINGL(&decoded_val, tmp, decoded_len); if (oauth_provider_set_param_value(sop->oauth_params, Z_STRVAL_P(current_param), &decoded_val)==FAILURE) { return FAILURE; } Z_DELREF(decoded_val); } } while (SUCCESS==zend_hash_move_forward_ex(Z_ARRVAL(subpats), &hpos)); zval_ptr_dtor(&return_value); zval_ptr_dtor(&subpats); return SUCCESS;}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:74,
示例22: msgpack_convert_object//.........这里部分代码省略......... { case IS_ARRAY: { char *key; uint key_len; int key_type; ulong key_index; zval **data; HashPosition pos; HashTable *ht, *ret; HashTable *var = NULL; int num; ht = HASH_OF(*value); ret = HASH_OF(return_value); num = zend_hash_num_elements(ht); if (num <= 0) { zval_ptr_dtor(value); break; } /* string - php_only mode? */ if (ht->nNumOfElements != ht->nNextFreeElement || ht->nNumOfElements != ret->nNumOfElements) { HashTable *properties = NULL; HashPosition prop_pos; ALLOC_HASHTABLE(var); zend_hash_init(var, num, NULL, NULL, 0); zend_hash_internal_pointer_reset_ex(ht, &pos); for (;; zend_hash_move_forward_ex(ht, &pos)) { key_type = zend_hash_get_current_key_ex( ht, &key, &key_len, &key_index, 0, &pos); if (key_type == HASH_KEY_NON_EXISTANT) { break; } if (zend_hash_get_current_data_ex( ht, (void *)&data, &pos) != SUCCESS) { continue; } if (key_type == HASH_KEY_IS_STRING) { zval *val; MSGPACK_CONVERT_COPY_ZVAL(val, data); if (msgpack_convert_string_to_properties( return_value, key, key_len, val, var) != SUCCESS) { zval_ptr_dtor(&val); MSGPACK_WARNING( "[msgpack] (%s) " "illegal offset type, skip this decoding", __FUNCTION__); } } }
开发者ID:LoosKonstantin,项目名称:msgpack,代码行数:66,
示例23: msgpack_convert_arrayint msgpack_convert_array(zval *return_value, zval *tpl, zval **value){ TSRMLS_FETCH(); if (Z_TYPE_P(tpl) == IS_ARRAY) { char *key; uint key_len; int key_type; ulong key_index; zval **data, **arydata; HashPosition pos, valpos; HashTable *ht, *htval; int num; ht = HASH_OF(tpl); // TODO: maybe need to release memory? array_init(return_value); num = zend_hash_num_elements(ht); if (num <= 0) { MSGPACK_WARNING( "[msgpack] (%s) template array length is 0", __FUNCTION__); zval_ptr_dtor(value); return FAILURE; } /* string */ if (ht->nNumOfElements != ht->nNextFreeElement) { htval = HASH_OF(*value); if (!htval) { MSGPACK_WARNING( "[msgpack] (%s) input data is not array", __FUNCTION__); zval_ptr_dtor(value); return FAILURE; } zend_hash_internal_pointer_reset_ex(ht, &pos); zend_hash_internal_pointer_reset_ex(htval, &valpos); for (;; zend_hash_move_forward_ex(ht, &pos), zend_hash_move_forward_ex(htval, &valpos)) { key_type = zend_hash_get_current_key_ex( ht, &key, &key_len, &key_index, 0, &pos); if (key_type == HASH_KEY_NON_EXISTANT) { break; } if (zend_hash_get_current_data_ex( ht, (void *)&data, &pos) != SUCCESS) { continue; } if (key_type == HASH_KEY_IS_STRING) { int (*convert_function)(zval *, zval *, zval **) = NULL; zval **dataval, *val; switch (Z_TYPE_PP(data)) { case IS_ARRAY: convert_function = msgpack_convert_array; break; case IS_OBJECT: // case IS_STRING: convert_function = msgpack_convert_object; break; default: break; } if (zend_hash_get_current_data_ex( htval, (void *)&dataval, &valpos) != SUCCESS) { MSGPACK_WARNING( "[msgpack] (%s) can't get data", __FUNCTION__); zval_ptr_dtor(value); return FAILURE; } MSGPACK_CONVERT_COPY_ZVAL(val, dataval); if (convert_function) { zval *rv; ALLOC_INIT_ZVAL(rv); if (convert_function(rv, *data, &val) != SUCCESS) { zval_ptr_dtor(&val); return FAILURE; }//.........这里部分代码省略.........
开发者ID:LoosKonstantin,项目名称:msgpack,代码行数:101,
示例24: php_runkit_import_functions/* {{{ php_runkit_import_functions */static int php_runkit_import_functions(HashTable *function_table, long flags TSRMLS_DC){ HashPosition pos; int i, func_count = zend_hash_num_elements(function_table); zend_hash_internal_pointer_reset_ex(function_table, &pos); for(i = 0; i < func_count; i++) { zend_function *fe = NULL; char *key, *new_key; int key_len, new_key_len, type; long idx; zend_bool add_function = 1; zend_bool exists = 0; zend_hash_get_current_data_ex(function_table, (void**)&fe, &pos); new_key = fe->common.function_name; new_key_len = strlen(new_key) + 1; if (((type = zend_hash_get_current_key_ex(function_table, &key, &key_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) && fe && fe->type == ZEND_USER_FUNCTION) { if (type == HASH_KEY_IS_STRING) { new_key = key; new_key_len = key_len; exists = zend_hash_exists(EG(function_table), new_key, new_key_len); } else { exists = zend_hash_index_exists(EG(function_table), idx); } if (exists) { if (flags & PHP_RUNKIT_IMPORT_OVERRIDE) { if (type == HASH_KEY_IS_STRING) { if (zend_hash_del(EG(function_table), new_key, new_key_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Inconsistency cleaning up import environment"); return FAILURE; } } else { if (zend_hash_index_del(EG(function_table), idx) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Inconsistency cleaning up import environment"); return FAILURE; } } } else { add_function = 0; } } } if (add_function) { if (zend_hash_add(EG(function_table), new_key, new_key_len, fe, sizeof(zend_function), NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failure importing %s()", fe->common.function_name);#ifdef ZEND_ENGINE_2 destroy_zend_function(fe TSRMLS_CC);#else destroy_end_function(fe);#endif return FAILURE; } else { fe->op_array.static_variables = NULL; (*fe->op_array.refcount)++; } } zend_hash_move_forward_ex(function_table, &pos); } return SUCCESS;}
开发者ID:lltwox,项目名称:runkit,代码行数:70,
示例25: PHP_METHOD//.........这里部分代码省略......... array_init(conditions); phalcon_array_append(&conditions, pre_conditions, PH_SEPARATE TSRMLS_CC); } else { PHALCON_INIT_VAR(conditions); array_init(conditions); } PHALCON_INIT_VAR(fields); phalcon_array_fetch_string(&fields, relation, SL("fi"), PH_NOISY_CC); if (Z_TYPE_P(fields) != IS_ARRAY) { PHALCON_CPY_WRT(field, fields); PHALCON_INIT_VAR(value); PHALCON_CALL_METHOD_PARAMS_1(value, record, "readattribute", field, PH_NO_CHECK); PHALCON_INIT_VAR(referenced_field); phalcon_array_fetch_string(&referenced_field, relation, SL("rf"), PH_NOISY_CC); PHALCON_INIT_VAR(condition); PHALCON_CONCAT_VS(condition, referenced_field, " = ?0"); phalcon_array_append(&conditions, condition, PH_SEPARATE TSRMLS_CC); phalcon_array_append(&placeholders, value, PH_SEPARATE TSRMLS_CC); } else { PHALCON_INIT_VAR(i); ZVAL_LONG(i, 0); PHALCON_INIT_VAR(referenced_fields); phalcon_array_fetch_string(&referenced_fields, relation, SL("rf"), PH_NOISY_CC); if (!phalcon_valid_foreach(fields TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(fields); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_74b5_0: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_74b5_0; } PHALCON_INIT_VAR(field); ZVAL_ZVAL(field, *hd, 1, 0); PHALCON_INIT_VAR(value); PHALCON_CALL_METHOD_PARAMS_1(value, record, "readattribute", field, PH_NO_CHECK); PHALCON_INIT_VAR(referenced_field); phalcon_array_fetch(&referenced_field, referenced_fields, i, PH_NOISY_CC); PHALCON_INIT_VAR(condition); PHALCON_CONCAT_VSV(condition, referenced_field, " = ?", i); phalcon_array_append(&conditions, condition, PH_SEPARATE TSRMLS_CC); phalcon_array_append(&placeholders, value, PH_SEPARATE TSRMLS_CC); PHALCON_SEPARATE(i); increment_function(i); zend_hash_move_forward_ex(ah0, &hp0); goto fes_74b5_0; fee_74b5_0: if(0){} } PHALCON_INIT_VAR(c0); ZVAL_STRING(c0, " AND ", 1); PHALCON_INIT_VAR(join_conditions); phalcon_fast_join(join_conditions, c0, conditions TSRMLS_CC);
开发者ID:digitalhydra,项目名称:cphalcon,代码行数:66,
示例26: PHP_METHOD/** * Commits the internal transaction * */PHP_METHOD(Phalcon_Logger_Adapter_File, commit){ zval *transaction = NULL, *file_handler = NULL, *quenue = NULL, *message = NULL; zval *message_str = NULL, *type = NULL, *time = NULL, *applied_format = NULL; zval *applied_eol = NULL; zval *t0 = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); PHALCON_INIT_VAR(transaction); phalcon_read_property(&transaction, this_ptr, SL("_transaction"), PH_NOISY_CC); if (!zend_is_true(transaction)) { PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "There is no active transaction"); return; } phalcon_update_property_bool(this_ptr, SL("_transaction"), 0 TSRMLS_CC); PHALCON_INIT_VAR(file_handler); phalcon_read_property(&file_handler, this_ptr, SL("_fileHandler"), PH_NOISY_CC); PHALCON_INIT_VAR(quenue); phalcon_read_property(&quenue, this_ptr, SL("_quenue"), PH_NOISY_CC); if (!phalcon_valid_foreach(quenue TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(quenue); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_654f_1: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_654f_1; } PHALCON_INIT_VAR(message); ZVAL_ZVAL(message, *hd, 1, 0); PHALCON_INIT_VAR(message_str); PHALCON_CALL_METHOD(message_str, message, "getmessage", PH_NO_CHECK); PHALCON_INIT_VAR(type); PHALCON_CALL_METHOD(type, message, "gettype", PH_NO_CHECK); PHALCON_INIT_VAR(time); PHALCON_CALL_METHOD(time, message, "gettime", PH_NO_CHECK); PHALCON_INIT_VAR(applied_format); PHALCON_CALL_METHOD_PARAMS_3(applied_format, this_ptr, "_applyformat", message_str, type, time, PH_NO_CHECK); PHALCON_INIT_VAR(t0); zend_get_constant(SL("PHP_EOL"), t0 TSRMLS_CC); PHALCON_INIT_VAR(applied_eol); PHALCON_CONCAT_VV(applied_eol, applied_format, t0); PHALCON_CALL_FUNC_PARAMS_2_NORETURN("fputs", file_handler, applied_eol); zend_hash_move_forward_ex(ah0, &hp0); goto fes_654f_1; fee_654f_1: if(0){} PHALCON_MM_RESTORE();}
开发者ID:awakmu,项目名称:cphalcon,代码行数:68,
示例27: fcgi_read_request//.........这里部分代码省略......... zend_hash_update(req->env, "FCGI_ROLE", sizeof("FCGI_ROLE"), &val, sizeof(char*), NULL); break; default: return 0; } if (safe_read(req, &hdr, sizeof(fcgi_header)) != sizeof(fcgi_header) || hdr.version < FCGI_VERSION_1) { return 0; } len = (hdr.contentLengthB1 << 8) | hdr.contentLengthB0; padding = hdr.paddingLength; while (hdr.type == FCGI_PARAMS && len > 0) { if (len + padding > FCGI_MAX_LENGTH) { return 0; } if (safe_read(req, buf, len+padding) != len+padding) { req->keep = 0; return 0; } if (!fcgi_get_params(req, buf, buf+len)) { req->keep = 0; return 0; } if (safe_read(req, &hdr, sizeof(fcgi_header)) != sizeof(fcgi_header) || hdr.version < FCGI_VERSION_1) { req->keep = 0; return 0; } len = (hdr.contentLengthB1 << 8) | hdr.contentLengthB0; padding = hdr.paddingLength; } } else if (hdr.type == FCGI_GET_VALUES) { unsigned char *p = buf + sizeof(fcgi_header); HashPosition pos; char * str_index; uint str_length; ulong num_index; int key_type; zval ** value; if (safe_read(req, buf, len+padding) != len+padding) { req->keep = 0; return 0; } if (!fcgi_get_params(req, buf, buf+len)) { req->keep = 0; return 0; } zend_hash_internal_pointer_reset_ex(req->env, &pos); while ((key_type = zend_hash_get_current_key_ex(req->env, &str_index, &str_length, &num_index, 0, &pos)) != HASH_KEY_NON_EXISTENT) { int zlen; zend_hash_move_forward_ex(req->env, &pos); if (key_type != HASH_KEY_IS_STRING) { continue; } if (zend_hash_find(&fcgi_mgmt_vars, str_index, str_length, (void**) &value) != SUCCESS) { continue; } --str_length; zlen = Z_STRLEN_PP(value); if ((p + 4 + 4 + str_length + zlen) >= (buf + sizeof(buf))) { break; } if (str_length < 0x80) { *p++ = str_length; } else { *p++ = ((str_length >> 24) & 0xff) | 0x80; *p++ = (str_length >> 16) & 0xff; *p++ = (str_length >> 8) & 0xff; *p++ = str_length & 0xff; } if (zlen < 0x80) { *p++ = zlen; } else { *p++ = ((zlen >> 24) & 0xff) | 0x80; *p++ = (zlen >> 16) & 0xff; *p++ = (zlen >> 8) & 0xff; *p++ = zlen & 0xff; } memcpy(p, str_index, str_length); p += str_length; memcpy(p, Z_STRVAL_PP(value), zlen); p += zlen; } len = p - buf - sizeof(fcgi_header); len += fcgi_make_header((fcgi_header*)buf, FCGI_GET_VALUES_RESULT, 0, len); if (safe_write(req, buf, sizeof(fcgi_header)+len) != (int)sizeof(fcgi_header)+len) { req->keep = 0; return 0; } return 0; } else {
开发者ID:jormin,项目名称:php-src,代码行数:101,
示例28: _php_array_to_envp/* {{{ _php_array_to_envp */static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent TSRMLS_DC){ zval **element; php_process_env_t env; char *string_key, *data;#ifndef PHP_WIN32 char **ep;#endif char *p; uint string_length, cnt, l, sizeenv=0, el_len; ulong num_key; HashTable *target_hash; HashPosition pos; 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; } target_hash = HASH_OF(environment); if (!target_hash) { return env; } /* first, we have to get the size of all the elements in the hash */ for (zend_hash_internal_pointer_reset_ex(target_hash, &pos); zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS; zend_hash_move_forward_ex(target_hash, &pos)) { if (Z_TYPE_PP(element) != IS_STRING) { zval tmp; MAKE_COPY_ZVAL(element, &tmp); convert_to_string(&tmp); el_len = Z_STRLEN(tmp); zval_dtor(&tmp); } else { el_len = Z_STRLEN_PP(element); } if (el_len == 0) { continue; } sizeenv += el_len+1; switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) { case HASH_KEY_IS_STRING: if (string_length == 0) { continue; } sizeenv += string_length; break; } }#ifndef PHP_WIN32 ep = env.envarray = (char **) pecalloc(cnt + 1, sizeof(char *), is_persistent);#endif p = env.envp = (char *) pecalloc(sizeenv + 4, 1, is_persistent); for (zend_hash_internal_pointer_reset_ex(target_hash, &pos); zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS; zend_hash_move_forward_ex(target_hash, &pos)) { zval tmp; if (Z_TYPE_PP(element) != IS_STRING) { MAKE_COPY_ZVAL(element, &tmp); convert_to_string(&tmp); } else { tmp = **element; } el_len = Z_STRLEN(tmp); if (el_len == 0) { goto next_element; } data = Z_STRVAL(tmp); switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) { case HASH_KEY_IS_STRING: if (string_length == 0) { goto next_element; } l = string_length + el_len + 1; memcpy(p, string_key, string_length);//.........这里部分代码省略.........
开发者ID:90youth,项目名称:php-src,代码行数:101,
示例29: PHP_METHOD//.........这里部分代码省略......... array_init(field_bind_types); PHALCON_INIT_VAR(automatic_default); array_init(automatic_default); PHALCON_INIT_VAR(identity_field); ZVAL_BOOL(identity_field, 0); PHALCON_INIT_VAR(columns); PHALCON_CALL_METHOD_PARAMS_2(columns, connection, "describecolumns", table, schema, PH_NO_CHECK); if (!phalcon_fast_count_ev(columns TSRMLS_CC)) { if (zend_is_true(schema)) { PHALCON_INIT_NVAR(complete_table); PHALCON_CONCAT_VSV(complete_table, schema, "/"./"", table); } else { PHALCON_CPY_WRT(complete_table, table); } PHALCON_INIT_NVAR(class_name); phalcon_get_class(class_name, model TSRMLS_CC); PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVSV(exception_message, "Cannot obtain table columns for the mapped source /"", complete_table, "/" used in model ", class_name); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); return; } if (!phalcon_valid_foreach(columns TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(columns); zend_hash_internal_pointer_reset_ex(ah0, &hp0); ph_cycle_start_0: if (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS) { goto ph_cycle_end_0; } PHALCON_GET_FOREACH_VALUE(column); PHALCON_INIT_NVAR(field_name); PHALCON_CALL_METHOD(field_name, column, "getname", PH_NO_CHECK); phalcon_array_append(&attributes, field_name, PH_SEPARATE TSRMLS_CC); PHALCON_INIT_NVAR(feature); PHALCON_CALL_METHOD(feature, column, "isprimary", PH_NO_CHECK); if (PHALCON_IS_TRUE(feature)) { phalcon_array_append(&primary_keys, field_name, PH_SEPARATE TSRMLS_CC); } else { phalcon_array_append(&non_primary_keys, field_name, PH_SEPARATE TSRMLS_CC); } PHALCON_INIT_NVAR(feature); PHALCON_CALL_METHOD(feature, column, "isnumeric", PH_NO_CHECK); if (PHALCON_IS_TRUE(feature)) { phalcon_array_update_zval_bool(&numeric_typed, field_name, 1, PH_SEPARATE TSRMLS_CC); } PHALCON_INIT_NVAR(feature); PHALCON_CALL_METHOD(feature, column, "isnotnull", PH_NO_CHECK); if (PHALCON_IS_TRUE(feature)) { phalcon_array_append(¬_null, field_name, PH_SEPARATE TSRMLS_CC); }
开发者ID:alantonilopez,项目名称:cphalcon,代码行数:67,
注:本文中的zend_hash_internal_pointer_reset_ex函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zend_hash_move_forward函数代码示例 C++ zend_hash_internal_pointer_reset函数代码示例 |