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

C++ ALLOC_INIT_ZVAL函数代码示例

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

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



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

示例1: phalcon_array_append_string

int phalcon_array_append_string(zval **arr, char *value, int value_length, int separate TSRMLS_DC){

	zval *zvalue;

	ALLOC_INIT_ZVAL(zvalue);
	Z_SET_REFCOUNT_P(zvalue, 0);
	ZVAL_STRINGL(zvalue, value, value_length, 1);

	return phalcon_array_append(arr, zvalue, separate TSRMLS_CC);
}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:10,代码来源:array.c


示例2: zephir_array_append_string

/**
 * @brief Appends a string @a value to @a arr
 * @param[in,out] arr Array
 * @param value Value
 * @param value_length Length of the value (usually <tt>strlen(value)</tt>)
 * @param separate Flags (@c PH_SEPARATE: separate array if its reference count is greater than 1; @c arr will contain the separated array)
 * @return Whether the operation succeeded
 * @retval @c FAILURE Failure or @a arr is not an array
 * @retval @c SUCCESS Success
 * @throw @c E_WARNING if @a is not an array
 * @see zephir_array_append()
 *
 * Equivalent to <tt>$arr[] = $value</tt> in PHP, where @c $value is a string.
 */
int zephir_array_append_string(zval **arr, char *value, uint value_length, int separate) {

	zval *zvalue;

	ALLOC_INIT_ZVAL(zvalue);
	Z_SET_REFCOUNT_P(zvalue, 0);
	ZVAL_STRINGL(zvalue, value, value_length, 1);

	return zephir_array_append(arr, zvalue, separate);
}
开发者ID:hellcore,项目名称:zephir,代码行数:24,代码来源:array.c


示例3: zephir_array_append_long

/**
 * @brief Appends a long integer @a value to @a arr
 * @param[in,out] arr Array
 * @param value Value
 * @param separate Flags (@c PH_SEPARATE: separate array if its reference count is greater than 1; @c arr will contain the separated array)
 * @return Whether the operation succeeded
 * @retval @c FAILURE Failure or @a arr is not an array
 * @retval @c SUCCESS Success
 * @throw @c E_WARNING if @a is not an array
 * @see zephir_array_append()
 *
 * Equivalent to <tt>$arr[] = $value</tt> in PHP, where @c $value is an integer.
 */
int zephir_array_append_long(zval **arr, long value, int separate) {

    zval *zvalue;

    ALLOC_INIT_ZVAL(zvalue);
    Z_SET_REFCOUNT_P(zvalue, 0);
    ZVAL_LONG(zvalue, value);

    return zephir_array_append(arr, zvalue, separate ZEPHIR_DEBUG_PARAMS_DUMMY);
}
开发者ID:golovanov,项目名称:php-ext-zendxml,代码行数:23,代码来源:array.c


示例4: phalcon_array_append_long

int phalcon_array_append_long(zval **arr, long value, int separate TSRMLS_DC){

	zval *zvalue;

	ALLOC_INIT_ZVAL(zvalue);
	Z_SET_REFCOUNT_P(zvalue, 0);
	ZVAL_LONG(zvalue, value);

	return phalcon_array_append(arr, zvalue, separate TSRMLS_CC);
}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:10,代码来源:array.c


示例5: PHP_METHOD

/** {{{ public ZeRecorder::fetchAll()
 */
