这篇教程C++ zend_hash_add函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zend_hash_add函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_hash_add函数的具体用法?C++ zend_hash_add怎么用?C++ zend_hash_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zend_hash_add函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: spl_dllist_object_get_debug_infostatic 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, ¤t->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,
示例2: sw_zend_hash_addinline int sw_zend_hash_add(HashTable *ht, char *k, int len, void *pData, int datasize, void **pDest) { zval key; ZVAL_STRING(&key, k); zval **real_p = pData; return zend_hash_add(ht, Z_STR(key), *real_p) ? SUCCESS : FAILURE;}
开发者ID:wuchuguang,项目名称:swoole-src,代码行数:7,
示例3: PHP_METHOD/** * Interpolates context values into the message placeholders * * @see http://www.php-fig.org/psr/psr-3/ Section 1.2 Message * @param string $message * @param array $context */PHP_METHOD(Phalcon_Logger_Formatter, interpolate){ zval *message, *context; zval replace, *val; zend_string *str_key; ulong idx; phalcon_fetch_params(0, 2, 0, &message, &context); if (Z_TYPE_P(context) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(context)) > 0) { array_init(&replace); ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(context), idx, str_key, val) { zval index; char *tmp; uint str_length; if (str_key) {; str_length = spprintf(&tmp, 0, "{%s}", str_key->val); ZVAL_STRINGL(&index, tmp, str_length); } else { str_length = spprintf(&tmp, 0, "{%ld}", idx); ZVAL_STRINGL(&index, tmp, str_length); } Z_TRY_ADDREF_P(val); zend_hash_add(Z_ARRVAL(replace), Z_STR(index), val); efree(tmp); } ZEND_HASH_FOREACH_END();
开发者ID:Myleft,项目名称:cphalcon7,代码行数:36,
示例4: activerecord_model_assign_attributezval * activerecord_model_assign_attribute( zval * model, char * key, int key_len, zval * value ){ zval * table = activerecord_table_load( EG(called_scope)->name, EG(called_scope)->name_length ); /* if (array_key_exists($name,$table->columns) && !is_object($value)) $value = $table->columns[$name]->cast($value,static::connection()); // convert php's /DateTime to ours if ($value instanceof /DateTime) $value = new DateTime($value->format('Y-m-d H:i:s T')); // make sure DateTime values know what model they belong to so // dirty stuff works when calling set methods on the DateTime object if ($value instanceof DateTime) $value->attribute_of($this,$name); */ zend_hash_add( Z_ARRVAL_P(zend_read_property(activerecord_model_ce,model,"attributes",10,0 TSRMLS_CC)), key, key_len, value, sizeof(zval*), NULL ); activerecord_model_flag_dirty( model, key, key_len ); return value;}
开发者ID:roeitell,项目名称:php-activerecord-plusplus,代码行数:25,
示例5: activerecord_extract_validate_optionszval * activerecord_extract_validate_options( zval * arr ){ zval * retval; MAKE_STD_ZVAL( retval ); array_init( retval ); if( Z_TYPE_P(arr) == IS_ARRAY && zend_hash_num_elements( Z_ARRVAL_P(arr) ) > 0 ) { zval **last; char *key; int key_len, j; zend_hash_internal_pointer_end(Z_ARRVAL_P(arr)); zend_hash_get_current_data(Z_ARRVAL_P(arr), (void **)&last); if( activerecord_is_options_hash(last, 0) ) { retval = last; zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &key, &key_len, &j, 0, NULL); zend_hash_del_key_or_index(Z_ARRVAL_P(arr), key, key_len, j, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX); if( !key_len && j >= Z_ARRVAL_P(arr)->nNextFreeElement - 1 ) Z_ARRVAL_P(arr)->nNextFreeElement = Z_ARRVAL_P(arr)->nNextFreeElement - 1; zend_hash_internal_pointer_reset(Z_ARRVAL_P(arr)); } else { if( !activerecord_is_hash(last) ) /* throw exception */; zend_hash_add( Z_ARRVAL_P(retval), "conditions", 10, last, sizeof(zval*), NULL ); } } return retval;}
开发者ID:roeitell,项目名称:php-activerecord-plusplus,代码行数:35,
示例6: zend_accel_class_hash_copystatic void zend_accel_class_hash_copy(HashTable *target, HashTable *source, unique_copy_ctor_func_t pCopyConstructor){ zend_class_entry *ce1; uint idx; Bucket *p; zval *t; for (idx = 0; idx < source->nNumUsed; idx++) { p = source->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; ZEND_ASSERT(p->key); t = zend_hash_add(target, p->key, &p->val); if (UNEXPECTED(t == NULL)) { if (p->key->len > 0 && p->key->val[0] == 0) { /* Mangled key - ignore and wait for runtime */ continue; } else if (!ZCG(accel_directives).ignore_dups) { t = zend_hash_find(target, p->key); goto failure; } } if (pCopyConstructor) { pCopyConstructor(&Z_PTR_P(t)); } } target->nInternalPointer = target->nNumOfElements ? 0 : INVALID_IDX; return;failure: ce1 = Z_PTR(p->val); CG(in_compilation) = 1; zend_set_compiled_filename(ce1->info.user.filename); CG(zend_lineno) = ce1->info.user.line_start; zend_error(E_ERROR, "Cannot redeclare class %s", ce1->name->val);}
开发者ID:erikjwaxx,项目名称:php-src,代码行数:35,
示例7: ALLOC_HASHTABLEstatic 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,
示例8: msgpack_convert_string_to_propertiesstatic inline int msgpack_convert_string_to_properties(zval *object, zend_string *key, zval *val, HashTable *var)/* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); HashTable *propers = Z_OBJPROP_P(object); zend_string *prot_name, *priv_name; zval pub_name; int return_code; ZVAL_STR(&pub_name, key); priv_name = zend_mangle_property_name(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(key), ZSTR_LEN(key), 1); prot_name = zend_mangle_property_name("*", 1, ZSTR_VAL(key), ZSTR_LEN(key), 1); if (zend_hash_find(propers, priv_name) != NULL) { zend_update_property_ex(ce, object, key, val); return_code = SUCCESS; } else if (zend_hash_find(propers, prot_name) != NULL) { zend_update_property_ex(ce, object, key, val); return_code = SUCCESS; } else { zend_std_write_property(object, &pub_name, val, NULL); return_code = FAILURE; } zend_hash_add(var, Z_STR(pub_name), val); zend_string_release(priv_name); zend_string_release(prot_name); return return_code;}
开发者ID:oerdnj,项目名称:msgpack-php,代码行数:28,
示例9: zend_hash_add_empty_elementZEND_API int zend_hash_add_empty_element(HashTable *ht, const char *arKey, uint nKeyLength){ void *dummy = (void *)1; return zend_hash_add(ht, arKey, nKeyLength, &dummy, sizeof(void *), NULL);}
开发者ID:biezaideng,项目名称:read-php-src,代码行数:8,
示例10: buession_hash_add_double_exBUESSION_API int buession_hash_add_double_ex(HashTable *ht, const char *key, uint key_length, double d TSRMLS_DC){ zval *value; MAKE_STD_ZVAL(value); ZVAL_DOUBLE(value, d); return zend_hash_add(ht, key, key_length, (void *) &value, sizeof(zval *), NULL);}
开发者ID:eduosi,项目名称:buession,代码行数:8,
示例11: buession_hash_add_long_exBUESSION_API int buession_hash_add_long_ex(HashTable *ht, const char *key, uint key_length, long l TSRMLS_DC){ zval *value; MAKE_STD_ZVAL(value); ZVAL_LONG(value, l); return zend_hash_add(ht, key, key_length, (void *) &value, sizeof(zval *), NULL);}
开发者ID:eduosi,项目名称:buession,代码行数:8,
示例12: spl_autoloadstatic int spl_autoload(zend_string *class_name, zend_string *lc_name, const char *ext, int ext_len) /* {{{ */{ char *class_file; int class_file_len; zval dummy; zend_file_handle file_handle; zend_op_array *new_op_array; zval result; int ret; class_file_len = (int)spprintf(&class_file, 0, "%s%.*s", ZSTR_VAL(lc_name), ext_len, ext);#if DEFAULT_SLASH != '//' { char *ptr = class_file; char *end = ptr + class_file_len; while ((ptr = memchr(ptr, '//', (end - ptr))) != NULL) { *ptr = DEFAULT_SLASH; } }#endif ret = php_stream_open_for_zend_ex(class_file, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE); if (ret == SUCCESS) { zend_string *opened_path; if (!file_handle.opened_path) { file_handle.opened_path = zend_string_init(class_file, class_file_len, 0); } opened_path = zend_string_copy(file_handle.opened_path); ZVAL_NULL(&dummy); if (zend_hash_add(&EG(included_files), opened_path, &dummy)) { new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); zend_destroy_file_handle(&file_handle); } else { new_op_array = NULL; zend_file_handle_dtor(&file_handle); } zend_string_release(opened_path); if (new_op_array) { ZVAL_UNDEF(&result); zend_execute(new_op_array, &result); destroy_op_array(new_op_array); efree(new_op_array); if (!EG(exception)) { zval_ptr_dtor(&result); } efree(class_file); return zend_hash_exists(EG(class_table), lc_name); } } efree(class_file); return 0;} /* }}} */
开发者ID:morafabio,项目名称:php-src,代码行数:57,
示例13: xmlreader_register_prop_handler/* {{{ xmlreader_register_prop_handler */static void xmlreader_register_prop_handler(HashTable *prop_handler, char *name, xmlreader_read_int_t read_int_func, xmlreader_read_const_char_t read_char_func, int rettype TSRMLS_DC){ xmlreader_prop_handler hnd; hnd.read_char_func = read_char_func; hnd.read_int_func = read_int_func; hnd.type = rettype; zend_hash_add(prop_handler, name, strlen(name)+1, &hnd, sizeof(xmlreader_prop_handler), NULL);}
开发者ID:360weboy,项目名称:php-src,代码行数:10,
示例14: php_hash_register_algoPHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops) /* {{{ */{ int algo_len = strlen(algo); char *lower = estrndup(algo, algo_len); zend_str_tolower(lower, algo_len); zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, (void*)ops, sizeof(php_hash_ops), NULL); efree(lower);}
开发者ID:31H0B1eV,项目名称:php-src,代码行数:9,
示例15: ZEND_MM_ALIGNED_SIZEzend_execute_data *sw_zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC){ zend_execute_data *execute_data; size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)); size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)); size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T; size_t call_slots_size = ZEND_MM_ALIGNED_SIZE(sizeof(call_slot)) * op_array->nested_calls; size_t stack_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * op_array->used_stack; size_t total_size = execute_data_size + Ts_size + CVs_size + call_slots_size + stack_size; execute_data = zend_vm_stack_alloc(total_size TSRMLS_CC); execute_data = (zend_execute_data*)((char*)execute_data + Ts_size); execute_data->prev_execute_data = EG(current_execute_data); memset(EX_CV_NUM(execute_data, 0), 0, sizeof(zval **) * op_array->last_var); execute_data->call_slots = (call_slot*)((char *)execute_data + execute_data_size + CVs_size); execute_data->op_array = op_array; EG(argument_stack)->top = zend_vm_stack_frame_base(execute_data); execute_data->object = NULL; execute_data->current_this = NULL; execute_data->old_error_reporting = NULL; execute_data->symbol_table = EG(active_symbol_table); execute_data->call = NULL; EG(current_execute_data) = execute_data; execute_data->nested = nested; if (!op_array->run_time_cache && op_array->last_cache_slot) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); } if (op_array->this_var != -1 && EG(This)) { Z_ADDREF_P(EG(This)); /* For $this pointer */ if (!EG(active_symbol_table)) { SW_EX_CV(op_array->this_var) = (zval **) SW_EX_CV_NUM(execute_data, op_array->last_var + op_array->this_var); *SW_EX_CV(op_array->this_var) = EG(This); } else { if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void **) EX_CV_NUM(execute_data, op_array->this_var))==FAILURE) { Z_DELREF_P(EG(This)); } } } execute_data->opline = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes; EG(opline_ptr) = &(execute_data->opline); execute_data->function_state.function = (zend_function *) op_array; execute_data->function_state.arguments = NULL; return execute_data;}
开发者ID:netcode,项目名称:swoole-src,代码行数:57,
示例16: php_couchbase_get_callback/* {{{ static void php_couchbase_get_callback(...) */static voidphp_couchbase_get_callback(libcouchbase_t handle, const void *cookie, libcouchbase_error_t error, const void *key, size_t nkey, const void *bytes, size_t nbytes, uint32_t flag, uint64_t cas) { php_couchbase_ctx *ctx = (php_couchbase_ctx *)cookie; php_ignore_value(handle); if (--ctx->res->seqno == 0) { ctx->res->io->stop_event_loop(ctx->res->io); } ctx->exception = error; if (LIBCOUCHBASE_SUCCESS != error && LIBCOUCHBASE_KEY_ENOENT != error) { ctx->res->io->stop_event_loop(ctx->res->io); return; } if (LIBCOUCHBASE_KEY_ENOENT == error) { ZVAL_NULL(ctx->rv); return; } if (IS_ARRAY == Z_TYPE_P(ctx->rv)) { /* multi get */ zval *v; MAKE_STD_ZVAL(v); ZVAL_STRINGL(v, (char *)bytes, nbytes, 1); zend_hash_add(Z_ARRVAL_P(ctx->rv), (char *)key, nkey + 1, (void **)&v, sizeof(zval *), NULL); if (ctx->cas) { zval *c; MAKE_STD_ZVAL(c); ZVAL_DOUBLE(c, cas); zend_hash_add(Z_ARRVAL_P(ctx->cas), (char *)key, nkey + 1, (void **)&c, sizeof(zval *), NULL); } } else { ZVAL_STRINGL(ctx->rv, (char *)bytes, nbytes, 1); if (ctx->cas) { ZVAL_DOUBLE(ctx->cas, cas); } }}
开发者ID:pytonic,项目名称:php-ext-couchbase,代码行数:46,
示例17: calc_stringstatic size_t calc_string(char *str, int len TSRMLS_DC)#endif{ if (len > MAX_DUP_STR_LEN || zend_hash_add(&EAG(strings), str, len, &str, sizeof(char *), NULL) == SUCCESS) { EA_SIZE_ALIGN(len); return len; } return 0;}
开发者ID:bartv,项目名称:eaccelerator,代码行数:10,
示例18: edge_file_includeint edge_file_include(char *file_path){ //include file 操作,没有直接的zend_api函数,如果使用,则需要在php执行编译的opcode中操作 //以下的代码借鉴了yaf框架里面的include逻辑 zend_file_handle file_handle; zend_op_array *op_array; file_handle.filename = file_path; file_handle.free_filename = 0; file_handle.type = ZEND_HANDLE_FILENAME; file_handle.opened_path = NULL; file_handle.handle.fp = NULL; op_array = zend_compile_file(&file_handle, ZEND_INCLUDE TSRMLS_CC); if (op_array && file_handle.handle.stream.handle) { int dummy = 1; if (!file_handle.opened_path) { file_handle.opened_path = file_path; } zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1, (void *)&dummy, sizeof(int), NULL); } zend_destroy_file_handle(&file_handle TSRMLS_CC); if (op_array) { zval *result = NULL; EDGE_BYAF_STORE_EG_ENVIRON(); EG(return_value_ptr_ptr) = &result; EG(active_op_array) = op_array;#if ((PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION > 2)) || (PHP_MAJOR_VERSION > 5) if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); }#endif zend_execute(op_array TSRMLS_CC); destroy_op_array(op_array TSRMLS_CC); efree(op_array); if (!EG(exception)) { if (EG(return_value_ptr_ptr) && *EG(return_value_ptr_ptr)) { zval_ptr_dtor(EG(return_value_ptr_ptr)); } } EDGE_BYAF_RESTORE_EG_ENVIRON(); return 1; } return 0;}
开发者ID:linkaisheng,项目名称:edge,代码行数:55,
示例19: PHP_METHODPHP_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,
示例20: spl_dllist_object_get_debug_infostatic HashTable* spl_dllist_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{{ */{ spl_dllist_object *intern = spl_dllist_from_obj(obj); spl_ptr_llist_element *current = intern->llist->head, *next; zval tmp, dllist_array; zend_string *pnstr; int i = 0; HashTable *debug_info; *is_temp = 1; if (!intern->std.properties) { rebuild_object_properties(&intern->std); } debug_info = zend_new_array(1); zend_hash_copy(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(debug_info, pnstr, &tmp); zend_string_release_ex(pnstr, 0); array_init(&dllist_array); while (current) { next = current->next; add_index_zval(&dllist_array, i, ¤t->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(debug_info, pnstr, &dllist_array); zend_string_release_ex(pnstr, 0); return debug_info;}
开发者ID:dstogov,项目名称:php-src,代码行数:42,
示例21: php_register_info_logoPHPAPI int php_register_info_logo(char *logo_string, const char *mimetype, const unsigned char *data, int size){ php_info_logo info_logo; info_logo.mimetype = mimetype; info_logo.mimelen = strlen(mimetype); info_logo.data = data; info_logo.size = size; return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), &info_logo, sizeof(php_info_logo), NULL);}
开发者ID:0,项目名称:php-src,代码行数:11,
示例22: zend_optimizer_collect_constantvoid zend_optimizer_collect_constant(zend_optimizer_ctx *ctx, zval *name, zval* value){ zval val; if (!ctx->constants) { ctx->constants = zend_arena_alloc(&ctx->arena, sizeof(HashTable)); zend_hash_init(ctx->constants, 16, NULL, zend_optimizer_zval_dtor_wrapper, 0); } ZVAL_DUP(&val, value); zend_hash_add(ctx->constants, Z_STR_P(name), &val);}
开发者ID:BenBuurman,项目名称:php-src,代码行数:11,
示例23: zend_ext_api_registerZEND_API int zend_ext_api_register(char *ext_name, int version, void *api, size_t size){ char *hash_name = zend_ext_api_hash_name(ext_name, version); /* TODO: Clear hash_name memory */ zend_ext_api_extension *ext_api = zend_ext_api_create(ext_name, version, api, size); /* Check errors when creating extension */ int r = zend_hash_add(&ext_api_registry, hash_name, strlen(hash_name) + 1, ext_api, sizeof(zend_ext_api_extension), NULL); /* TODO: Clear ext_api memory */ return r;}
开发者ID:vpj,项目名称:PHP-Extension-API,代码行数:12,
示例24: spl_add_class_name/* {{{ spl_add_class_name */void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_flags){ if (!allow || (allow > 0 && pce->ce_flags & ce_flags) || (allow < 0 && !(pce->ce_flags & ce_flags))) { zval *tmp; if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) { zval t; ZVAL_STR_COPY(&t, pce->name); zend_hash_add(Z_ARRVAL_P(list), pce->name, &t); } }}
开发者ID:Tyrael,项目名称:php-src,代码行数:13,
示例25: zend_optimizer_collect_constantstatic 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,
示例26: activerecord_model_flag_dirtyvoid activerecord_model_flag_dirty( zval * model, char * attr, int attr_len ){ zval * dirty = zend_read_property(activerecord_model_ce, model, "__dirty", 7, 0 TSRMLS_CC); zval * trueval; if( Z_TYPE_P(dirty) == IS_NULL ) array_init( dirty ); ZVAL_BOOL(trueval, 1); zend_hash_add( Z_ARRVAL_P(dirty), attr, attr_len, trueval, sizeof(zval*), NULL );}
开发者ID:roeitell,项目名称:php-activerecord-plusplus,代码行数:13,
示例27: PHP_METHOD/** * Interpolates context values into the message placeholders * * @see http://www.php-fig.org/psr/psr-3/ Section 1.2 Message * @param string $message * @param array $context */PHP_METHOD(Phalcon_Logger_Formatter, interpolate){ zval **message, **context; phalcon_fetch_params_ex(2, 0, &message, &context); if (Z_TYPE_PP(context) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_PP(context)) > 0) { HashTable *ht = Z_ARRVAL_PP(context); HashPosition hp; zval *replace, **val; PHALCON_ALLOC_GHOST_ZVAL(replace); array_init_size(replace, zend_hash_num_elements(ht)); for ( zend_hash_internal_pointer_reset_ex(ht, &hp); zend_hash_get_current_data_ex(ht, (void**)&val, &hp) == SUCCESS; zend_hash_move_forward_ex(ht, &hp) ) { char *str_index, *idx; uint str_length; ulong num_index; int type = zend_hash_get_current_key_ex(ht, &str_index, &str_length, &num_index, 0, &hp); if (HASH_KEY_IS_STRING == type) { str_length += 2; idx = emalloc(str_length); idx[0] = '{'; idx[str_length-2] = '}'; idx[str_length-1] = '/0'; memcpy(idx + 1, str_index, str_length - 3); } else if (HASH_KEY_IS_LONG == type) { str_length = spprintf(&idx, 0, "{%ld}", num_index); } else { /* Better safe than sorry */ continue; } Z_ADDREF_PP(val); zend_hash_add(Z_ARRVAL_P(replace), idx, str_length, (void*)val, sizeof(zval*), NULL); efree(idx); } PHALCON_RETURN_CALL_FUNCTIONW("strtr", *message, replace); return; } RETURN_ZVAL(*message, 1, 0);}
开发者ID:9466,项目名称:cphalcon,代码行数:57,
示例28: register_standard_classstatic void register_standard_class(TSRMLS_D){ zend_standard_class_def.type = ZEND_INTERNAL_CLASS; zend_standard_class_def.name_length = sizeof("stdClass") - 1; zend_standard_class_def.name = zend_strndup("stdClass", zend_standard_class_def.name_length); zend_standard_class_def.parent = NULL; zend_hash_init_ex(&zend_standard_class_def.default_properties, 0, NULL, ZVAL_PTR_DTOR, 1, 0); zend_hash_init_ex(&zend_standard_class_def.function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1, 0); zend_standard_class_def.handle_function_call = NULL; zend_standard_class_def.handle_property_get = NULL; zend_standard_class_def.handle_property_set = NULL; zend_standard_class_def.refcount = (int *) malloc(sizeof(int)); *zend_standard_class_def.refcount = 1; zend_hash_add(CG(class_table), "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry), NULL);}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:15,
示例29: PHP_INI_MHstatic PHP_INI_MH(OnUpdateTags){ url_adapt_state_ex_t *ctx; char *key; char *lasts; char *tmp; ctx = &BG(url_adapt_state_ex); tmp = estrndup(new_value, new_value_length); if (ctx->tags) zend_hash_destroy(ctx->tags); else { ctx->tags = malloc(sizeof(HashTable)); if (!ctx->tags) { return FAILURE; } } zend_hash_init(ctx->tags, 0, NULL, NULL, 1); for (key = php_strtok_r(tmp, ",", &lasts); key; key = php_strtok_r(NULL, ",", &lasts)) { char *val; val = strchr(key, '='); if (val) { char *q; int keylen; *val++ = '/0'; for (q = key; *q; q++) *q = tolower(*q); keylen = q - key; /* key is stored withOUT NUL val is stored WITH NUL */ zend_hash_add(ctx->tags, key, keylen, val, strlen(val)+1, NULL); } } efree(tmp); return SUCCESS;}
开发者ID:66Ton99,项目名称:php5.4-ppa,代码行数:46,
注:本文中的zend_hash_add函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zend_hash_destroy函数代码示例 C++ zend_fetch_class函数代码示例 |