当前位置: 首页>>代码示例>>C++>>正文


C++ zend_make_printable_zval函数代码示例

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


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

示例1: zephir_concat_svsvs

void zephir_concat_svsvs(zval **result, const char *op1, zend_uint op1_len, zval *op2, const char *op3, zend_uint op3_len, zval *op4, const char *op5, zend_uint op5_len, int self_var TSRMLS_DC) {

    zval result_copy, op2_copy, op4_copy;
    int use_copy = 0, use_copy2 = 0, use_copy4 = 0;
    uint offset = 0, length;

    if (Z_TYPE_P(op2) != IS_STRING) {
        zend_make_printable_zval(op2, &op2_copy, &use_copy2);
        if (use_copy2) {
            op2 = &op2_copy;
        }
    }

    if (Z_TYPE_P(op4) != IS_STRING) {
        zend_make_printable_zval(op4, &op4_copy, &use_copy4);
        if (use_copy4) {
            op4 = &op4_copy;
        }
    }

    length = op1_len + Z_STRLEN_P(op2) + op3_len + Z_STRLEN_P(op4) + op5_len;
    if (self_var) {

        if (Z_TYPE_PP(result) != IS_STRING) {
            zend_make_printable_zval(*result, &result_copy, &use_copy);
            if (use_copy) {
                ZEPHIR_CPY_WRT_CTOR(*result, (&result_copy));
            }
        }

        offset = Z_STRLEN_PP(result);
        length += offset;
        Z_STRVAL_PP(result) = (char *) str_erealloc(Z_STRVAL_PP(result), length + 1);

    } else {
        Z_STRVAL_PP(result) = (char *) emalloc(length + 1);
    }

    memcpy(Z_STRVAL_PP(result) + offset, op1, op1_len);
    memcpy(Z_STRVAL_PP(result) + offset + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
    memcpy(Z_STRVAL_PP(result) + offset + op1_len + Z_STRLEN_P(op2), op3, op3_len);
    memcpy(Z_STRVAL_PP(result) + offset + op1_len + Z_STRLEN_P(op2) + op3_len, Z_STRVAL_P(op4), Z_STRLEN_P(op4));
    memcpy(Z_STRVAL_PP(result) + offset + op1_len + Z_STRLEN_P(op2) + op3_len + Z_STRLEN_P(op4), op5, op5_len);
    Z_STRVAL_PP(result)[length] = 0;
    Z_TYPE_PP(result) = IS_STRING;
    Z_STRLEN_PP(result) = length;

    if (use_copy2) {
        zval_dtor(op2);
    }

    if (use_copy4) {
        zval_dtor(op4);
    }

    if (use_copy) {
        zval_dtor(&result_copy);
    }

}
开发者ID:noikiy,项目名称:zend,代码行数:60,代码来源:concat.c

示例2: string_compare_function_ex

ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC) /* {{{ */
{
  zval op1_copy, op2_copy;
  int use_copy1 = 0, use_copy2 = 0;

  if (Z_TYPE_P(op1) != IS_STRING) {
    zend_make_printable_zval(op1, &op1_copy, &use_copy1);
  }
  if (Z_TYPE_P(op2) != IS_STRING) {
    zend_make_printable_zval(op2, &op2_copy, &use_copy2);
  }

  if (use_copy1) {
    op1 = &op1_copy;
  }
  if (use_copy2) {
    op2 = &op2_copy;
  }

  if (case_insensitive) {
    ZVAL_LONG(result, zend_binary_zval_strcasecmp(op1, op2));
  } else {
    ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2));
  }

  if (use_copy1) {
    zval_dtor(op1);
  }
  if (use_copy2) {
    zval_dtor(op2);
  }
  return SUCCESS;
}
开发者ID:MaimaiCoder,项目名称:hhvm,代码行数:33,代码来源:zend_operators.cpp

示例3: zephir_concat_vsvs

