您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ zend_string_free函数代码示例

51自学网 2021-06-03 11:57:28
  C++
这篇教程C++ zend_string_free函数代码示例写得很实用,希望能帮到您。

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

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

示例1: php_password_salt_to64

static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */{    size_t pos = 0;    zend_string *buffer;    if ((int) str_len < 0) {        return FAILURE;    }    buffer = php_base64_encode((unsigned char*) str, str_len);    if (ZSTR_LEN(buffer) < out_len) {        /* Too short of an encoded string generated */        zend_string_release(buffer);        return FAILURE;    }    for (pos = 0; pos < out_len; pos++) {        if (ZSTR_VAL(buffer)[pos] == '+') {            ret[pos] = '.';        } else if (ZSTR_VAL(buffer)[pos] == '=') {            zend_string_free(buffer);            return FAILURE;        } else {            ret[pos] = ZSTR_VAL(buffer)[pos];        }    }    zend_string_free(buffer);    return SUCCESS;}
开发者ID:pinepain,项目名称:php-src,代码行数:26,


示例2: zephir_get_global

/** * Gets the global zval into PG macro */int zephir_get_global(zval *arr, const char *global, unsigned int global_length){	zval *gv;	zend_bool jit_initialization = PG(auto_globals_jit);	zend_string *str = zend_string_init(global, global_length, 0);	if (jit_initialization) {		zend_is_auto_global(str);	}	zval_ptr_dtor(arr);	ZVAL_UNDEF(arr);	if (&EG(symbol_table)) {		if ((gv = zend_hash_find(&EG(symbol_table), str)) != NULL) {			if (Z_TYPE_P(gv) == IS_ARRAY) {				ZVAL_COPY_VALUE(arr, gv);				zend_string_free(str);				return SUCCESS;			}		}	}	array_init(arr);	zend_hash_update(&EG(symbol_table), str, arr);	zend_string_free(str);	return SUCCESS;}
开发者ID:KorsaR-ZN,项目名称:zephir,代码行数:30,


示例3: memset

/* {{{ php_zlib_encode() */static zend_string *php_zlib_encode(const char *in_buf, size_t in_len, int encoding, int level){	int status;	z_stream Z;	zend_string *out;	memset(&Z, 0, sizeof(z_stream));	Z.zalloc = php_zlib_alloc;	Z.zfree = php_zlib_free;	if (Z_OK == (status = deflateInit2(&Z, level, Z_DEFLATED, encoding, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY))) {		out = zend_string_alloc(PHP_ZLIB_BUFFER_SIZE_GUESS(in_len), 0);		Z.next_in = (Bytef *) in_buf;		Z.next_out = (Bytef *) ZSTR_VAL(out);		Z.avail_in = in_len;		Z.avail_out = ZSTR_LEN(out);		status = deflate(&Z, Z_FINISH);		deflateEnd(&Z);		if (Z_STREAM_END == status) {			/* size buffer down to actual length */			out = zend_string_truncate(out, Z.total_out, 0);			ZSTR_VAL(out)[ZSTR_LEN(out)] = '/0';			return out;		} else {			zend_string_free(out);		}	}	php_error_docref(NULL, E_WARNING, "%s", zError(status));	return NULL;}
开发者ID:Furgas,项目名称:php-src,代码行数:35,


示例4: if

static zend_constant *zend_get_special_constant(const char *name, size_t name_len){	zend_constant *c;	static char haltoff[] = "__COMPILER_HALT_OFFSET__";	if (!EG(current_execute_data)) {		return NULL;	} else if (name_len == sizeof("__COMPILER_HALT_OFFSET__")-1 &&	          !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) {		const char *cfilename;		zend_string *haltname;		size_t clen;		cfilename = zend_get_executed_filename();		clen = strlen(cfilename);		/* check for __COMPILER_HALT_OFFSET__ */		haltname = zend_mangle_property_name(haltoff,			sizeof("__COMPILER_HALT_OFFSET__") - 1, cfilename, clen, 0);		c = zend_hash_find_ptr(EG(zend_constants), haltname);		zend_string_free(haltname);		return c;	} else {		return NULL;	}}
开发者ID:0xhacking,项目名称:php-src,代码行数:25,


示例5: intl_error_reset

/* {{{ clone handler for Transliterator */static zend_object *Transliterator_clone_obj( zval *object ){	Transliterator_object *to_orig,	                      *to_new;	zend_object 		  *ret_val;	intl_error_reset( NULL );	to_orig = Z_INTL_TRANSLITERATOR_P( object );	intl_error_reset( INTL_DATA_ERROR_P( to_orig ) );	ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) );	to_new  = php_intl_transliterator_fetch_object( ret_val );	zend_objects_clone_members( &to_new->zo, &to_orig->zo );	if( to_orig->utrans != NULL )	{		zval			tempz; /* dummy zval to pass to transliterator_object_construct */		/* guaranteed to return NULL if it fails */		UTransliterator *utrans = utrans_clone( to_orig->utrans, TRANSLITERATOR_ERROR_CODE_P( to_orig ) );		if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to_orig ) ) )			goto err;		ZVAL_OBJ(&tempz, ret_val);		transliterator_object_construct( &tempz, utrans,			TRANSLITERATOR_ERROR_CODE_P( to_orig ) );		if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to_orig ) ) )		{			zend_string *err_msg;err:			if( utrans != NULL )				transliterator_object_destroy( to_new );			/* set the error anyway, in case in the future we decide not to			 * throw an error. It also helps build the error message */			intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( to_orig ) );			intl_errors_set_custom_msg( TRANSLITERATOR_ERROR_P( to_orig ),				"Could not clone transliterator", 0 );			err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) );			zend_throw_error( NULL, "%s", ZSTR_VAL(err_msg) );			zend_string_free( err_msg ); /* if it's changed into a warning */			/* do not destroy tempz; we need to return something */		}	}	else	{		/* We shouldn't have unconstructed objects in the first place */		php_error_docref( NULL, E_WARNING,			"Cloning unconstructed transliterator." );	}	return ret_val;}
开发者ID:IMSoP,项目名称:php-src,代码行数:58,


示例6: php_info_print_html_esc