PHP_METHOD(ze_recorder, fetchAll) {
	zval *   self        = NULL;
	zval *   stmt        = NULL;
	long     style       = 0;
	zval *   style_z     = NULL;
	zval *   success     = NULL;
	zval *   row         = NULL;

	/* PDO::FETCH_ASSOC */
	style   =   2;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l"
							 , &style
							 ) == FAILURE) {
		WRONG_PARAM_COUNT;
	}
	/* call execute */
	/* call fetch */

	self = getThis();

	stmt = zend_read_property(ze_recorder_ce, self, ZEND_STRL(ZE_STMT), 0 TSRMLS_CC);

	do {
		if (!stmt || Z_TYPE_P(stmt) != IS_OBJECT) {
			ze_error(E_ERROR TSRMLS_CC, "recorder.fetch.stmt.not_object");
			break;
		}

		zend_call_method(&stmt, Z_OBJCE_P(stmt), NULL, ZEND_STRL("execute"), &success, 0, NULL, NULL TSRMLS_CC);

		if (!success || EG(exception)) {
			break;
		}

		convert_to_boolean(success);

		if (Z_BVAL_P(success) == 1) {
			ALLOC_INIT_ZVAL(style_z);
			ZVAL_LONG(style_z, style);
			zend_call_method(&stmt, NULL, NULL, ZEND_STRL("fetchAll"), &row, 1, style_z, NULL TSRMLS_CC);
			zval_dtor(style_z);
			FREE_ZVAL(style_z);
		}

		zval_dtor(success);
		FREE_ZVAL(success);
	} while (0);

	if (row) {
		RETURN_ZVAL(row, 1, 1);
	} else {
		RETURN_FALSE;
	}
}
开发者ID:eixom,项目名称:zoeeyphp,代码行数:57,代码来源:recorder.c


示例6: signature

// time critical
bool PHPQt::qt_metacall(smokephp_object* o, Smoke::Stack args)
{
    Context::setCallType( Context::SlotCall );
    const QMetaObject* staticMetaObject = o->meta();
    const int _id = args[2].s_int;
    const int offset = staticMetaObject->methodOffset();

    const QByteArray signature( staticMetaObject->method(_id).signature() );
    const QByteArray metaMethodName = signature.left( signature.indexOf("(") );

    //! - if we have a slot overridden in php user space: call it
    //!   @see InvokeSlot
    if( PHPQt::methodExists( o->ce_ptr() , metaMethodName.constData()) ) {
        pDebug( PHPQt::Slot ) << " userspace " << signature << o->ce_ptr()->name;
        const int count = staticMetaObject->method( args[2].s_int ).parameterTypes().count() + 1;
        // zval* zmem = ALLOCA_N(zval, count);
        zval** zmem = (zval**) safe_emalloc( sizeof(zval*), count+1, 0);
        for( int i=0;i<count;i++ )
        {
            ALLOC_INIT_ZVAL( zmem[i] );
        }

        // NOTICE is memory allocation safe here?
        InvokeSlot c( o->smoke(), args, o->zval_ptr(), zmem, _id, staticMetaObject, (void**) args[3].s_voidp, metaMethodName );
        c.next();

        efree(zmem);
        return true;

    } else {
        if ( staticMetaObject->indexOfSlot( signature ) != -1 )
        {
            pDebug( PHPQt::Slot ) << " C++ " << signature;
            // return false means this will be done by smoke
            return false;
        } else {
            // TODO error case for undefined methods, see php_qt proxyMethod
            //			const int i = staticMetaObject->indexOfSignal( signature );
            //			const int offset = staticMetaObject->methodOffset(); // The offset is the summary of all methods in the class's superclasses
            pDebug( PHPQt::Signal ) << signature << staticMetaObject->className() << _id << staticMetaObject->methodOffset();

            /* C++ */	//if( _id < offset ) { qWarning() << "got an id smaller than offset"; }

            /**
            * We go through QMetaObject::activate, because it can either be connected to a C++ Slot or a user space Slot
            * cast to a QObject using smoke cast
            * */
            QObject* ptr = (QObject*) o->smoke()->cast( const_cast<void*>( o->ptr() ), o->classId(), cachedQObjectSmokeId );
            void *_b[] = { 0, ((void**) args[3].s_voidp)[1] };
            QMetaObject::activate( ptr, staticMetaObject, 0, _b );
            return true; // success
        }
    } // else method exist
    return false;
}
开发者ID:0xd34df00d,项目名称:Qross,代码行数:56,代码来源:phpqt_internals.cpp


示例7: php_jq_filter

static void
php_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,代码来源:jq.c


示例8: cp_unserialize