void zephir_concat_vsvs(zval **result, zval *op1, const char *op2, zend_uint op2_len, zval *op3, const char *op4, zend_uint op4_len, int self_var TSRMLS_DC){

	zval result_copy, op1_copy, op3_copy;
	int use_copy = 0, use_copy1 = 0, use_copy3 = 0;
	uint offset = 0, length;

	if (Z_TYPE_P(op1) != IS_STRING) {
	   zend_make_printable_zval(op1, &op1_copy, &use_copy1);
	   if (use_copy1) {
	       op1 = &op1_copy;
	   }
	}

	if (Z_TYPE_P(op3) != IS_STRING) {
	   zend_make_printable_zval(op3, &op3_copy, &use_copy3);
	   if (use_copy3) {
	       op3 = &op3_copy;
	   }
	}

	length = Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3) + op4_len;
	if (self_var) {

		if (Z_TYPE_PP(result) != IS_STRING) {
			zend_make_printable_zval(*result, &result_copy, &use_copy);
			if (use_copy) {
				ZEPHIR_CPY_WRT_CTOR(*result, (&result_copy));
			}
		}

		offset = Z_STRLEN_PP(result);
		length += offset;
		Z_STRVAL_PP(result) = (char *) str_erealloc(Z_STRVAL_PP(result), length + 1);

	} else {
		Z_STRVAL_PP(result) = (char *) emalloc(length + 1);
	}

	memcpy(Z_STRVAL_PP(result) + offset, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
	memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1), op2, op2_len);
	memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + op2_len, Z_STRVAL_P(op3), Z_STRLEN_P(op3));
	memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3), op4, op4_len);
	Z_STRVAL_PP(result)[length] = 0;
	Z_TYPE_PP(result) = IS_STRING;
	Z_STRLEN_PP(result) = length;

	if (use_copy1) {
	   zval_dtor(op1);
	}

	if (use_copy3) {
	   zval_dtor(op3);
	}

	if (use_copy) {
	   zval_dtor(&result_copy);
	}

}
开发者ID:noikiy,项目名称:php-oauth2-server,代码行数:59,代码来源:concat.c

示例4: zephir_concat_vv