static int php_info_print_html_esc(const char *str, size_t len) /* {{{ */{	size_t written;	zend_string *new_str;	new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8");	written = php_output_write(ZSTR_VAL(new_str), ZSTR_LEN(new_str));	zend_string_free(new_str);	return written;}
开发者ID:PeeHaa,项目名称:php-src,代码行数:10,


示例7: zend_string_alloc

static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t maxlen){	size_t i, j;	zend_string *str = zend_string_alloc(len, 0);	unsigned char *end = *(unsigned char **)p+maxlen;	if (end < *p) {		zend_string_free(str);		return NULL;	}	for (i = 0; i < len; i++) {		if (*p >= end) {			zend_string_free(str);			return NULL;		}		if (**p != '//') {			ZSTR_VAL(str)[i] = (char)**p;		} else {			unsigned char ch = 0;			for (j = 0; j < 2; j++) {				(*p)++;				if (**p >= '0' && **p <= '9') {					ch = (ch << 4) + (**p -'0');				} else if (**p >= 'a' && **p <= 'f') {					ch = (ch << 4) + (**p -'a'+10);				} else if (**p >= 'A' && **p <= 'F') {					ch = (ch << 4) + (**p -'A'+10);				} else {					zend_string_free(str);					return NULL;				}			}			ZSTR_VAL(str)[i] = (char)ch;		}		(*p)++;	}	ZSTR_VAL(str)[i] = 0;	ZSTR_LEN(str) = i;	return str;}
开发者ID:Freeaqingme,项目名称:php-src,代码行数:42,


示例8: co_socket_onReadable

static int co_socket_onReadable(swReactor *reactor, swEvent *event){    util_socket *sock = (util_socket *) event->socket->object;    php_context *context = &sock->context;    zval *retval = NULL;    zval result;    reactor->del(reactor, sock->fd);    if (sock->timer)    {        swTimer_del(&SwooleG.timer, sock->timer);        sock->timer = NULL;    }    int n = read(sock->fd, sock->buf->val, sock->nbytes);    if (n < 0)    {        ZVAL_FALSE(&result);        zend_string_free(sock->buf);    }    else if (n == 0)    {        ZVAL_EMPTY_STRING(&result);        zend_string_free(sock->buf);    }    else    {        sock->buf->val[n] = 0;        sock->buf->len = n;        ZVAL_STR(&result, sock->buf);    }    int ret = coro_resume(context, &result, &retval);    zval_ptr_dtor(&result);    if (ret == CORO_END && retval)    {        zval_ptr_dtor(retval);    }    efree(sock);    return SW_OK;}
开发者ID:didiwuliu,项目名称:swoole-src,代码行数:42,


示例9: php_info_print_html_esc

static int php_info_print_html_esc(const char *str, size_t len) /* {{{ */{	size_t written;	zend_string *new_str;	TSRMLS_FETCH();	new_str = php_escape_html_entities((unsigned char *) str, len, 0, ENT_QUOTES, "utf-8" TSRMLS_CC);	written = php_output_write(new_str->val, new_str->len TSRMLS_CC);	zend_string_free(new_str);	return written;}
开发者ID:Frgituser,项目名称:php-src,代码行数:11,


示例10: ds_throw_exception

void ds_throw_exception(zend_class_entry *ce, const char *format, ...){    va_list ap;    zend_string *str;    va_start(ap, format);    str = vstrpprintf(0, format, ap);    va_end(ap);    zend_throw_exception(ce, str->val, 0);    zend_string_free(str);}
开发者ID:php-ds,项目名称:extension,代码行数:12,


示例11: stream_client_do_connect_blocking

void stream_client_do_connect_blocking(        skyray_stream_client_t *self, zend_object *protocol_obj,        zend_string *host, zend_long port, zval *return_value){    int fd = stream_client_do_connect(host->val, port);    if (fd < 0) {        return;    }    zval zstream;    object_init_ex(&zstream, skyray_ce_Stream);    zend_object *stream = Z_OBJ_P(&zstream);    skyray_stream_t * stream_intern = skyray_stream_from_obj(stream);    skyray_stream_init_blocking(stream_intern, SR_TCP, fd, protocol_obj);    skyray_stream_on_opened(stream_intern, SR_READABLE | SR_WRITABLE);    if (!self->protocol_creator) {        ZVAL_COPY(return_value, &zstream);        return;    }    zend_string *buffer;    ++GC_REFCOUNT(protocol_obj); //preventing protocol instance be free'd after connection closed.    while((buffer = skyray_stream_read(stream_intern, 0))) {        if (buffer->len == 0) {            zend_string_free(buffer);            break;        }        skyray_stream_on_data(stream_intern, buffer);        zend_string_free(buffer);    }    RETURN_OBJ(protocol_obj);}
开发者ID:Lucups,项目名称:Skyray,代码行数:39,


示例12: smart_str_appendl

PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, const char *name, const char *value, size_t *newlen, int encode){	char *result;	smart_str surl = {0};	smart_str buf = {0};	smart_str url_app = {0};	zend_string *encoded;	smart_str_appendl(&surl, url, urllen);	if (encode) {		encoded = php_raw_url_encode(name, strlen(name));		smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));		zend_string_free(encoded);	} else {		smart_str_appends(&url_app, name);	}	smart_str_appendc(&url_app, '=');	if (encode) {		encoded = php_raw_url_encode(value, strlen(value));		smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded));		zend_string_free(encoded);	} else {		smart_str_appends(&url_app, value);	}	append_modified_url(&surl, &buf, &url_app, PG(arg_separator).output);	smart_str_0(&buf);	if (newlen) *newlen = ZSTR_LEN(buf.s);	result = estrndup(ZSTR_VAL(buf.s), ZSTR_LEN(buf.s));	smart_str_free(&url_app);	smart_str_free(&buf);	return result;}
开发者ID:LTD-Beget,项目名称:php-src,代码行数:37,


示例13: smart_str_appendz

void smart_str_appendz(smart_str *buffer, zval *value){    switch (Z_TYPE_P(value)) {        case IS_STRING:            smart_str_append(buffer, Z_STR_P(value));            return;        case IS_LONG:            smart_str_append_long(buffer, Z_LVAL_P(value));            return;    }    zend_string *str = zval_get_string(value);    smart_str_append(buffer, str);    zend_string_free(str);}
开发者ID:php-ds,项目名称:extension,代码行数:15,


示例14: ZVAL_STRINGL