CPINLINE zval * cp_unserialize(char *data, int len) {
    zval *unser_value;
    ALLOC_INIT_ZVAL(unser_value);
    php_unserialize_data_t var_hash;
    PHP_VAR_UNSERIALIZE_INIT(var_hash);
    if (php_var_unserialize(&unser_value, (const unsigned char **) &data, (unsigned char *) data + len - 1, &var_hash TSRMLS_CC) != 1)
    {
//        php_error_docref(NULL TSRMLS_CC, E_NOTICE, "unser data is corrupted");
    }
    PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
    return unser_value;
}
开发者ID:damaainan,项目名称:php-cp,代码行数:12,代码来源:cpFunction.c


示例9: qb_add_array

static 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,代码来源:qb_extractor.c


示例10: php_jam_invoke_handler

void php_jam_invoke_handler(int type TSRMLS_DC, const char *error_filename, const uint error_lineno, const char *format, ...)
{
	zval *event;
	va_list args;

	ALLOC_INIT_ZVAL(event);
	array_init(event);
	
	va_start(args, format);
	php_jam_capture_error_ex(event, type, error_filename, error_lineno, 1, format, args TSRMLS_CC);
	va_end(args);
}
开发者ID:brzuchal,项目名称:jam,代码行数:12,代码来源:jam.c


示例11: phalcon_call_method_params_normal

/**
 * Call methods that require parameters in a old-style secure way
 */
inline int phalcon_call_method_params_normal(zval *return_value, zval *object, char *method_name, int method_len, zend_uint param_count, zval *params[], int check, int noreturn TSRMLS_DC){

	zval *fn = NULL;
	int status = FAILURE;
	zend_class_entry *ce, *active_scope = NULL;

	if (check) {
		if (!zend_hash_exists(&Z_OBJCE_P(object)->function_table, method_name, method_len+1)) {
			return SUCCESS;
		}
	}

	if (!noreturn) {
		ALLOC_INIT_ZVAL(return_value);
	}

	PHALCON_ALLOC_ZVAL(fn);
	ZVAL_STRINGL(fn, method_name, method_len, 1);

	if (Z_TYPE_P(object) == IS_OBJECT) {
		active_scope = EG(scope);
		ce = Z_OBJCE_P(object);
		phalcon_find_scope(ce, method_name, method_len TSRMLS_CC);
		status = PHALCON_CALL_USER_FUNCTION(&ce->function_table, &object, fn, return_value, param_count, params TSRMLS_CC);
		if (status == FAILURE) {
			EG(scope) = active_scope;
			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined method %s() on class %s", Z_STRVAL_P(fn), Z_OBJCE_P(object)->name);
			status = FAILURE;
		}
		EG(scope) = active_scope;
	} else {
		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to method %s() on a non object", Z_STRVAL_P(fn));
		status = FAILURE;
	}

	zval_ptr_dtor(&fn);

	if (!noreturn) {
		zval_ptr_dtor(&return_value);
		return_value = NULL;
	}

	if (EG(exception)){
		status = FAILURE;
	}

	if (status == FAILURE) {
		phalcon_memory_restore_stack(TSRMLS_C);
	}

	return status;
}
开发者ID:gplanchat,项目名称:cphalcon,代码行数:55,代码来源:fcall.c


示例12: phalcon_call_func_params

/**
 * Call single function which requires arbitrary number of parameters
 */