void zephir_concat_vv(zval **result, zval *op1, zval *op2, int self_var TSRMLS_DC){

	zval result_copy, op1_copy, op2_copy;
	int use_copy = 0, use_copy1 = 0, use_copy2 = 0;
	uint offset = 0, length;

	if (Z_TYPE_P(op1) != IS_STRING) {
	   zend_make_printable_zval(op1, &op1_copy, &use_copy1);
	   if (use_copy1) {
	       op1 = &op1_copy;
	   }
	}

	if (Z_TYPE_P(op2) != IS_STRING) {
	   zend_make_printable_zval(op2, &op2_copy, &use_copy2);
	   if (use_copy2) {
	       op2 = &op2_copy;
	   }
	}

	length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
	if (self_var) {

		if (Z_TYPE_PP(result) != IS_STRING) {
			zend_make_printable_zval(*result, &result_copy, &use_copy);
			if (use_copy) {
				ZEPHIR_CPY_WRT_CTOR(*result, (&result_copy));
			}
		}

		offset = Z_STRLEN_PP(result);
		length += offset;
		Z_STRVAL_PP(result) = (char *) erealloc(Z_STRVAL_PP(result), length + 1);

	} else {
		Z_STRVAL_PP(result) = (char *) emalloc(length + 1);
	}

	memcpy(Z_STRVAL_PP(result) + offset, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
	memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
	Z_STRVAL_PP(result)[length] = 0;
	Z_TYPE_PP(result) = IS_STRING;
	Z_STRLEN_PP(result) = length;

	if (use_copy1) {
	   zval_dtor(op1);
	}

	if (use_copy2) {
	   zval_dtor(op2);
	}

	if (use_copy) {
	   zval_dtor(&result_copy);
	}

}
开发者ID:duythien,项目名称:zephir-example,代码行数:57,代码来源:concat.c

示例5: phalcon_make_printable_zval

void phalcon_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy){
	zend_make_printable_zval(expr, expr_copy, use_copy);
	if (use_copy) {
		Z_SET_REFCOUNT_P(expr_copy, 1);
		Z_UNSET_ISREF_P(expr_copy);
	}
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:7,代码来源:operators.c

示例6: zephir_concat_ss

void zephir_concat_ss(zval **result, const char *op1, zend_uint op1_len, const char *op2, zend_uint op2_len, int self_var TSRMLS_DC){

	zval result_copy;
	int use_copy = 0;
	uint offset = 0, length;

	length = op1_len + op2_len;
	if (self_var) {

		if (Z_TYPE_PP(result) != IS_STRING) {
			zend_make_printable_zval(*result, &result_copy, &use_copy);
			if (use_copy) {
				ZEPHIR_CPY_WRT_CTOR(*result, (&result_copy));
			}
		}

		offset = Z_STRLEN_PP(result);
		length += offset;
		Z_STRVAL_PP(result) = (char *) str_erealloc(Z_STRVAL_PP(result), length + 1);

	} else {
		Z_STRVAL_PP(result) = (char *) emalloc(length + 1);
	}

	memcpy(Z_STRVAL_PP(result) + offset, op1, op1_len);
	memcpy(Z_STRVAL_PP(result) + offset + op1_len, op2, op2_len);
	Z_STRVAL_PP(result)[length] = 0;
	Z_TYPE_PP(result) = IS_STRING;
	Z_STRLEN_PP(result) = length;

	if (use_copy) {
	   zval_dtor(&result_copy);
	}

}
开发者ID:noikiy,项目名称:php-oauth2-server,代码行数:35,代码来源:concat.c

示例7: phalcon_raw_url_encode

void phalcon_raw_url_encode(zval *return_value, zval *url) {

	zval copy;
	char *escaped;
	int use_copy = 0, length;

	if (Z_TYPE_P(url) == IS_STRING) {
		zend_make_printable_zval(url, &copy, &use_copy);
		if (use_copy) {
			url = ©
		}
	}

	escaped = php_raw_url_encode(Z_STRVAL_P(url), Z_STRLEN_P(url), &length);

	if (use_copy) {
		zval_dtor(url);
	}

	if (escaped) {
		RETURN_STRINGL(escaped, length, 0);
	} else {
		RETURN_NULL();
	}
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:25,代码来源:url.c

示例8: PHP_METHOD

/**
 * Sends the headers to the client
 *
 * @return boolean
 */
PHP_METHOD(Phalcon_Http_Response_Headers, send){

	zval *headers, *value = NULL, *header = NULL;
	zval *http_header = NULL;
	zval copy;
	int use_copy;
	HashTable *ah0;
	HashPosition hp0;
	zval **hd;
	sapi_header_line ctr = { NULL, 0, 0 };

	PHALCON_MM_GROW();

	if (!SG(headers_sent)) {
	
		PHALCON_OBS_VAR(headers);
		phalcon_read_property_this(&headers, this_ptr, SL("_headers"), PH_NOISY_CC);
	
		phalcon_is_iterable(headers, &ah0, &hp0, 0, 0);
	
		while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
	
			PHALCON_GET_HKEY(header, ah0, hp0);
			PHALCON_GET_HVALUE(value);

			if (PHALCON_IS_NOT_EMPTY(value)) {
				PHALCON_INIT_NVAR(http_header);
				PHALCON_CONCAT_VSV(http_header, header, ": ", value);
				ctr.line     = Z_STRVAL_P(http_header);
				ctr.line_len = Z_STRLEN_P(http_header);
				sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
			} else {
				zend_make_printable_zval(header, &copy, &use_copy);
				if (unlikely(use_copy)) {
					header = ©
				}

				ctr.line     = Z_STRVAL_P(header);
				ctr.line_len = Z_STRLEN_P(header);
				sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);

				if (unlikely(use_copy)) {
					zval_dtor(&copy);
				}
			}

			zend_hash_move_forward_ex(ah0, &hp0);
		}
	
		RETURN_MM_TRUE;
	}
	
	RETURN_MM_FALSE;
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:59,代码来源:headers.c

示例9: zephir_fast_strlen

/**
 * Fast call to php strlen
 */
void zephir_fast_strlen(zval *return_value, zval *str){

	zval copy;
	int use_copy = 0;

	if (Z_TYPE_P(str) != IS_STRING) {
		zend_make_printable_zval(str, &copy, &use_copy);
		if (use_copy) {
			str = ©
		}
	}

	ZVAL_LONG(return_value, Z_STRLEN_P(str));

	if (use_copy) {
		zval_dtor(str);
	}
}
开发者ID:darkgaro,项目名称:zephir,代码行数:21,代码来源:string.c

示例10: zephir_fast_strlen_ev

/**
 * Fast call to php strlen
 */
int zephir_fast_strlen_ev(zval *str){

	zval copy;
	int use_copy = 0, length;

	if (Z_TYPE_P(str) != IS_STRING) {
		zend_make_printable_zval(str, &copy, &use_copy);
		if (use_copy) {
			str = ©
		}
	}

	length = Z_STRLEN_P(str);
	if (use_copy) {
		zval_dtor(str);
	}

	return length;
}
开发者ID:darkgaro,项目名称:zephir,代码行数:22,代码来源:string.c

示例11: protobuf_convert_to_string

bool protobuf_convert_to_string(zval* from) {
  switch (Z_TYPE_P(from)) {
    case IS_STRING: {
      return true;
    }
    case IS_BOOL:
    case IS_LONG:
    case IS_DOUBLE: {
      int use_copy;
      zval tmp;
      zend_make_printable_zval(from, &tmp, &use_copy);
      ZVAL_COPY_VALUE(from, &tmp);
      return true;
    }
    default:
      zend_error(E_USER_ERROR, "Given value cannot be converted to string.");
      return false;
  }
}
开发者ID:Livefyre,项目名称:protobuf,代码行数:19,代码来源:type_check.c

示例12: zend_print_zval_ex

ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent)
{
	zval expr_copy;
	int use_copy;

	zend_make_printable_zval(expr, &expr_copy, &use_copy);
	if (use_copy) {
		expr = &expr_copy;
	}
	if (expr->value.str.len==0) { /* optimize away empty strings */
		if (use_copy) {
			zval_dtor(expr);
		}
		return 0;
	}
	write_func(expr->value.str.val, expr->value.str.len);
	if (use_copy) {
		zval_dtor(expr);
	}
	return expr->value.str.len;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:21,代码来源:zend.c

示例13: phalcon_filter_identifier

/**
 * Filter identifiers string like variables or database columns/tables
 */
void phalcon_filter_identifier(zval *return_value, zval *param){

	int i;
	char ch;
	zval copy = {};
	smart_str filtered_str = {0};
	int use_copy = 0;

	if (Z_TYPE_P(param) != IS_STRING) {
		use_copy = zend_make_printable_zval(param, &copy);
		if (use_copy) {
			param = ©
		}
	}

	for (i = 0; i < Z_STRLEN_P(param); i++) {
		ch = Z_STRVAL_P(param)[i];
		if (ch == '\0') {
			break;
		}
		if (isalnum(ch) || ch == '_') {
			smart_str_appendc(&filtered_str, ch);
		}
	}

	if (use_copy) {
		zval_ptr_dtor(param);
	}

	smart_str_0(&filtered_str);

	if (filtered_str.s) {
		RETURN_NEW_STR(filtered_str.s);
	} else {
		smart_str_free(&filtered_str);
		RETURN_EMPTY_STRING();
	}

}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:42,代码来源:filter.c

示例14: zephir_filter_identifier

/**
 * Filter identifiers string like variables or database columns/tables
 */
void zephir_filter_identifier(zval *return_value, zval *param){

	unsigned int i;
	unsigned char ch;
	zval copy;
	smart_str filtered_str = {0};
	int use_copy = 0;

	if (Z_TYPE_P(param) != IS_STRING) {
		zend_make_printable_zval(param, &copy, &use_copy);
		if (use_copy) {
			param = &copy;
		}
	}

	for (i = 0; i < Z_STRLEN_P(param); i++) {
		ch = Z_STRVAL_P(param)[i];
		if (ch == '\0') {
			break;
		}
		if (isalnum(ch) || ch == '_') {
			smart_str_appendc(&filtered_str, ch);
		}
	}

	if (use_copy) {
		zval_dtor(param);
	}

	smart_str_0(&filtered_str);

	if (filtered_str.c) {
		RETURN_STRINGL(filtered_str.c, filtered_str.len, 0);
	} else {
		RETURN_EMPTY_STRING();
	}

}
开发者ID:andont,项目名称:zephir,代码行数:41,代码来源:filter.c

示例15: zephir_fast_strtolower

/**
 * Fast call to php strlen
 */
void zephir_fast_strtolower(zval *return_value, zval *str){

	zval copy;
	int use_copy = 0;
	char *lower_str;
	unsigned int length;

	if (Z_TYPE_P(str) != IS_STRING) {
		zend_make_printable_zval(str, &copy, &use_copy);
		if (use_copy) {
			str = &copy;
		}
	}

	length = Z_STRLEN_P(str);
	lower_str = estrndup(Z_STRVAL_P(str), length);
	php_strtolower(lower_str, length);

	if (use_copy) {
		zval_dtor(str);
	}

	ZVAL_STRINGL(return_value, lower_str, length, 0);
}
开发者ID:darkgaro,项目名称:zephir,代码行数:27,代码来源:string.c


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