这篇教程C++ zend_hash_next_index_insert函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zend_hash_next_index_insert函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_hash_next_index_insert函数的具体用法?C++ zend_hash_next_index_insert怎么用?C++ zend_hash_next_index_insert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zend_hash_next_index_insert函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SPL_METHOD/* {{{ proto array SplDoublyLinkedList::__serialize() */SPL_METHOD(SplDoublyLinkedList, __serialize){ spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS); spl_ptr_llist_element *current = intern->llist->head; zval tmp; if (zend_parse_parameters_none_throw() == FAILURE) { return; } array_init(return_value); /* flags */ ZVAL_LONG(&tmp, intern->flags); zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp); /* elements */ array_init_size(&tmp, intern->llist->count); while (current) { zend_hash_next_index_insert(Z_ARRVAL(tmp), ¤t->data); current = current->next; } zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp); /* members */ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std)); Z_TRY_ADDREF(tmp); zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);} /* }}} */
开发者ID:dstogov,项目名称:php-src,代码行数:30,
示例2: php_jq_filterstatic voidphp_jq_filter(zval **return_value, jq_state *jq, jv json, int flags TSRMLS_DC){ jv result; jq_start(jq, jv_copy(json), 0); if (jv_is_valid(result = jq_next(jq))) { int multiple = 0; while (1) { zval *zv; ALLOC_INIT_ZVAL(zv); if (flags == JQ_OPT_RAW) { if (jv_get_kind(result) == JV_KIND_STRING) { ZVAL_STRING(zv, jv_string_value(result), 1); } else { jv dump = jv_dump_string(result, 0); if (jv_is_valid(dump)) { ZVAL_STRING(zv, jv_string_value(dump), 1); } jv_free(dump); } } else { php_jv_dump(&zv, result TSRMLS_CC); } if (!jv_is_valid(result = jq_next(jq))) { if (multiple) { zend_hash_next_index_insert(Z_ARRVAL_PP(return_value), &zv, sizeof(zv), NULL); } else { ZVAL_ZVAL(*return_value, zv, 1, 1); } break; } if (!multiple) { multiple = 1; array_init(*return_value); } zend_hash_next_index_insert(Z_ARRVAL_PP(return_value), &zv, sizeof(zv), NULL); } } else { jv_free(result); if (PHP_JQ_G(display_errors)) { PHP_JQ_ERR(E_WARNING, "filter parse error"); } ZVAL_BOOL(*return_value, 0); }}
开发者ID:Gasol,项目名称:php-ext-jq,代码行数:54,
示例3: edge_register_autoloadint static edge_register_autoload(zval *loader, const char *fname){ zval *z_function; zval *arg; zval **args[1] = {&arg}; zval *method; zval *ret = NULL; MAKE_STD_ZVAL(z_function); ZVAL_STRING(z_function, "spl_autoload_register", 0); MAKE_STD_ZVAL(method); ZVAL_STRING(method, fname, 1); MAKE_STD_ZVAL(arg); array_init(arg); zend_hash_next_index_insert(Z_ARRVAL_P(arg), &loader, sizeof(zval *), NULL); zend_hash_next_index_insert(Z_ARRVAL_P(arg), &method, sizeof(zval *), NULL); zend_fcall_info fci = { sizeof(fci), EG(function_table), z_function, NULL, &ret, 1, (zval ***)args, NULL, 1 }; if(zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { if(ret) { zval_ptr_dtor(&ret); } zval_ptr_dtor(&z_function); zval_ptr_dtor(&arg); return 0; } if(ret) { zval_ptr_dtor(&ret); } Z_ADDREF_P(loader); efree(z_function); zval_ptr_dtor(&arg); return 1;}
开发者ID:linkaisheng,项目名称:edge,代码行数:51,
示例4: php_mimepart_allocstatic 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,
示例5: PHP_METHODstatic PHP_METHOD(midgard_workspace_storage, list_children){ if (zend_parse_parameters_none() == FAILURE) return; guint n_objects; MidgardWorkspaceStorage *self = MIDGARD_WORKSPACE_STORAGE(__php_gobject_ptr(getThis())); MidgardWorkspaceStorage **children = midgard_workspace_storage_list_children(self, &n_objects); array_init(return_value); if (!children) return; const char *g_class_name = G_OBJECT_TYPE_NAME(children[0]); zend_class_entry *ce = zend_fetch_class((char *) g_class_name, strlen(g_class_name), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); int i; for (i = 0; i < n_objects; i++) { zval *zobject; MAKE_STD_ZVAL(zobject); php_midgard_gobject_new_with_gobject(zobject, ce, G_OBJECT(children[i]), TRUE TSRMLS_CC); zend_hash_next_index_insert(HASH_OF(return_value), &zobject, sizeof(zval *), NULL); }}
开发者ID:William-Wai,项目名称:midgard-php5,代码行数:26,
示例6: pip_sequence_to_hash/* {{{ pip_sequence_to_hash(PyObject *seq) * Convert a Python sequence to a PHP hash */zval *pip_sequence_to_hash(PyObject *seq){ zval *hash, *val; PyObject *item; int i = 0; /* Make sure this object implements the sequence protocol */ if (!PySequence_Check(seq)) { return NULL; } /* Initialize our PHP array */ MAKE_STD_ZVAL(hash); if (array_init(hash) != SUCCESS) { return NULL; } /* Iterate over the items in the sequence */ while (item = PySequence_GetItem(seq, i++)) { val = pip_pyobject_to_zval(item); if (zend_hash_next_index_insert(HASH_OF(hash), (void *)&val, sizeof(zval *), NULL) == FAILURE) { php_error(E_ERROR, "Python: Array conversion error"); } Py_DECREF(item); } return hash;}
开发者ID:demos,项目名称:Motif,代码行数:33,
示例7: ast_create_virtual_nodestatic void ast_create_virtual_node( zval *zv, zend_ast_kind kind, zend_ast *ast, zend_long version) { zval tmp_zv, tmp_zv2; object_init_ex(zv, ast_node_ce); ZVAL_LONG(&tmp_zv, kind); ast_update_property(zv, AST_STR(kind), &tmp_zv, AST_CACHE_SLOT_KIND); ZVAL_LONG(&tmp_zv, ast->attr); ast_update_property(zv, AST_STR(flags), &tmp_zv, AST_CACHE_SLOT_FLAGS); ZVAL_LONG(&tmp_zv, zend_ast_get_lineno(ast)); ast_update_property(zv, AST_STR(lineno), &tmp_zv, AST_CACHE_SLOT_LINENO); array_init(&tmp_zv); ast_update_property(zv, AST_STR(children), &tmp_zv, AST_CACHE_SLOT_CHILDREN); ZVAL_COPY(&tmp_zv2, zend_ast_get_zval(ast)); if (version >= 30) { zend_hash_add_new(Z_ARRVAL(tmp_zv), ast_kind_child_name(kind, 0), &tmp_zv2); } else { zend_hash_next_index_insert(Z_ARRVAL(tmp_zv), &tmp_zv2); }}
开发者ID:billschaller,项目名称:php-ast,代码行数:25,
示例8: buession_hash_next_index_add_doubleBUESSION_API int buession_hash_next_index_add_double(HashTable *ht, double d TSRMLS_DC){ zval *value; MAKE_STD_ZVAL(value); ZVAL_DOUBLE(value, d); return zend_hash_next_index_insert(ht, (void *) &value, sizeof(zval *), NULL);}
开发者ID:eduosi,项目名称:buession,代码行数:8,
示例9: buession_hash_next_index_add_longBUESSION_API int buession_hash_next_index_add_long(HashTable *ht, long l TSRMLS_DC){ zval *value; MAKE_STD_ZVAL(value); ZVAL_LONG(value, l); return zend_hash_next_index_insert(ht, (void *) &value, sizeof(zval *), NULL);}
开发者ID:eduosi,项目名称:buession,代码行数:8,
示例10: yaf_loader_registerint yaf_loader_register(yaf_loader_t *loader) /* {{{ */ { zval autoload, function, method, ret; array_init(&autoload); ZVAL_STRING(&method, YAF_AUTOLOAD_FUNC_NAME); zend_hash_next_index_insert(Z_ARRVAL(autoload), loader); zend_hash_next_index_insert(Z_ARRVAL(autoload), &method); ZVAL_STRING(&function, YAF_SPL_AUTOLOAD_REGISTER_NAME); do { zend_fcall_info fci = { sizeof(fci),#if PHP_VERSION_ID < 70100 EG(function_table),#endif function,#if PHP_VERSION_ID < 70100 NULL,#endif &ret, &autoload, NULL, 1, 1 }; if (zend_call_function(&fci, NULL) == FAILURE) { zval_ptr_dtor(&function); zval_ptr_dtor(&autoload); php_error_docref(NULL, E_WARNING, "Unable to register autoload function %s", YAF_AUTOLOAD_FUNC_NAME); return 0; } zval_ptr_dtor(&function); zval_ptr_dtor(&autoload); } while (0); return 1;}
开发者ID:Luxurioust,项目名称:php-yaf,代码行数:42,
示例11: zephir_update_property_array/** * Updates an array property */int zephir_update_property_array(zval *object, const char *property, zend_uint property_length, const zval *index, zval *value){ zval tmp; int separated = 0; if (Z_TYPE_P(object) == IS_OBJECT) { zephir_read_property(&tmp, object, property, property_length, PH_NOISY | PH_READONLY); /** Separation only when refcount > 1 */ if (Z_REFCOUNTED(tmp)) { if (Z_REFCOUNT(tmp) > 1) { if (!Z_ISREF(tmp)) { zval new_zv; ZVAL_DUP(&new_zv, &tmp); ZVAL_COPY_VALUE(&tmp, &new_zv); Z_TRY_DELREF(new_zv); separated = 1; } } } else { zval new_zv; ZVAL_DUP(&new_zv, &tmp); ZVAL_COPY_VALUE(&tmp, &new_zv); Z_TRY_DELREF(new_zv); separated = 1; } /** Convert the value to array if not is an array */ if (Z_TYPE(tmp) != IS_ARRAY) { if (separated) { convert_to_array(&tmp); } else { array_init(&tmp); separated = 1; } Z_DELREF(tmp); } Z_TRY_ADDREF_P(value); if (Z_TYPE_P(index) == IS_STRING) { zend_symtable_str_update(Z_ARRVAL(tmp), Z_STRVAL_P(index), Z_STRLEN_P(index), value); } else if (Z_TYPE_P(index) == IS_LONG) { zend_hash_index_update(Z_ARRVAL(tmp), Z_LVAL_P(index), value); } else if (Z_TYPE_P(index) == IS_NULL) { zend_hash_next_index_insert(Z_ARRVAL(tmp), value); } if (separated) { zephir_update_property_zval(object, property, property_length, &tmp); } } return SUCCESS;}
开发者ID:phalcon,项目名称:zephir,代码行数:57,
示例12: php_bencode_decode_liststatic void php_bencode_decode_list(zval *return_value, char *str, size_t *pos, size_t *str_len) /* {{{ */{ array_init(return_value); (*pos)++; while (*pos < *str_len && str[*pos] != PHP_BENCODE_END_STRUCTURE) { zval list_value; php_bencode_decode(&list_value, str, pos, str_len); zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &list_value); } (*pos)++;}
开发者ID:acgrid,项目名称:php-ext-bencode,代码行数:11,
示例13: qb_add_arraystatic zval * qb_add_array(zval *array, const char *name) { HashTable *ht = Z_ARRVAL_P(array); zval *zvalue; ALLOC_INIT_ZVAL(zvalue); array_init(zvalue); if(name) { zend_hash_update(ht, name, (uint32_t) strlen(name) + 1, &zvalue, sizeof(zval *), NULL); } else { zend_hash_next_index_insert(ht, &zvalue, sizeof(zval *), NULL); } return zvalue;}
开发者ID:3CTO,项目名称:qb,代码行数:12,
示例14: add_offset_pairstatic void add_offset_pair(zval *result, char *string, int string_len, int offset){ zval *match_pair; ALLOC_ZVAL(match_pair); array_init(match_pair); INIT_PZVAL(match_pair); add_next_index_stringl(match_pair, string, string_len, FALSE); add_next_index_long(match_pair, offset); zend_hash_next_index_insert(Z_ARRVAL_P(result), &match_pair, sizeof(zval *), NULL);}
开发者ID:mickelfeng,项目名称:regexp,代码行数:12,
示例15: PHP_METHODPHP_METHOD(BatchStatement, add){ zval *statement = NULL; zval *arguments = NULL; cassandra_batch_statement_entry *batch_statement_entry = NULL; cassandra_statement *self = NULL;#if PHP_MAJOR_VERSION >= 7 zval entry;#endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &statement, &arguments) == FAILURE) { return; } if (!instanceof_function(Z_OBJCE_P(statement), cassandra_simple_statement_ce TSRMLS_CC) && !instanceof_function(Z_OBJCE_P(statement), cassandra_prepared_statement_ce TSRMLS_CC)) { INVALID_ARGUMENT(statement, "an instance of Cassandra//SimpleStatement or Cassandra//PreparedStatement"); } self = PHP_CASSANDRA_GET_STATEMENT(getThis()); batch_statement_entry = (cassandra_batch_statement_entry *) ecalloc(1, sizeof(cassandra_batch_statement_entry)); PHP5TO7_ZVAL_COPY(PHP5TO7_ZVAL_MAYBE_P(batch_statement_entry->statement), statement); if (arguments) { PHP5TO7_ZVAL_COPY(PHP5TO7_ZVAL_MAYBE_P(batch_statement_entry->arguments), arguments); }#if PHP_MAJOR_VERSION >= 7 ZVAL_PTR(&entry, batch_statement_entry); zend_hash_next_index_insert(&self->statements, &entry);#else zend_hash_next_index_insert(&self->statements, &batch_statement_entry, sizeof(cassandra_batch_statement_entry *), NULL);#endif}
开发者ID:amirInv,项目名称:php-driver,代码行数:40,
示例16: add_zvalstatic void add_zval(zval* list, const char* id, zval* val){ if (list && val) { if (id) { int id_len = strlen(id); if (!(id_len > 1 && id[0] == '0') && is_numeric_string((char *)id, id_len, NULL, NULL, 0) == IS_LONG) { long index = strtol(id, NULL, 0); zend_hash_index_update(Z_ARRVAL_P(list), index, val); } else { zend_hash_str_update(Z_ARRVAL_P(list), (char*)id, strlen(id), val); } } else { zend_hash_next_index_insert(Z_ARRVAL_P(list), val); } }}
开发者ID:AllenJB,项目名称:php-src,代码行数:16,
示例17: qb_add_stringstatic zval * qb_add_string(zval *array, const char *name, const char *s, int32_t len) { HashTable *ht = Z_ARRVAL_P(array); zval *zvalue; ALLOC_INIT_ZVAL(zvalue); if(s) { if(len == -1) { len = (int32_t) strlen(s); } ZVAL_STRINGL(zvalue, s, len, TRUE); } if(name) { zend_hash_update(ht, name, (uint32_t) strlen(name) + 1, &zvalue, sizeof(zval *), NULL); } else { zend_hash_next_index_insert(ht, &zvalue, sizeof(zval *), NULL); } return zvalue;}
开发者ID:3CTO,项目名称:qb,代码行数:17,
示例18: oauth_provider_check_required_paramsstatic void oauth_provider_check_required_params(HashTable *required_params, HashTable *params, HashTable *missing_params) /* {{{ */{ HashPosition hpos, reqhpos, paramhpos; zval *dest_entry, param; zend_string *key; ulong num_key; zend_hash_internal_pointer_reset_ex(required_params, &hpos); zend_hash_internal_pointer_reset_ex(params, &reqhpos); zend_hash_internal_pointer_reset_ex(missing_params, ¶mhpos); do { if(zend_hash_get_current_key_ex(required_params, &key, &num_key, &hpos) == HASH_KEY_IS_STRING) { if((dest_entry = zend_hash_find(params, key)) == NULL) { ZVAL_STRING(¶m, ZSTR_VAL(key)); zend_hash_next_index_insert(missing_params, ¶m); } } } while(zend_hash_move_forward_ex(required_params, &hpos)==SUCCESS);}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:19,
示例19: PHP_METHODstatic PHP_METHOD(midgard_query_builder, execute){ RETVAL_FALSE; MidgardConnection *mgd = mgd_handle(TSRMLS_C); CHECK_MGD(mgd); if (zend_parse_parameters_none() == FAILURE) return; _GET_BUILDER_OBJECT; zend_class_entry *ce = php_gobject->user_ce; if (ce == NULL) { php_error(E_WARNING, "Query Builder instance not associated with any class"); return; } guint i, n_objects; GObject **objects = midgard_query_builder_execute(builder, &n_objects); array_init(return_value); if (!objects) return; /* TODO: Should use iterator, instead, and create objects lazily */ /* Initialize zend objects for the same class which was used to initialize Query Builder */ for (i = 0; i < n_objects; i++) { GObject *gobject = objects[i]; zval *zobject; /* TODO: Simplify code below. If possible. */ MAKE_STD_ZVAL(zobject); object_init_ex(zobject, ce); /* Initialize new object for which QB has been created for */ MGD_PHP_SET_GOBJECT(zobject, gobject); // inject our gobject zend_call_method_with_0_params(&zobject, ce, &ce->constructor, "__construct", NULL); /* Call class constructor on given instance */ zend_hash_next_index_insert(HASH_OF(return_value), &zobject, sizeof(zval *), NULL); } if (objects) g_free(objects);}
开发者ID:indeyets,项目名称:midgard-php5,代码行数:43,
示例20: on_header_available/* cURL guarantees that headers are written as complete lines, with this function * called once for each header */static size_t on_header_available(char *data, size_t size, size_t nmemb, void *ctx){ size_t length = size * nmemb; zval *header; php_stream *stream = (php_stream *) ctx; php_curl_stream *curlstream = (php_curl_stream *) stream->abstract; TSRMLS_FETCH(); if (length < 2) { /* invalid header ? */ return length; } if (!(length == 2 && data[0] == '/r' && data[1] == '/n')) { MAKE_STD_ZVAL(header); Z_STRLEN_P(header) = length; Z_STRVAL_P(header) = estrndup(data, length); if (Z_STRVAL_P(header)[length-1] == '/n') { Z_STRVAL_P(header)[length-1] = '/0'; Z_STRLEN_P(header)--; if (Z_STRVAL_P(header)[length-2] == '/r') { Z_STRVAL_P(header)[length-2] = '/0'; Z_STRLEN_P(header)--; } } Z_TYPE_P(header) = IS_STRING; zend_hash_next_index_insert(Z_ARRVAL_P(curlstream->headers), &header, sizeof(zval *), NULL); /* based on the header, we might need to trigger a notification */ if (!strncasecmp(data, "Location: ", 10)) { php_stream_notify_info(stream->context, PHP_STREAM_NOTIFY_REDIRECTED, data + 10, 0); } else if (!strncasecmp(data, "Content-Type: ", 14)) { php_stream_notify_info(stream->context, PHP_STREAM_NOTIFY_MIME_TYPE_IS, data + 14, 0); } else if (!strncasecmp(data, "Context-Length: ", 16)) { php_stream_notify_file_size(stream->context, atoi(data + 16), data, 0); php_stream_notify_progress_init(stream->context, 0, 0); } } return length; }
开发者ID:Calado,项目名称:php-src,代码行数:44,
示例21: ast_create_virtual_nodestatic void ast_create_virtual_node(zval *zv, zend_ast_kind kind, zend_ast *ast) { zval tmp_zv, tmp_zv2; object_init_ex(zv, ast_node_ce); ZVAL_LONG(&tmp_zv, kind); ast_update_property(zv, AST_G(str_kind), &tmp_zv, AST_CACHE_SLOT_KIND); ZVAL_LONG(&tmp_zv, ast->attr); ast_update_property(zv, AST_G(str_flags), &tmp_zv, AST_CACHE_SLOT_FLAGS); ZVAL_LONG(&tmp_zv, zend_ast_get_lineno(ast)); ast_update_property(zv, AST_G(str_lineno), &tmp_zv, AST_CACHE_SLOT_LINENO); array_init(&tmp_zv); ast_update_property(zv, AST_G(str_children), &tmp_zv, AST_CACHE_SLOT_CHILDREN); ZVAL_COPY(&tmp_zv2, zend_ast_get_zval(ast)); zend_hash_next_index_insert(Z_ARRVAL(tmp_zv), &tmp_zv2);}
开发者ID:rlerdorf,项目名称:php-ast,代码行数:20,
示例22: c_array_to_php_arrayvoid c_array_to_php_array(void *c_array,int num,zval *php_array,int type){ zval *val; HashTable *ht; int i; convert_to_array(php_array); ht = Z_ARRVAL_P(php_array); for(i = 0;i < num;i++) { MAKE_STD_ZVAL(val); switch(type) { case C_INT_TO_PHP_LONG: ZVAL_LONG(val,(int)((int*)c_array)[i]); break; case C_UINT_TO_PHP_LONG: ZVAL_LONG(val,(unsigned int)((unsigned int*)c_array)[i]); break; case C_LONG_TO_PHP_LONG: ZVAL_LONG(val,((long*)c_array)[i]); break; case C_FLOAT_TO_PHP_DOUBLE: ZVAL_DOUBLE(val,(float)((float*)c_array)[i]); break; case C_DOUBLE_TO_PHP_DOUBLE: ZVAL_DOUBLE(val,(double)((double*)c_array)[i]); break; case C_BOOLEAN_TO_PHP_BOOLEAN: ZVAL_BOOL(val,(unsigned char)((unsigned char*)c_array)[i]); break; case C_CHAR_TO_PHP_LONG: ZVAL_LONG(val,(char)((char*)c_array)[i]); break; case C_USHORT_TO_PHP_LONG: ZVAL_LONG(val,(unsigned short)((unsigned short*)c_array)[i]); break; } zend_hash_next_index_insert(ht,&val,sizeof(zval*),NULL); }}
开发者ID:esix,项目名称:phpopengl,代码行数:41,
示例23: PHP_METHODstatic PHP_METHOD(midgard_query_builder, execute){ RETVAL_FALSE; MidgardConnection *mgd = mgd_handle(TSRMLS_C); CHECK_MGD(mgd); if (zend_parse_parameters_none() == FAILURE) return; _GET_BUILDER_OBJECT; zend_class_entry *ce = php_gobject->user_ce; if (ce == NULL) { php_error(E_WARNING, "Query Builder instance not associated with any class"); return; } guint i, n_objects; GObject **objects = midgard_query_builder_execute(builder, &n_objects); array_init(return_value); if (!objects) return; /* TODO: Should use iterator, instead, and create objects lazily */ for (i = 0; i < n_objects; i++) { GObject *gobject = objects[i]; zval *zobject; MAKE_STD_ZVAL(zobject); php_midgard_gobject_new_with_gobject(zobject, ce, gobject, TRUE TSRMLS_CC); zend_hash_next_index_insert(HASH_OF(return_value), &zobject, sizeof(zval *), NULL); } if (objects) g_free(objects);}
开发者ID:William-Wai,项目名称:midgard-php5,代码行数:40,
示例24: PHP_METHODstatic PHP_METHOD(php_midgard_reflection_class, listSignals){ if (zend_parse_parameters_none() == FAILURE) { return; } _GET_RC_CE; if (ce == NULL) return; array_init(return_value); GType classtype = g_type_from_name(php_class_name_to_g_class_name(ce->name)); if (!classtype) { return; } guint n_ids = 0; guint *ids = g_signal_list_ids(classtype, &n_ids); if (ids == NULL) { return; } size_t i; for (i = 0; i < n_ids; i++) { zval *signalname; MAKE_STD_ZVAL(signalname); ZVAL_STRING(signalname, (char *) g_signal_name(ids[i]), 1); zend_hash_next_index_insert(HASH_OF(return_value), &signalname, sizeof(zval *), NULL); } g_free(ids);}
开发者ID:William-Wai,项目名称:midgard-php5,代码行数:38,
示例25: ast_fill_children_htstatic void ast_fill_children_ht(HashTable *ht, zend_ast *ast, zend_long version) { uint32_t i, count; zend_bool is_list = zend_ast_is_list(ast); zend_ast **children = ast_get_children(ast, &count); for (i = 0; i < count; ++i) { zend_ast *child = children[i]; zend_string *child_name = !is_list && version >= 30 ? ast_kind_child_name(ast->kind, i) : NULL; zval child_zv; if (version >= 20 && ast->kind == ZEND_AST_STMT_LIST && child != NULL && child->kind == ZEND_AST_STMT_LIST) { ast_fill_children_ht(ht, child, version); continue; } if (ast_is_name(child, ast, i)) { ast_create_virtual_node(&child_zv, AST_NAME, child, version); } else if (ast->kind == ZEND_AST_CLOSURE_USES) { ast_create_virtual_node(&child_zv, AST_CLOSURE_VAR, child, version); } else if (version >= 20 && ast_is_var_name(child, ast, i)) { ast_create_virtual_node(&child_zv, ZEND_AST_VAR, child, version); } else if (ast->kind == ZEND_AST_PROP_ELEM && i == 2) { /* Skip docComment child -- It's handled separately */ continue; } else { ast_to_zval(&child_zv, child, version); } if (child_name) { zend_hash_add_new(ht, child_name, &child_zv); } else { zend_hash_next_index_insert(ht, &child_zv); } }}
开发者ID:billschaller,项目名称:php-ast,代码行数:37,
示例26: php_error_docref//.........这里部分代码省略......... } else { response_code = 0; } switch(response_code) { case 200: case 302: case 301: reqok = 1; break; case 403: php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT, tmp_line, response_code); break; default: /* safety net in the event tmp_line == NULL */ if (!tmp_line_len) { tmp_line[0] = '/0'; } php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, response_code); } Z_STRLEN_P(http_response) = tmp_line_len; Z_STRVAL_P(http_response) = estrndup(tmp_line, Z_STRLEN_P(http_response)); if (Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=='/n') { Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=0; Z_STRLEN_P(http_response)--; if (Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=='/r') { Z_STRVAL_P(http_response)[Z_STRLEN_P(http_response)-1]=0; Z_STRLEN_P(http_response)--; } } Z_TYPE_P(http_response) = IS_STRING; zend_hash_next_index_insert(Z_ARRVAL_PP(response_header), &http_response, sizeof(zval *), NULL); } } else { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed, unexpected end of socket!"); goto out; } /* read past HTTP headers */ http_header_line = (char *)emalloc(HTTP_HEADER_BLOCK_SIZE); while (!body && !php_stream_eof(stream)) { if (php_stream_gets(stream, http_header_line, HTTP_HEADER_BLOCK_SIZE-1) != NULL) { char *p; int found_eol = 0; int http_header_line_length; http_header_line[HTTP_HEADER_BLOCK_SIZE-1] = '/0'; p = http_header_line; while(*p) { while(*p == '/n' || *p == '/r') { *p = '/0'; p--; found_eol = 1; } if (found_eol) break; p++; } http_header_line_length = p-http_header_line+1;
开发者ID:Ashod,项目名称:Phalanger,代码行数:66,
示例27: phar_fancy_stat//.........这里部分代码省略......... RETURN_LONG((zend_long)stat_sb->st_ctime.tv_sec);#else RETURN_LONG((zend_long)stat_sb->st_ctime);#endif case FS_TYPE: if (S_ISLNK(stat_sb->st_mode)) { RETURN_STRING("link"); } switch(stat_sb->st_mode & S_IFMT) { case S_IFDIR: RETURN_STRING("dir"); case S_IFREG: RETURN_STRING("file"); } php_error_docref(NULL, E_NOTICE, "Unknown file type (%u)", stat_sb->st_mode & S_IFMT); RETURN_STRING("unknown"); case FS_IS_W: RETURN_BOOL((stat_sb->st_mode & wmask) != 0); case FS_IS_R: RETURN_BOOL((stat_sb->st_mode&rmask)!=0); case FS_IS_X: RETURN_BOOL((stat_sb->st_mode&xmask)!=0 && !S_ISDIR(stat_sb->st_mode)); case FS_IS_FILE: RETURN_BOOL(S_ISREG(stat_sb->st_mode)); case FS_IS_DIR: RETURN_BOOL(S_ISDIR(stat_sb->st_mode)); case FS_IS_LINK: RETURN_BOOL(S_ISLNK(stat_sb->st_mode)); case FS_EXISTS: RETURN_TRUE; /* the false case was done earlier */ case FS_LSTAT: /* FALLTHROUGH */ case FS_STAT: array_init(return_value); ZVAL_LONG(&stat_dev, stat_sb->st_dev); ZVAL_LONG(&stat_ino, stat_sb->st_ino); ZVAL_LONG(&stat_mode, stat_sb->st_mode); ZVAL_LONG(&stat_nlink, stat_sb->st_nlink); ZVAL_LONG(&stat_uid, stat_sb->st_uid); ZVAL_LONG(&stat_gid, stat_sb->st_gid);#ifdef HAVE_ST_RDEV ZVAL_LONG(&stat_rdev, stat_sb->st_rdev);#else ZVAL_LONG(&stat_rdev, -1);#endif ZVAL_LONG(&stat_size, stat_sb->st_size);#ifdef NETWARE ZVAL_LONG(&stat_atime, (stat_sb->st_atime).tv_sec); ZVAL_LONG(&stat_mtime, (stat_sb->st_mtime).tv_sec); ZVAL_LONG(&stat_ctime, (stat_sb->st_ctime).tv_sec);#else ZVAL_LONG(&stat_atime, stat_sb->st_atime); ZVAL_LONG(&stat_mtime, stat_sb->st_mtime); ZVAL_LONG(&stat_ctime, stat_sb->st_ctime);#endif#ifdef HAVE_ST_BLKSIZE ZVAL_LONG(&stat_blksize, stat_sb->st_blksize);#else ZVAL_LONG(&stat_blksize,-1);#endif#ifdef HAVE_ST_BLOCKS ZVAL_LONG(&stat_blocks, stat_sb->st_blocks);#else ZVAL_LONG(&stat_blocks,-1);#endif /* Store numeric indexes in proper order */ zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev); zend_hash_next_index_insert(HASH_OF(return_value), &stat_ino); zend_hash_next_index_insert(HASH_OF(return_value), &stat_mode); zend_hash_next_index_insert(HASH_OF(return_value), &stat_nlink); zend_hash_next_index_insert(HASH_OF(return_value), &stat_uid); zend_hash_next_index_insert(HASH_OF(return_value), &stat_gid); zend_hash_next_index_insert(HASH_OF(return_value), &stat_rdev); zend_hash_next_index_insert(HASH_OF(return_value), &stat_size); zend_hash_next_index_insert(HASH_OF(return_value), &stat_atime); zend_hash_next_index_insert(HASH_OF(return_value), &stat_mtime); zend_hash_next_index_insert(HASH_OF(return_value), &stat_ctime); zend_hash_next_index_insert(HASH_OF(return_value), &stat_blksize); zend_hash_next_index_insert(HASH_OF(return_value), &stat_blocks); /* Store string indexes referencing the same zval*/ zend_hash_str_update(HASH_OF(return_value), stat_sb_names[0], strlen(stat_sb_names[0]), &stat_dev); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[1], strlen(stat_sb_names[1]), &stat_ino); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[2], strlen(stat_sb_names[2]), &stat_mode); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[3], strlen(stat_sb_names[3]), &stat_nlink); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[4], strlen(stat_sb_names[4]), &stat_uid); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[5], strlen(stat_sb_names[5]), &stat_gid); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[6], strlen(stat_sb_names[6]), &stat_rdev); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[7], strlen(stat_sb_names[7]), &stat_size); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[8], strlen(stat_sb_names[8]), &stat_atime); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[9], strlen(stat_sb_names[9]), &stat_mtime); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[10], strlen(stat_sb_names[10]), &stat_ctime); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[11], strlen(stat_sb_names[11]), &stat_blksize); zend_hash_str_update(HASH_OF(return_value), stat_sb_names[12], strlen(stat_sb_names[12]), &stat_blocks); return; } php_error_docref(NULL, E_WARNING, "Didn't understand stat call"); RETURN_FALSE;}
开发者ID:Tyrael,项目名称:php-src,代码行数:101,
示例28: xsl_ext_function_php//.........这里部分代码省略......... node->ns = curns; } else { node = xmlDocCopyNodeList(domintern->document->ptr, node); } php_dom_create_object(node, &child, domintern); add_next_index_zval(&args[i], &child); } } } break; default: str = (char *) xmlXPathCastToString(obj); ZVAL_STRING(&args[i], str); xmlFree(str); } xmlXPathFreeObject(obj); } fci.size = sizeof(fci); fci.function_table = EG(function_table); if (fci.param_count > 0) { fci.params = args; } else { fci.params = NULL; } obj = valuePop(ctxt); if (obj->stringval == NULL) { php_error_docref(NULL, E_WARNING, "Handler name must be a string"); xmlXPathFreeObject(obj); valuePush(ctxt, xmlXPathNewString((const xmlChar *) "")); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { zval_ptr_dtor(&args[i]); } efree(args); } return; } ZVAL_STRING(&handler, (char *) obj->stringval); xmlXPathFreeObject(obj); ZVAL_COPY_VALUE(&fci.function_name, &handler); fci.symbol_table = NULL; fci.object = NULL; fci.retval = &retval; fci.no_separation = 0; /*fci.function_handler_cache = &function_ptr;*/ if (!zend_make_callable(&handler, &callable)) { php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable)); valuePush(ctxt, xmlXPathNewString((const xmlChar *) "")); } else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable) == 0) { php_error_docref(NULL, E_WARNING, "Not allowed to call handler '%s()'", ZSTR_VAL(callable)); /* Push an empty string, so that we at least have an xslt result... */ valuePush(ctxt, xmlXPathNewString((const xmlChar *) "")); } else { result = zend_call_function(&fci, NULL); if (result == FAILURE) { if (Z_TYPE(handler) == IS_STRING) { php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", Z_STRVAL(handler)); valuePush(ctxt, xmlXPathNewString((const xmlChar *) "")); } /* retval is == NULL, when an exception occurred, don't report anything, because PHP itself will handle that */ } else if (Z_ISUNDEF(retval)) { } else { if (Z_TYPE(retval) == IS_OBJECT && instanceof_function(Z_OBJCE(retval), dom_node_class_entry)) { xmlNode *nodep; dom_object *obj; if (intern->node_list == NULL) { ALLOC_HASHTABLE(intern->node_list); zend_hash_init(intern->node_list, 0, NULL, ZVAL_PTR_DTOR, 0); } Z_ADDREF(retval); zend_hash_next_index_insert(intern->node_list, &retval); obj = Z_DOMOBJ_P(&retval); nodep = dom_object_get_node(obj); valuePush(ctxt, xmlXPathNewNodeSet(nodep)); } else if (Z_TYPE(retval) == IS_TRUE || Z_TYPE(retval) == IS_FALSE) { valuePush(ctxt, xmlXPathNewBoolean(Z_LVAL(retval))); } else if (Z_TYPE(retval) == IS_OBJECT) { php_error_docref(NULL, E_WARNING, "A PHP Object cannot be converted to a XPath-string"); valuePush(ctxt, xmlXPathNewString((const xmlChar *) "")); } else { convert_to_string_ex(&retval); valuePush(ctxt, xmlXPathNewString((xmlChar *) Z_STRVAL(retval))); } zval_ptr_dtor(&retval); } } zend_string_release(callable); zval_ptr_dtor(&handler); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { zval_ptr_dtor(&args[i]); } efree(args); }}
开发者ID:guggemand,项目名称:php-src,代码行数:101,
示例29: dom_xpath_ext_function_php//.........这里部分代码省略......... for (j = 0; j < obj->nodesetval->nodeNr; j++) { xmlNodePtr node = obj->nodesetval->nodeTab[j]; zval child; /* not sure, if we need this... it's copied from xpath.c */ if (node->type == XML_NAMESPACE_DECL) { xmlNsPtr curns; xmlNodePtr nsparent; nsparent = node->_private; curns = xmlNewNs(NULL, node->name, NULL); if (node->children) { curns->prefix = xmlStrdup((xmlChar *) node->children); } if (node->children) { node = xmlNewDocNode(node->doc, NULL, (xmlChar *) node->children, node->name); } else { node = xmlNewDocNode(node->doc, NULL, (xmlChar *) "xmlns", node->name); } node->type = XML_NAMESPACE_DECL; node->parent = nsparent; node->ns = curns; } php_dom_create_object(node, &child, &intern->dom); add_next_index_zval(&fci.params[i], &child); } } } break; default: ZVAL_STRING(&fci.params[i], (char *)xmlXPathCastToString(obj)); } xmlXPathFreeObject(obj); } fci.size = sizeof(fci); fci.function_table = EG(function_table); obj = valuePop(ctxt); if (obj->stringval == NULL) { php_error_docref(NULL, E_WARNING, "Handler name must be a string"); xmlXPathFreeObject(obj); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { zval_ptr_dtor(&fci.params[i]); } efree(fci.params); } return; } ZVAL_STRING(&fci.function_name, (char *) obj->stringval); xmlXPathFreeObject(obj); fci.symbol_table = NULL; fci.object = NULL; fci.retval = &retval; fci.no_separation = 0; if (!zend_make_callable(&fci.function_name, &callable)) { php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", callable->val); } else if (intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable) == 0) { php_error_docref(NULL, E_WARNING, "Not allowed to call handler '%s()'.", callable->val); /* Push an empty string, so that we at least have an xslt result... */ valuePush(ctxt, xmlXPathNewString((xmlChar *)"")); } else { result = zend_call_function(&fci, NULL); if (result == SUCCESS && Z_TYPE(retval) != IS_UNDEF) { if (Z_TYPE(retval) == IS_OBJECT && instanceof_function(Z_OBJCE(retval), dom_node_class_entry)) { xmlNode *nodep; dom_object *obj; if (intern->node_list == NULL) { ALLOC_HASHTABLE(intern->node_list); zend_hash_init(intern->node_list, 0, NULL, ZVAL_PTR_DTOR, 0); } GC_REFCOUNT(&retval)++; zend_hash_next_index_insert(intern->node_list, &retval); obj = Z_DOMOBJ_P(&retval); nodep = dom_object_get_node(obj); valuePush(ctxt, xmlXPathNewNodeSet(nodep)); } else if (Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE) { valuePush(ctxt, xmlXPathNewBoolean(Z_TYPE(retval) == IS_TRUE)); } else if (Z_TYPE(retval) == IS_OBJECT) { php_error_docref(NULL, E_WARNING, "A PHP Object cannot be converted to a XPath-string"); valuePush(ctxt, xmlXPathNewString((xmlChar *)"")); } else { zend_string *str = zval_get_string(&retval); valuePush(ctxt, xmlXPathNewString((xmlChar *) str->val)); zend_string_release(str); } zval_ptr_dtor(&retval); } } zend_string_release(callable); zval_dtor(&fci.function_name); if (fci.param_count > 0) { for (i = 0; i < nargs - 1; i++) { zval_ptr_dtor(&fci.params[i]); } efree(fci.params); }}
开发者ID:0xhacking,项目名称:php-src,代码行数:101,
注:本文中的zend_hash_next_index_insert函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zend_hash_num_elements函数代码示例 C++ zend_hash_move_forward_ex函数代码示例 |