int phalcon_call_func_params(zval *return_value, char *func_name, int func_length, zend_uint param_count, zval *params[], int noreturn, int fcache_pointer TSRMLS_DC){

	zval *fn = NULL;
	int status = FAILURE;
	//zval ***params_array;
	zval *local_retval_ptr = NULL;
	//int i;

	if (!noreturn) {
		ALLOC_INIT_ZVAL(return_value);
	}

	PHALCON_ALLOC_ZVAL(fn);
	ZVAL_STRINGL(fn, func_name, func_length, 1);

	/*status = phalcon_cache_lookup_function(fn, fcache_pointer);
	if (status == FAILURE) {
		return FAILURE;
	}*/

	/*if(param_count){
		params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
		for (i=0; i<param_count; i++) {
			params_array[i] = &params[i];
		}
	} else {
		params_array = NULL;
	}*/

	status = call_user_function(CG(function_table), NULL, fn, return_value, param_count, params TSRMLS_CC);
	//status = phalcon_call_user_function_ex(CG(function_table), NULL, fn, &local_retval_ptr, param_count, params_array, 1, NULL, phalcon_fcall_cache[fcache_pointer] TSRMLS_CC);
	if (status == FAILURE) {
		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function %s()", func_name);
		return FAILURE;
	}

	zval_ptr_dtor(&fn);

	if (local_retval_ptr) {
		COPY_PZVAL_TO_ZVAL(*return_value, local_retval_ptr);
	}

	if (!noreturn) {
		zval_ptr_dtor(&return_value);
	}

	/*if (params_array) {
		efree(params_array);
	}*/

	return status;
}
开发者ID:xingskycn,项目名称:cphalcon,代码行数:55,代码来源:fcall.c


示例13: cpWorker_loop

static int cpWorker_loop(int worker_id)
{
    CPWG.id = worker_id;
    char fifo_name[CP_FIFO_NAME_LEN] = {0};
    sprintf(fifo_name, "%s_%d", CP_FIFO_NAME_PRE, CPGC.group_id * CP_GROUP_LEN + worker_id); //client 2 worker
    int pipe_fd_read = cpCreateFifo(fifo_name);

    sprintf(fifo_name, "%s_%d_1", CP_FIFO_NAME_PRE, CPGC.group_id * CP_GROUP_LEN + worker_id); //worker 2 client
    int pipe_fd_write = cpCreateFifo(fifo_name);
    CPGS->workers[worker_id].pipe_fd_write = pipe_fd_write;
    cpShareMemory *sm_obj = &(CPGS->workers[worker_id].sm_obj);

    cpWorkerInfo event;
    bzero(&event, sizeof (event));
    int ret, len = 0;
    int event_len = sizeof (event);
    while (CPGS->running) {
        zval *ret_value;
        ALLOC_INIT_ZVAL(ret_value);
        if (CPGS->workers[worker_id].pre_len) {
            len = CPGS->workers[worker_id].pre_len;
            CPGS->workers[worker_id].pre_len = 0;
            CPWG.clientPid = CPGS->workers[worker_id].pre_pid;
        } else {
            do {
                ret = cpFifoRead(pipe_fd_read, &event, event_len);
                if (ret < 0) {
                    cpLog("fifo read Error: %s [%d]", strerror(errno), errno);
                }
            } while (event.pid != CPGS->workers[worker_id].CPid); //有可能有脏数据  读出来
            if (!CPGS->workers[worker_id].run) {
                CPGS->workers[worker_id].pre_len = event.len; //啊~~我要挂了,赶紧存起来 下次再用
                CPGS->workers[worker_id].pre_pid = event.pid;
                break;
            }
            len = event.len;
//            cpLog("worker %d len",len);
            CPWG.clientPid = event.pid;
        }
        if (sm_obj->mem == NULL) {
            if ((sm_obj->mem = shmat(sm_obj->shmid, NULL, 0)) < 0) {
                cpLog("attach sys mem error Error: %s [%d]", strerror(errno), errno);
            }
        }
        if (ret < 0) {
            cpLog("fifo read Error: %s [%d]", strerror(errno), errno);
        }
        php_msgpack_unserialize(ret_value, sm_obj->mem, len);
        worker_onReceive(ret_value);
    }
    return SUCCESS;
}
开发者ID:WalterShe,项目名称:php-cp,代码行数:52,代码来源:cpWorker.c


示例14: phalcon_call_static_zval_func_params

/**
 * Call single static function on a zval which requires parameters
 */
