bool get_next_num_item(zval* arr, HashPosition* pos) { int key_type = zend_hash_get_current_key_type_ex(Z_ARRVAL_P(arr), pos); while(key_type != HASH_KEY_IS_LONG && key_type != HASH_KEY_NON_EXISTANT) { zend_hash_move_forward_ex(Z_ARRVAL_P(arr), pos); key_type = zend_hash_get_current_key_type_ex(Z_ARRVAL_P(arr), pos); }; return key_type == HASH_KEY_IS_LONG; };
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Xcache, reset) { zval *meta = phalcon_fetch_nproperty_this(this_ptr, SL("_metaData"), PH_NOISY TSRMLS_CC); zval *real_key = NULL; PHALCON_MM_GROW(); if (SUCCESS == phalcon_function_exists_ex(SL("xcache_unset_by_prefix") TSRMLS_CC)) { zval *prefix = phalcon_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY TSRMLS_CC); PHALCON_INIT_VAR(real_key); phalcon_concat_svs(&real_key, SL("$PMM$"), prefix, SL("meta-"), 0 TSRMLS_CC); PHALCON_CALL_FUNCTION(NULL, "xcache_unset_by_prefix", real_key); } else if (Z_TYPE_P(meta) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(meta); HashPosition hp; zval *prefix = phalcon_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY TSRMLS_CC); for ( zend_hash_internal_pointer_reset_ex(ht, &hp); zend_hash_get_current_key_type_ex(ht, &hp) != HASH_KEY_NON_EXISTENT; zend_hash_move_forward_ex(ht, &hp) ) { zval key = phalcon_get_current_key_w(ht, &hp); PHALCON_INIT_NVAR(real_key); phalcon_concat_svsv(&real_key, SL("$PMM$"), prefix, SL("meta-"), &key, 0 TSRMLS_CC); PHALCON_CALL_FUNCTION(NULL, "xcache_unset", real_key); } } PHALCON_CALL_PARENT(NULL, phalcon_mvc_model_metadata_xcache_ce, getThis(), "reset"); PHALCON_MM_RESTORE(); }
void rpb_print_hashtable(HashTable *arr_hash) { HashPosition pointer; char *str_key; uint key_len; ulong int_key; zval **data; for(zend_hash_internal_pointer_reset_ex(arr_hash, &pointer); zend_hash_get_current_data_ex(arr_hash, (void**) &data, &pointer) == SUCCESS; zend_hash_move_forward_ex(arr_hash, &pointer)) { zend_hash_get_current_key_ex(arr_hash, &str_key, &key_len, &int_key,0, &pointer); if(zend_hash_get_current_key_type_ex(arr_hash, &pointer) == IS_STRING) { // zend_print_pval_r(str_key,0); printf("%s\n", str_key); } else { printf("%s\n", str_key); // zend_print_pval_r(data,0); } } }
inline 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; }