/* This function is meant to unify the headers passed to to mail() * This means, use PCRE to transform single occurrences of /n or /r in /r/n * As a second step we also eleminate all /r/n occurrences which are: * 1) At the start of the header * 2) At the end of the header * 3) Two or more occurrences in the header are removed so only one is left * * Returns NULL on error, or the new char* buffer on success. * You have to take care and efree() the buffer on your own. */static zend_string *php_win32_mail_trim_header(char *header){#if HAVE_PCRE || HAVE_BUNDLED_PCRE		zend_string *result, *result2;	zval replace;	zend_string *regex;	if (!header) {		return NULL;	}	ZVAL_STRINGL(&replace, PHP_WIN32_MAIL_UNIFY_REPLACE, strlen(PHP_WIN32_MAIL_UNIFY_REPLACE));	regex = zend_string_init(PHP_WIN32_MAIL_UNIFY_REPLACE, sizeof(PHP_WIN32_MAIL_UNIFY_REPLACE)-1, 0);//zend_string *php_pcre_replace(zend_string *regex, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int limit, int *replace_count);	result = php_pcre_replace(regex,							  header, (int)strlen(header),							  &replace,							  0,							  -1,							  NULL);	if (NULL == result) {		zval_ptr_dtor(&replace);		zend_string_free(regex);		return NULL;	}	ZVAL_STRING(&replace, PHP_WIN32_MAIL_RMVDBL_PATTERN);	regex = zend_string_init(PHP_WIN32_MAIL_RMVDBL_PATTERN, sizeof(PHP_WIN32_MAIL_RMVDBL_PATTERN)-1, 0);	result2 = php_pcre_replace(regex,							   result->val, (int)result->len,							   &replace,							  0,							  -1,							  NULL);	return result;#else	/* In case we don't have PCRE support (for whatever reason...) simply do nothing and return the unmodified header */	return estrdup(header);#endif}
开发者ID:AmesianX,项目名称:php-src,代码行数:56,


示例15: ion_buffer_read_all

zend_string * ion_buffer_read_all(ion_buffer * buffer) {    size_t incoming_length = evbuffer_get_length(bufferevent_get_input(buffer));    zend_string * data;    if(!incoming_length) {        return ZSTR_EMPTY_ALLOC();    }    data = zend_string_alloc(incoming_length, 0);    ZSTR_LEN(data) = bufferevent_read(buffer, ZSTR_VAL(data), incoming_length);    if (ZSTR_LEN(data) > 0) {        ZSTR_VAL(data)[ZSTR_LEN(data)] = '/0';        return data;    } else {        zend_string_free(data);        return NULL;    }}
开发者ID:dreamsxin,项目名称:php-ion,代码行数:18,


示例16: spl_find_ce_by_name

static zend_class_entry * spl_find_ce_by_name(zend_string *name, zend_bool autoload){	zend_class_entry *ce;	if (!autoload) {		zend_string *lc_name = zend_string_tolower(name);		ce = zend_hash_find_ptr(EG(class_table), lc_name);		zend_string_free(lc_name);	} else { 		ce = zend_lookup_class(name); 	} 	if (ce == NULL) {		php_error_docref(NULL, E_WARNING, "Class %s does not exist%s", ZSTR_VAL(name), autoload ? " and could not be loaded" : "");		return NULL;	}	return ce;}
开发者ID:AllenJB,项目名称:php-src,代码行数:19,


示例17: skyray_http_request_resolve_queries_if_needed

void skyray_http_request_resolve_queries_if_needed(skyray_http_request_t *self){    if (!ZVAL_IS_NULL(&self->query_params) || ZVAL_IS_NULL(&self->uri)) {        return;    }    array_init(&self->query_params);    php_url *url = php_url_parse_ex(Z_STR(self->uri)->val, Z_STR(self->uri)->len);    if (!url->query) {        php_url_free(url);        return;    }    zend_string *query = zend_string_init(url->query, strlen(url->query), 0);    char *res = estrdup(url->query);    sapi_module.treat_data(PARSE_STRING, res, &self->query_params);    zend_string_free(query);    php_url_free(url);}
开发者ID:Lucups,项目名称:Skyray,代码行数:22,


示例18: intl_error_reset

/* {{{ clone handler for TimeZone */static zend_object *TimeZone_clone_obj(zval *object){	TimeZone_object		*to_orig,						*to_new;	zend_object			*ret_val;	intl_error_reset(NULL);	to_orig = Z_INTL_TIMEZONE_P(object);	intl_error_reset(TIMEZONE_ERROR_P(to_orig));	ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object));	to_new  = php_intl_timezone_fetch_object(ret_val);	zend_objects_clone_members(&to_new->zo, &to_orig->zo);	if (to_orig->utimezone != NULL) {		TimeZone	*newTimeZone;		newTimeZone = to_orig->utimezone->clone();		to_new->should_delete = 1;		if (!newTimeZone) {			zend_string *err_msg;			intl_errors_set_code(TIMEZONE_ERROR_P(to_orig),				U_MEMORY_ALLOCATION_ERROR);			intl_errors_set_custom_msg(TIMEZONE_ERROR_P(to_orig),				"Could not clone IntlTimeZone", 0);			err_msg = intl_error_get_message(TIMEZONE_ERROR_P(to_orig));			zend_throw_exception(NULL, err_msg->val, 0);			zend_string_free(err_msg);		} else {			to_new->utimezone = newTimeZone;		}	} else {		zend_throw_exception(NULL, "Cannot clone unconstructed IntlTimeZone", 0);	}	return ret_val;}
开发者ID:Tyrael,项目名称:php-src,代码行数:39,


示例19: intl_error_reset

/* {{{ clone handler for Calendar */static zend_object *Calendar_clone_obj(zval *object){	Calendar_object		*co_orig,						*co_new;	zend_object 	    *ret_val;	intl_error_reset(NULL);	co_orig = Z_INTL_CALENDAR_P(object);	intl_error_reset(INTL_DATA_ERROR_P(co_orig));	ret_val = Calendar_ce_ptr->create_object(Z_OBJCE_P(object));	co_new  = php_intl_calendar_fetch_object(ret_val);	zend_objects_clone_members(&co_new->zo, &co_orig->zo);	if (co_orig->ucal != NULL) {		Calendar	*newCalendar;		newCalendar = co_orig->ucal->clone();		if (!newCalendar) {			zend_string *err_msg;			intl_errors_set_code(CALENDAR_ERROR_P(co_orig),				U_MEMORY_ALLOCATION_ERROR);			intl_errors_set_custom_msg(CALENDAR_ERROR_P(co_orig),				"Could not clone IntlCalendar", 0);			err_msg = intl_error_get_message(CALENDAR_ERROR_P(co_orig));			zend_throw_exception(NULL, err_msg->val, 0);			zend_string_free(err_msg);		} else {			co_new->ucal = newCalendar;		}	} else {		zend_throw_exception(NULL, "Cannot clone unconstructed IntlCalendar", 0);	}	return ret_val;}
开发者ID:0xhacking,项目名称:php-src,代码行数:38,