inline int phalcon_call_static_zval_func_params(zval *return_value, zval *mixed_name, char *method_name, int method_len, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC){

	zval *fn;
	int status = FAILURE;

	if (!noreturn) {
		ALLOC_INIT_ZVAL(return_value);
	}

	ALLOC_INIT_ZVAL(fn);
	array_init(fn);
	add_next_index_zval(fn, mixed_name);
	add_next_index_stringl(fn, method_name, method_len, 1);

	status = phalcon_call_user_function(CG(function_table), NULL, fn, return_value, param_count, params TSRMLS_CC);
	if (status == FAILURE) {
		if(Z_TYPE_P(mixed_name) == IS_STRING) {
			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function %s::%s()", Z_STRVAL_P(mixed_name), method_name);
		} else {
			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function not-callable::%s()", method_name);
		}
	}

	zval_ptr_dtor(&fn);

	if (!noreturn) {
		zval_ptr_dtor(&return_value);
	}

	if (EG(exception)) {
		status = FAILURE;
	}

	if (status == FAILURE) {
		phalcon_memory_restore_stack(TSRMLS_C);
	}

	return status;
}
开发者ID:Tigerlee1987,项目名称:cphalcon,代码行数:42,代码来源:fcall.c


示例15: PHP_METHOD

PHP_METHOD(SpotifyPlaylist, getTracks)
{
	zval tempretval, *type, *spotifyobject;

	ALLOC_INIT_ZVAL(type);
	Z_TYPE_P(type) = IS_LONG;
	Z_LVAL_P(type) = 0;

	spotifyobject = GET_THIS_PROPERTY(spotifyplaylist_ce, "spotify");

	object_init_ex(return_value, spotifytrackiterator_ce);
	SPOTIFY_METHOD3(SpotifyTrackIterator, __construct, &tempretval, return_value, getThis(), type, spotifyobject);
}
开发者ID:DaanMeijer,项目名称:libspotify-php,代码行数:13,代码来源:playlist.c


示例16: ONPHP_METHOD

ONPHP_METHOD(DBField, toDialectString)
{
	smart_str string = {0};
	zval *table, *field, *dialect, *cast, *quoted;
	
	ONPHP_GET_ARGS("O", &dialect, onphp_ce_Dialect);
	
	table = ONPHP_READ_PROPERTY(getThis(), "table");
	field = ONPHP_READ_PROPERTY(getThis(), "field");
	cast = ONPHP_READ_PROPERTY(getThis(), "cast");
	
	// either null or instance of DialectString
	if (Z_TYPE_P(table) == IS_OBJECT) {
		zval *tmp;
		
		ONPHP_CALL_METHOD_1(table, "todialectstring", &tmp, dialect);
		
		onphp_append_zval_to_smart_string(&string, tmp);
		zval_ptr_dtor(&tmp);
		smart_str_appendc(&string, '.');
	}
	
	ONPHP_CALL_METHOD_1(dialect, "quotefield", &quoted, field);
	
	onphp_append_zval_to_smart_string(&string, quoted);
	
	zval_ptr_dtor(&quoted);
	
	smart_str_0(&string);
	
	if (Z_STRLEN_P(cast)) {
		zval *tmp, *out;
		
		ALLOC_INIT_ZVAL(tmp);
		
		ZVAL_STRINGL(tmp, string.c, string.len, 1);
		
		ONPHP_CALL_METHOD_2_NORET(dialect, "tocasted", &out, tmp, cast);
		
		ZVAL_FREE(tmp);
		smart_str_free(&string);
		
		if (EG(exception)) {
			return;
		}
		
		RETURN_ZVAL(out, 1, 1);
	}
	
	RETURN_STRINGL(string.c, string.len, 0);
}
开发者ID:suquant,项目名称:soloweb-onphp,代码行数:51,代码来源:DBField.c


示例17: PHP_METHOD

/**
 * Checks a plain text password and its hash version to check if the password matches
 *
 * @param string $password
 * @param string $passwordHash
 * @param int $maxPasswordLength
 * @return boolean
 */