示例20: intl_convert_utf16_to_utf8

/* {{{ intl_convert_utf16_to_utf8 * Convert given string from UTF-16 to UTF-8. * * @param source      String to convert. * @param source_len  Length of the source string. * @param status      Conversion status. * * @return zend_string */zend_string* intl_convert_utf16_to_utf8(	const UChar* src,    int32_t  src_len,	UErrorCode*  status ){	zend_string* dst;	int32_t      dst_len;	/* Determine required destination buffer size (pre-flighting). */	*status = U_ZERO_ERROR;	u_strToUTF8( NULL, 0, &dst_len, src, src_len, status );	/* Bail out if an unexpected error occurred.	 * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough).	 * (U_STRING_NOT_TERMINATED_WARNING usually means that the input string is empty).	 */	if( *status != U_BUFFER_OVERFLOW_ERROR && *status != U_STRING_NOT_TERMINATED_WARNING )		return NULL;	/* Allocate memory for the destination buffer (it will be zero-terminated). */	dst = zend_string_alloc(dst_len, 0);	/* Convert source string from UTF-8 to UTF-16. */	*status = U_ZERO_ERROR;	u_strToUTF8( ZSTR_VAL(dst), dst_len, NULL, src, src_len, status );	if( U_FAILURE( *status ) )	{		zend_string_free(dst);		return NULL;	}	/* U_STRING_NOT_TERMINATED_WARNING is OK for us => reset 'status'. */	*status = U_ZERO_ERROR;	ZSTR_VAL(dst)[dst_len] = 0;	return dst;}
开发者ID:13572293130,项目名称:php-src,代码行数:45,


示例21: php_mail

/* {{{ php_mail */PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd){#if (defined PHP_WIN32 || defined NETWARE)	int tsm_err;	char *tsm_errmsg = NULL;#endif	FILE *sendmail;	int ret;	char *sendmail_path = INI_STR("sendmail_path");	char *sendmail_cmd = NULL;	char *mail_log = INI_STR("mail.log");	char *hdr = headers;#if PHP_SIGCHILD	void (*sig_handler)() = NULL;#endif#define MAIL_RET(val) /	if (hdr != headers) {	/		efree(hdr);	/	}	/	return val;	/	if (mail_log && *mail_log) {		char *tmp;		time_t curtime;		size_t l;		zend_string *date_str;		time(&curtime);		date_str = php_format_date("d-M-Y H:i:s e", 13, curtime, 1);		l = spprintf(&tmp, 0, "[%s] mail() on [%s:%d]: To: %s -- Headers: %s/n", date_str->val, zend_get_executed_filename(), zend_get_executed_lineno(), to, hdr ? hdr : "");		zend_string_free(date_str);		if (hdr) {			php_mail_log_crlf_to_spaces(tmp);		}		if (!strcmp(mail_log, "syslog")) {			/* Drop the final space when logging to syslog. */			tmp[l - 1] = 0;			php_mail_log_to_syslog(tmp);		}		else {			/* Convert the final space to a newline when logging to file. */			tmp[l - 1] = '/n';			php_mail_log_to_file(mail_log, tmp, l);		}		efree(tmp);	}	if (PG(mail_x_header)) {		const char *tmp = zend_get_executed_filename();		zend_string *f;		f = php_basename(tmp, strlen(tmp), NULL, 0);		if (headers != NULL) {			spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s/n%s", php_getuid(), f->val, headers);		} else {			spprintf(&hdr, 0, "X-PHP-Originating-Script: " ZEND_LONG_FMT ":%s", php_getuid(), f->val);		}		zend_string_release(f);	}	if (!sendmail_path) {#if (defined PHP_WIN32 || defined NETWARE)		/* handle old style win smtp sending */		if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, hdr, subject, to, message, NULL, NULL, NULL) == FAILURE) {			if (tsm_errmsg) {				php_error_docref(NULL, E_WARNING, "%s", tsm_errmsg);				efree(tsm_errmsg);			} else {				php_error_docref(NULL, E_WARNING, "%s", GetSMErrorText(tsm_err));			}			MAIL_RET(0);		}		MAIL_RET(1);#else		MAIL_RET(0);#endif	}	if (extra_cmd != NULL) {		spprintf(&sendmail_cmd, 0, "%s %s", sendmail_path, extra_cmd);	} else {		sendmail_cmd = sendmail_path;	}#if PHP_SIGCHILD	/* Set signal handler of SIGCHLD to default to prevent other signal handlers	 * from being called and reaping the return code when our child exits.	 * The original handler needs to be restored after pclose() */	sig_handler = (void *)signal(SIGCHLD, SIG_DFL);	if (sig_handler == SIG_ERR) {		sig_handler = NULL;	}#endif//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:php-src,代码行数:101,


示例22: zend_string_init

ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, zend_ulong flags){	zend_constant *c;	const char *colon;	zend_class_entry *ce = NULL;	zend_string *class_name;	const char *name = cname->val;	size_t name_len = cname->len;	/* Skip leading // */	if (name[0] == '//') {		name += 1;		name_len -= 1;		cname = NULL;	}	if ((colon = zend_memrchr(name, ':', name_len)) &&	    colon > name && (*(colon - 1) == ':')) {		int class_name_len = colon - name - 1;		size_t const_name_len = name_len - class_name_len - 2;		zend_string *constant_name = zend_string_init(colon + 1, const_name_len, 0);		char *lcname;		zval *ret_constant = NULL;		ALLOCA_FLAG(use_heap)		class_name = zend_string_init(name, class_name_len, 0);		lcname = do_alloca(class_name_len + 1, use_heap);		zend_str_tolower_copy(lcname, name, class_name_len);		if (!scope) {			if (EG(current_execute_data)) {				scope = EG(scope);			} else {				scope = CG(active_class_entry);			}		}		if (class_name_len == sizeof("self")-1 &&		    !memcmp(lcname, "self", sizeof("self")-1)) {			if (UNEXPECTED(!scope)) {				zend_error(E_EXCEPTION | E_ERROR, "Cannot access self:: when no class scope is active");				return NULL;			}			ce = scope;		} else if (class_name_len == sizeof("parent")-1 &&		           !memcmp(lcname, "parent", sizeof("parent")-1)) {			if (UNEXPECTED(!scope)) {				zend_error(E_EXCEPTION | E_ERROR, "Cannot access parent:: when no class scope is active");				return NULL;			} else if (UNEXPECTED(!scope->parent)) {				zend_error(E_EXCEPTION | E_ERROR, "Cannot access parent:: when current class scope has no parent");				return NULL;			} else {				ce = scope->parent;			}		} else if (class_name_len == sizeof("static")-1 &&		           !memcmp(lcname, "static", sizeof("static")-1)) {			ce = zend_get_called_scope(EG(current_execute_data));			if (UNEXPECTED(!ce)) {				zend_error(E_EXCEPTION | E_ERROR, "Cannot access static:: when no class scope is active");				return NULL;			}		} else {			ce = zend_fetch_class(class_name, flags);		}		free_alloca(lcname, use_heap);		if (ce) {			ret_constant = zend_hash_find(&ce->constants_table, constant_name);			if (ret_constant == NULL) {				if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {					zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s::%s'", class_name->val, constant_name->val);					zend_string_release(class_name);					zend_string_free(constant_name);					return NULL;				}			} else if (Z_ISREF_P(ret_constant)) {				ret_constant = Z_REFVAL_P(ret_constant);			}		}		zend_string_release(class_name);		zend_string_free(constant_name);		if (ret_constant && Z_CONSTANT_P(ret_constant)) {			if (UNEXPECTED(zval_update_constant_ex(ret_constant, 1, ce) != SUCCESS)) {				return NULL;			}		}		return ret_constant;	}	/* non-class constant */	if ((colon = zend_memrchr(name, '//', name_len)) != NULL) {		/* compound constant name */		int prefix_len = colon - name;		size_t const_name_len = name_len - prefix_len - 1;		const char *constant_name = colon + 1;		char *lcname;		size_t lcname_len;		ALLOCA_FLAG(use_heap)		lcname_len = prefix_len + 1 + const_name_len;		lcname = do_alloca(lcname_len + 1, use_heap);//.........这里部分代码省略.........
开发者ID:0xhacking,项目名称:php-src,代码行数:101,


示例23: PostHeader

/*********************************************************************// Name:  PostHeader// Input:       1) return path//              2) Subject//              3) destination address//              4) headers// Output:      Error code or Success// Description:// Author/Date:  jcar 20/9/96// History://********************************************************************/static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders){	/* Print message header according to RFC 822 */	/* Return-path, Received, Date, From, Subject, Sender, To, cc */	int res;	char *header_buffer;	char *headers_lc = NULL;	size_t i;	if (xheaders) {		size_t headers_lc_len;		headers_lc = estrdup(xheaders);		headers_lc_len = strlen(headers_lc);		for (i = 0; i < headers_lc_len; i++) {			headers_lc[i] = tolower(headers_lc[i]);		}	}	header_buffer = ecalloc(1, MAIL_BUFFER_SIZE);	if (!xheaders || !strstr(headers_lc, "date:")) {		time_t tNow = time(NULL);		zend_string *dt = php_format_date("r", 1, tNow, 1);		snprintf(header_buffer, MAIL_BUFFER_SIZE, "Date: %s/r/n", ZSTR_VAL(dt));		zend_string_free(dt);	}	if (!headers_lc || !strstr(headers_lc, "from:")) {		if (!addToHeader(&header_buffer, "From: %s/r/n", RPath)) {			goto PostHeader_outofmem;		}	}	if (!addToHeader(&header_buffer, "Subject: %s/r/n", Subject)) {		goto PostHeader_outofmem;	}	/* Only add the To: field from the $to parameter if isn't in the custom headers */	if ((headers_lc && (!strstr(headers_lc, "/r/nto:") && (strncmp(headers_lc, "to:", 3) != 0))) || !headers_lc) {		if (!addToHeader(&header_buffer, "To: %s/r/n", mailTo)) {			goto PostHeader_outofmem;		}	}	if (xheaders) {		if (!addToHeader(&header_buffer, "%s/r/n", xheaders)) {			goto PostHeader_outofmem;		}	}	if (headers_lc) {		efree(headers_lc);	}	if ((res = Post(header_buffer)) != SUCCESS) {		efree(header_buffer);		return (res);	}	efree(header_buffer);	if ((res = Post("/r/n")) != SUCCESS) {		return (res);	}	return (SUCCESS);PostHeader_outofmem:	if (headers_lc) {		efree(headers_lc);	}	return OUT_OF_MEMORY;}
开发者ID:AxiosCros,项目名称:php-src,代码行数:84,


示例24: SendText

//.........这里部分代码省略.........				}				token = strtok(NULL, ",");			}			efree(tempMailTo);			/* Now that we've identified that we've a Bcc list,			   remove it from the current header. */			stripped_header = ecalloc(1, strlen(headers));			/* headers = point to string start of header			   pos1    = pointer IN headers where the Bcc starts			   '4'     = Length of the characters 'bcc:'			   Because we've added +4 above for parsing the Emails			   we've to subtract them here. */			memcpy(stripped_header, headers, pos1 - headers - 4);			if (pos1 != pos2) {				/* if pos1 != pos2 , pos2 points to the rest of the headers.				   Since pos1 != pos2 if "/r/n" was found, we know those characters				   are there and so we jump over them (else we would generate a new header				   which would look like "/r/n/r/n". */				memcpy(stripped_header + (pos1 - headers - 4), pos2 + 2, strlen(pos2) - 2);			}		}	}	/* Simplify the code that we create a copy of stripped_header no matter if	   we actually strip something or not. So we've a single efree() later. */	if (headers && !stripped_header) {		stripped_header = estrndup(headers, strlen(headers));	}	if ((res = Post("DATA/r/n")) != SUCCESS) {		if (stripped_header) {			efree(stripped_header);		}		return (res);	}	if ((res = Ack(&server_response)) != SUCCESS) {		SMTP_ERROR_RESPONSE(server_response);		if (stripped_header) {			efree(stripped_header);		}		return (res);	}	/* send message header */	if (Subject == NULL) {		res = PostHeader(RPath, "No Subject", mailTo, stripped_header);	} else {		res = PostHeader(RPath, Subject, mailTo, stripped_header);	}	if (stripped_header) {		efree(stripped_header);	}	if (res != SUCCESS) {		return (res);	}	/* Escape /n. sequences	 * We use php_str_to_str() and not php_str_replace_in_subject(), since the latter	 * uses ZVAL as it's parameters */	data_cln = php_str_to_str(data, strlen(data), PHP_WIN32_MAIL_DOT_PATTERN, sizeof(PHP_WIN32_MAIL_DOT_PATTERN) - 1,					PHP_WIN32_MAIL_DOT_REPLACE, sizeof(PHP_WIN32_MAIL_DOT_REPLACE) - 1);	if (!data_cln) {		data_cln = ZSTR_EMPTY_ALLOC();	}	/* send message contents in 1024 chunks */	{		char c, *e2, *e = ZSTR_VAL(data_cln) + ZSTR_LEN(data_cln);		p = ZSTR_VAL(data_cln);		while (e - p > 1024) {			e2 = p + 1024;			c = *e2;			*e2 = '/0';			if ((res = Post(p)) != SUCCESS) {				zend_string_free(data_cln);				return(res);			}			*e2 = c;			p = e2;		}		if ((res = Post(p)) != SUCCESS) {			zend_string_free(data_cln);			return(res);		}	}	zend_string_free(data_cln);	/*send termination dot */	if ((res = Post("/r/n./r/n")) != SUCCESS)		return (res);	if ((res = Ack(&server_response)) != SUCCESS) {		SMTP_ERROR_RESPONSE(server_response);		return (res);	}	return (SUCCESS);}
开发者ID:AxiosCros,项目名称:php-src,代码行数:101,


示例25: TSendMail

/*********************************************************************// Name:  TSendMail// Input:   1) host:    Name of the mail host where the SMTP server resides//                      max accepted length of name = 256//          2) appname: Name of the application to use in the X-mailer//                      field of the message. if NULL is given the application//                      name is used as given by the GetCommandLine() function//                      max accespted length of name = 100// Output:  1) error:   Returns the error code if something went wrong or//                      SUCCESS otherwise.////  See SendText() for additional args!//********************************************************************/PHPAPI int TSendMail(char *host, int *error, char **error_message,			  char *headers, char *Subject, char *mailTo, char *data,			  char *mailCc, char *mailBcc, char *mailRPath){	int ret;	char *RPath = NULL;	zend_string *headers_lc = NULL, *headers_trim = NULL; /* headers_lc is only created if we've a header at all */	char *pos1 = NULL, *pos2 = NULL;	if (host == NULL) {		*error = BAD_MAIL_HOST;		return FAILURE;	} else if (strlen(host) >= HOST_NAME_LEN) {		*error = BAD_MAIL_HOST;		return FAILURE;	} else {		strcpy(PW32G(mail_host), host);	}	if (headers) {		char *pos = NULL;		/* Use PCRE to trim the header into the right format */		if (NULL == (headers_trim = php_win32_mail_trim_header(headers))) {			*error = W32_SM_PCRE_ERROR;			return FAILURE;		}		/* Create a lowercased header for all the searches so we're finally case		 * insensitive when searching for a pattern. */		headers_lc = zend_string_tolower(headers_trim);	}	/* Fall back to sendmail_from php.ini setting */	if (mailRPath && *mailRPath) {		RPath = estrdup(mailRPath);	} else if (INI_STR("sendmail_from")) {		RPath = estrdup(INI_STR("sendmail_from"));	} else if (headers_lc) {		int found = 0;		char *lookup = ZSTR_VAL(headers_lc);		while (lookup) {			pos1 = strstr(lookup, "from:");			if (!pos1) {				break;			} else if (pos1 != ZSTR_VAL(headers_lc) && *(pos1-1) != '/n') {				if (strlen(pos1) >= sizeof("from:")) {					lookup = pos1 + sizeof("from:");					continue;				} else {					break;				}			}			found = 1;			/* Real offset is memaddress from the original headers + difference of			 * string found in the lowercase headrs + 5 characters to jump over			 * the from: */			pos1 = headers + (pos1 - lookup) + 5;			if (NULL == (pos2 = strstr(pos1, "/r/n"))) {				RPath = estrndup(pos1, strlen(pos1));			} else {				RPath = estrndup(pos1, pos2 - pos1);			}			break;		}		if (!found) {			if (headers_lc) {				zend_string_free(headers_lc);			}			*error = W32_SM_SENDMAIL_FROM_NOT_SET;			return FAILURE;		}	}	/* attempt to connect with mail host */	*error = MailConnect();	if (*error != 0) {		if (RPath) {			efree(RPath);		}		if (headers) {//.........这里部分代码省略.........
开发者ID:AxiosCros,项目名称:php-src,代码行数:101,


示例26: ZSTR_VAL

ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, uint32_t flags){	zend_constant *c;	const char *colon;	zend_class_entry *ce = NULL;	const char *name = ZSTR_VAL(cname);	size_t name_len = ZSTR_LEN(cname);	/* Skip leading // */	if (name[0] == '//') {		name += 1;		name_len -= 1;		cname = NULL;	}	if ((colon = zend_memrchr(name, ':', name_len)) &&	    colon > name && (*(colon - 1) == ':')) {		int class_name_len = colon - name - 1;		size_t const_name_len = name_len - class_name_len - 2;		zend_string *constant_name = zend_string_init(colon + 1, const_name_len, 0);		zend_string *class_name = zend_string_init(name, class_name_len, 0);		zval *ret_constant = NULL;		if (zend_string_equals_literal_ci(class_name, "self")) {			if (UNEXPECTED(!scope)) {				zend_throw_error(NULL, "Cannot access self:: when no class scope is active");				goto failure;			}			ce = scope;		} else if (zend_string_equals_literal_ci(class_name, "parent")) {			if (UNEXPECTED(!scope)) {				zend_throw_error(NULL, "Cannot access parent:: when no class scope is active");				goto failure;			} else if (UNEXPECTED(!scope->parent)) {				zend_throw_error(NULL, "Cannot access parent:: when current class scope has no parent");				goto failure;			} else {				ce = scope->parent;			}		} else if (zend_string_equals_literal_ci(class_name, "static")) {			ce = zend_get_called_scope(EG(current_execute_data));			if (UNEXPECTED(!ce)) {				zend_throw_error(NULL, "Cannot access static:: when no class scope is active");				goto failure;			}		} else {			ce = zend_fetch_class(class_name, flags);		}		if (ce) {			zend_class_constant *c = zend_hash_find_ptr(&ce->constants_table, constant_name);			if (c == NULL) {				if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {					zend_throw_error(NULL, "Undefined class constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));					goto failure;				}				ret_constant = NULL;			} else {				if (!zend_verify_const_access(c, scope)) {					zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));					goto failure;				}				ret_constant = &c->value;			}		}		if (ret_constant && Z_CONSTANT_P(ret_constant)) {			if (Z_TYPE_P(ret_constant) == IS_CONSTANT_AST) {				if (IS_CONSTANT_VISITED(ret_constant)) {					zend_throw_error(NULL, "Cannot declare self-referencing constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name));					ret_constant = NULL;					goto failure;				}				MARK_CONSTANT_VISITED(ret_constant);			}			if (UNEXPECTED(zval_update_constant_ex(ret_constant, ce) != SUCCESS)) {				RESET_CONSTANT_VISITED(ret_constant);				ret_constant = NULL;				goto failure;			}			RESET_CONSTANT_VISITED(ret_constant);		}failure:		zend_string_release(class_name);		zend_string_free(constant_name);		return ret_constant;	}	/* non-class constant */	if ((colon = zend_memrchr(name, '//', name_len)) != NULL) {		/* compound constant name */		int prefix_len = colon - name;		size_t const_name_len = name_len - prefix_len - 1;		const char *constant_name = colon + 1;		char *lcname;		size_t lcname_len;		ALLOCA_FLAG(use_heap)		lcname_len = prefix_len + 1 + const_name_len;		lcname = do_alloca(lcname_len + 1, use_heap);		zend_str_tolower_copy(lcname, name, prefix_len);//.........这里部分代码省略.........
开发者ID:ChadSikorra,项目名称:php-src,代码行数:101,


示例27: zephir_is_callable_check_class

static int zephir_is_callable_check_class(const char *name, int name_len, zend_fcall_info_cache *fcc, int *strict_class, char **error) /* {{{ */{	int ret = 0;	zend_class_entry *pce;	char *lcname = zend_str_tolower_dup(name, name_len);	*strict_class = 0;	if (name_len == sizeof("self") - 1 &&		!memcmp(lcname, "self", sizeof("self") - 1)) {		if (!EG(scope)) {			if (error) *error = estrdup("cannot access self:: when no class scope is active");		} else {			fcc->called_scope = EG(current_execute_data)->called_scope;			if (!fcc->object) {				fcc->object = Z_OBJ(EG(current_execute_data)->This);			}			ret = 1;		}	} else if (name_len == sizeof("parent") - 1 &&			   !memcmp(lcname, "parent", sizeof("parent") - 1)) {		if (!EG(scope)) {			if (error) *error = estrdup("cannot access parent:: when no class scope is active");		} else if (!EG(scope)->parent) {			if (error) *error = estrdup("cannot access parent:: when current class scope has no parent");		} else {			fcc->called_scope = EG(current_execute_data)->called_scope;			if (!fcc->object) {				fcc->object = Z_OBJ(EG(current_execute_data)->This);			}			*strict_class = 1;			ret = 1;		}	} else if (name_len == sizeof("static") - 1 &&			   !memcmp(lcname, "static", sizeof("static") - 1)) {		if (!EG(current_execute_data)->called_scope) {			if (error) *error = estrdup("cannot access static:: when no class scope is active");		} else {			fcc->called_scope = EG(current_execute_data)->called_scope;			if (!fcc->object) {				fcc->object = Z_OBJ(EG(current_execute_data)->This);			}			*strict_class = 1;			ret = 1;		}	} else {		zend_string *class_name;		class_name = zend_string_init(name, name_len, 0);		if ((pce = zend_lookup_class_ex(class_name, NULL, 1)) != NULL) {			zend_class_entry *scope = EG(current_execute_data) ? EG(current_execute_data)->func->common.scope : NULL;			fcc->calling_scope = pce;			if (scope && !fcc->object && EG(current_execute_data) && Z_OBJ(EG(current_execute_data)->This) &&				instanceof_function(Z_OBJCE(EG(current_execute_data)->This), scope TSRMLS_CC) &&				instanceof_function(scope, fcc->calling_scope TSRMLS_CC)) {				fcc->object = Z_OBJ(EG(current_execute_data)->This);				fcc->called_scope = fcc->object->ce;			} else {				fcc->called_scope = fcc->object ? fcc->object->ce : fcc->calling_scope;			}			*strict_class = 1;			ret = 1;		} else {			if (error) zephir_spprintf(error, 0, "class '%.*s' not found", name_len, name);		}		zend_string_free(class_name);	}	efree(lcname);	return ret;}
开发者ID:Mrhjx2,项目名称:zephir,代码行数:68,


示例28: php_url_encode_hash_ex

/* {{{ php_url_encode_hash */PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,				const char *num_prefix, size_t num_prefix_len,				const char *key_prefix, size_t key_prefix_len,				const char *key_suffix, size_t key_suffix_len,			  zval *type, char *arg_sep, int enc_type){	zend_string *key = NULL;	char *newprefix, *p;	const char *prop_name;	size_t arg_sep_len, newprefix_len, prop_len;	zend_ulong idx;	zval *zdata = NULL;	if (!ht) {		return FAILURE;	}	if (GC_IS_RECURSIVE(ht)) {		/* Prevent recursion */		return SUCCESS;	}	if (!arg_sep) {		arg_sep = INI_STR("arg_separator.output");		if (!arg_sep || !strlen(arg_sep)) {			arg_sep = URL_DEFAULT_ARG_SEP;		}	}	arg_sep_len = strlen(arg_sep);	ZEND_HASH_FOREACH_KEY_VAL(ht, idx, key, zdata) {		zend_bool is_dynamic = 1;		if (Z_TYPE_P(zdata) == IS_INDIRECT) {			zdata = Z_INDIRECT_P(zdata);			if (Z_ISUNDEF_P(zdata)) {				continue;			}			is_dynamic = 0;		}		/* handling for private & protected object properties */		if (key) {			prop_name = ZSTR_VAL(key);			prop_len = ZSTR_LEN(key);			if (type != NULL && zend_check_property_access(Z_OBJ_P(type), key, is_dynamic) != SUCCESS) {				/* property not visible in this scope */				continue;			}			if (ZSTR_VAL(key)[0] == '/0' && type != NULL) {				const char *tmp;				zend_unmangle_property_name_ex(key, &tmp, &prop_name, &prop_len);			} else {				prop_name = ZSTR_VAL(key);				prop_len = ZSTR_LEN(key);			}		} else {			prop_name = NULL;			prop_len = 0;		}		ZVAL_DEREF(zdata);		if (Z_TYPE_P(zdata) == IS_ARRAY || Z_TYPE_P(zdata) == IS_OBJECT) {			if (key) {				zend_string *ekey;				if (enc_type == PHP_QUERY_RFC3986) {					ekey = php_raw_url_encode(prop_name, prop_len);				} else {					ekey = php_url_encode(prop_name, prop_len);				}				newprefix_len = key_suffix_len + ZSTR_LEN(ekey) + key_prefix_len + 3 /* %5B */;				newprefix = emalloc(newprefix_len + 1);				p = newprefix;				if (key_prefix) {					memcpy(p, key_prefix, key_prefix_len);					p += key_prefix_len;				}				memcpy(p, ZSTR_VAL(ekey), ZSTR_LEN(ekey));				p += ZSTR_LEN(ekey);				zend_string_free(ekey);				if (key_suffix) {					memcpy(p, key_suffix, key_suffix_len);					p += key_suffix_len;				}				*(p++) = '%';				*(p++) = '5';				*(p++) = 'B';				*p = '/0';			} else {				char *ekey;				size_t ekey_len;				/* Is an integer key */				ekey_len = spprintf(&ekey, 0, ZEND_LONG_FMT, idx);				newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 3 /* %5B */;//.........这里部分代码省略.........
开发者ID:IMSoP,项目名称:php-src,代码行数:101,


示例29: php_var_unserialize_ex

//.........这里部分代码省略.........	if (yych <= '9') goto yy41;	goto yy18;yy40:	yych = *++YYCURSOR;	if (yych <= '/') goto yy18;	if (yych >= ':') goto yy18;yy41:	++YYCURSOR;	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);	yych = *YYCURSOR;	if (yych <= '/') goto yy18;	if (yych <= '9') goto yy41;	if (yych >= ';') goto yy18;	yych = *++YYCURSOR;	if (yych != '"') goto yy18;	++YYCURSOR;#line 663 "ext/standard/var_unserializer.re"	{	size_t len, maxlen;	zend_string *str;	len = parse_uiv(start + 2);	maxlen = max - YYCURSOR;	if (maxlen < len) {		*p = start + 2;		return 0;	}	if ((str = unserialize_str(&YYCURSOR, len, maxlen)) == NULL) {		return 0;	}	if (*(YYCURSOR) != '"') {		zend_string_free(str);		*p = YYCURSOR;		return 0;	}	YYCURSOR += 2;	*p = YYCURSOR;	ZVAL_STR(rval, str);	return 1;}#line 931 "ext/standard/var_unserializer.c"yy46:	yych = *++YYCURSOR;	if (yych == '+') goto yy47;	if (yych <= '/') goto yy18;	if (yych <= '9') goto yy48;	goto yy18;yy47:	yych = *++YYCURSOR;	if (yych <= '/') goto yy18;	if (yych >= ':') goto yy18;yy48:	++YYCURSOR;	if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);	yych = *YYCURSOR;	if (yych <= '/') goto yy18;	if (yych <= '9') goto yy48;	if (yych >= ';') goto yy18;	yych = *++YYCURSOR;	if (yych != '"') goto yy18;	++YYCURSOR;#line 636 "ext/standard/var_unserializer.re"
开发者ID:Freeaqingme,项目名称:php-src,代码行数:67,


示例30: fpm_status_handle_request

//.........这里部分代码省略.........		zend_string_release(_GET_str);		if (short_post) {			PUTS(short_post);		}		/* no need to test the var 'full' */		if (full_syntax) {			unsigned int i;			int first;			zend_string *tmp_query_string;			char *query_string;			struct timeval duration, now;#ifdef HAVE_FPM_LQ			float cpu;#endif			fpm_clock_get(&now);			if (full_pre) {				PUTS(full_pre);			}			first = 1;			for (i=0; i<scoreboard_p->nprocs; i++) {				if (!scoreboard_p->procs[i] || !scoreboard_p->procs[i]->used) {					continue;				}				proc = *scoreboard_p->procs[i];				if (first) {					first = 0;				} else {					if (full_separator) {						PUTS(full_separator);					}				}				query_string = NULL;				tmp_query_string = NULL;				if (proc.query_string[0] != '/0') {					if (!encode) {						query_string = proc.query_string;					} else {						tmp_query_string = php_escape_html_entities_ex((unsigned char *)proc.query_string, strlen(proc.query_string), 1, ENT_HTML_IGNORE_ERRORS & ENT_COMPAT, NULL, 1);						query_string = ZSTR_VAL(tmp_query_string);					}				}#ifdef HAVE_FPM_LQ				/* prevent NaN */				if (proc.cpu_duration.tv_sec == 0 && proc.cpu_duration.tv_usec == 0) {					cpu = 0.;				} else {					cpu = (proc.last_request_cpu.tms_utime + proc.last_request_cpu.tms_stime + proc.last_request_cpu.tms_cutime + proc.last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() / (proc.cpu_duration.tv_sec + proc.cpu_duration.tv_usec / 1000000.) * 100.;				}#endif				if (proc.request_stage == FPM_REQUEST_ACCEPTING) {					duration = proc.duration;				} else {					timersub(&now, &proc.accepted, &duration);				}				strftime(time_buffer, sizeof(time_buffer) - 1, time_format, localtime(&proc.start_epoch));				spprintf(&buffer, 0, full_syntax,					proc.pid,					fpm_request_get_stage_name(proc.request_stage),					time_buffer,					now_epoch - proc.start_epoch,					proc.requests,					duration.tv_sec * 1000000UL + duration.tv_usec,					proc.request_method[0] != '/0' ? proc.request_method : "-",					proc.request_uri[0] != '/0' ? proc.request_uri : "-",					query_string ? "?" : "",					query_string ? query_string : "",					proc.content_length,					proc.auth_user[0] != '/0' ? proc.auth_user : "-",					proc.script_filename[0] != '/0' ? proc.script_filename : "-",#ifdef HAVE_FPM_LQ					proc.request_stage == FPM_REQUEST_ACCEPTING ? cpu : 0.,#endif					proc.request_stage == FPM_REQUEST_ACCEPTING ? proc.memory : 0);				PUTS(buffer);				efree(buffer);				if (tmp_query_string) {					zend_string_free(tmp_query_string);				}			}			if (full_post) {				PUTS(full_post);			}		}		return 1;	}	return 0;}
开发者ID:20uf,项目名称:php-src,代码行数:101,



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


C++ zend_string_init函数代码示例
C++ zend_string_alloc函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。