PHP_METHOD(Phalcon_Security, checkHash){

	zval **password, **password_hash, **max_pass_length = NULL, *hash;
	zval* params[2];
	int check = 0;

	phalcon_fetch_params_ex(2, 1, &password, &password_hash, &max_pass_length);
	
	PHALCON_ENSURE_IS_STRING(password);

	if (max_pass_length) {
		PHALCON_ENSURE_IS_LONG(max_pass_length);

		if (Z_LVAL_PP(max_pass_length) > 0 && Z_STRLEN_PP(password) > Z_LVAL_PP(max_pass_length)) {
			RETURN_FALSE;
		}
	}

	params[0] = *password;
	params[1] = *password_hash;

	ALLOC_INIT_ZVAL(hash);
	phalcon_call_func_params_w(hash, SL("crypt"), 2, params TSRMLS_CC);
	if (UNEXPECTED(EG(exception) != NULL)) {
		zval_ptr_dtor(&hash);
		RETURN_NULL();
	}

	if (UNEXPECTED(Z_TYPE_P(hash) != IS_STRING)) {
		convert_to_string(hash);
	}

	if (Z_STRLEN_P(hash) == Z_STRLEN_PP(password_hash)) {
		int n    = Z_STRLEN_P(hash);
		char *h1 = Z_STRVAL_P(hash);
		char *h2 = Z_STRVAL_PP(password_hash);

		while (n) {
			check |= ((unsigned int)*h1) ^ ((unsigned int)*h2);
			++h1;
			++h2;
			--n;
		}

		zval_ptr_dtor(&hash);
		RETURN_BOOL(check == 0);
	}

	zval_ptr_dtor(&hash);
	RETURN_FALSE;
}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:59,代码来源:security.c


示例18: PHP_METHOD

/**
 * Check whether a model is already initialized
 *
 * @param string $modelName
 * @return bool
 */
PHP_METHOD(Phalcon_Mvc_Collection_Manager, isInitialized){

	zval *model_name, *initialized, *lowercased;

	phalcon_fetch_params(0, 1, 0, &model_name);
	
	initialized = phalcon_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY TSRMLS_CC);
	
	ALLOC_INIT_ZVAL(lowercased);
	phalcon_fast_strtolower(lowercased, model_name);
	
	RETVAL_BOOL(phalcon_array_isset(initialized, lowercased));
	zval_ptr_dtor(&lowercased);
}
开发者ID:100851766,项目名称:cphalcon,代码行数:20,代码来源:manager.c


示例19: php_jam_user_event_trigger

static void php_jam_user_event_trigger(int type TSRMLS_DC, const char *error_filename, const uint error_lineno, const char *format, ...)
{
	zval *event;
	va_list args;

	ALLOC_INIT_ZVAL(event);
	array_init(event);
	
	add_assoc_bool(event, "jam_event_trigger", 1);
	
	va_start(args, format);
	php_jam_capture_error_ex(event, type, error_filename, error_lineno, 1, format, args TSRMLS_CC);
	va_end(args);
}
开发者ID:brzuchal,项目名称:jam,代码行数:14,代码来源:jam.c


示例20: phalcon_array_unset

/**
 * Unsets zval index from array
 */
int PHALCON_FASTCALL phalcon_array_unset(zval *arr, zval *index){

	zval *copy;
	int exists, copied = 0;

	if (Z_TYPE_P(arr) != IS_ARRAY) {
		return 0;
	}

	if (Z_TYPE_P(index) == IS_NULL) {
		ALLOC_INIT_ZVAL(copy);
		ZVAL_ZVAL(copy, index, 1, 0);
		convert_to_string(copy);
		index = copy;
		copied = 1;
	} else {
		if (Z_TYPE_P(index) == IS_BOOL || Z_TYPE_P(index) == IS_DOUBLE) {
			ALLOC_INIT_ZVAL(copy);
			ZVAL_ZVAL(copy, index, 1, 0);
			convert_to_long(copy);
			index = copy;
			copied = 1;
		}
	}

	if (Z_TYPE_P(index) == IS_STRING) {
		exists = zend_hash_del(Z_ARRVAL_P(arr), Z_STRVAL_P(index), Z_STRLEN_P(index)+1);
	} else {
		exists = zend_hash_index_del(Z_ARRVAL_P(arr), Z_LVAL_P(index));
	}

	if (copied) {
		zval_ptr_dtor(&copy);
	}

	return exists;
}
开发者ID:meibk,项目名称:cphalcon,代码行数:40,代码来源:array.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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