jani Fri Nov 2 09:43:04 2007 UTC
Modified files:
/php-src/ext/standard var.c
Log:
more ws
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/var.c?r1=1.270&r2=1.271&diff_format=u
Index: php-src/ext/standard/var.c
diff -u php-src/ext/standard/var.c:1.270 php-src/ext/standard/var.c:1.271
--- php-src/ext/standard/var.c:1.270 Fri Nov 2 09:15:55 2007
+++ php-src/ext/standard/var.c Fri Nov 2 09:43:04 2007
@@ -18,9 +18,9 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.270 2007/11/02 09:15:55 jani Exp $ */
+/* $Id: var.c,v 1.271 2007/11/02 09:43:04 jani Exp $ */
-/* {{{ includes
+/* {{{ includes
*/
#include <stdio.h>
#include <stdlib.h>
@@ -252,18 +252,18 @@
zval ***args;
int argc;
int i;
-
+
argc = ZEND_NUM_ARGS();
-
+
args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) ==
FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
-
- for (i=0; i<argc; i++)
+
+ for (i = 0; i < argc; i++) {
php_var_dump(args[i], 1, 0 TSRMLS_CC);
-
+ }
efree(args);
}
/* }}} */
@@ -275,18 +275,18 @@
zval ***args;
int argc;
int i;
-
+
argc = ZEND_NUM_ARGS();
-
+
args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) ==
FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
-
- for (i=0; i<argc; i++)
+
+ for (i = 0; i < argc; i++) {
php_var_dump(args[i], 1, 1 TSRMLS_CC);
-
+ }
efree(args);
}
/* }}} */
@@ -301,13 +301,13 @@
if (hash_key->nKeyLength == 0) { /* numeric key */
php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h);
} else { /* string key */
- /* XXX: perphaps when we are inside the class we should permit
access to
+ /* XXX: perphaps when we are inside the class we should permit
access to
* private & protected values
*/
- if (va_arg(args, int) &&
+ if (va_arg(args, int) &&
((hash_key->type == IS_STRING && hash_key->arKey.s[0]
== 0) ||
(hash_key->type == IS_UNICODE && hash_key->arKey.u[0]
== 0))
- ) {
+ ) {
return 0;
}
php_printf("%*c[", level + 1, ' ');
@@ -450,16 +450,16 @@
zval ***args;
int argc;
int i;
-
+
argc = ZEND_NUM_ARGS();
-
+
args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_array_ex(argc, args) ==
FAILURE) {
efree(args);
WRONG_PARAM_COUNT;
}
-
- for (i = 0; i<argc; i++) {
+
+ for (i = 0; i < argc; i++) {
php_debug_zval_dump(args[i], 1, 1 TSRMLS_CC);
}
efree(args);
@@ -473,7 +473,7 @@
level = va_arg(args, int);
- if (hash_key->nKeyLength==0) { /* numeric key */
+ if (hash_key->nKeyLength == 0) { /* numeric key */
php_printf("%*c%ld => ", level + 1, ' ', hash_key->h);
} else { /* string key */
php_printf("%*c'", level + 1, ' ');
@@ -622,7 +622,6 @@
break;
}
}
-
/* }}} */
/* {{{ proto mixed var_export(mixed var [, bool return]) U
@@ -631,15 +630,15 @@
{
zval *var;
zend_bool return_output = 0;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|b", &var,
&return_output) == FAILURE) {
return;
}
-
+
if (return_output) {
php_output_start_default(TSRMLS_C);
}
-
+
/* UTODO
* We need to escape non-ASCII chars with \uXXXX format.
php_var_export()
* currently uses output_encoding to export Unicode strings. Suppose
it's
@@ -687,7 +686,7 @@
}
return FAILURE;
}
-
+
/* +1 because otherwise hash will think we are trying to store NULL
pointer */
var_no = zend_hash_num_elements(var_hash) + 1;
zend_hash_add(var_hash, p, len, &var_no, sizeof(var_no), NULL);
@@ -809,14 +808,14 @@
nvalp = &nval;
zend_hash_internal_pointer_reset_ex(HASH_OF(retval_ptr), &pos);
-
+
for (;; zend_hash_move_forward_ex(HASH_OF(retval_ptr), &pos)) {
i = zend_hash_get_current_key_ex(HASH_OF(retval_ptr),
&key, &key_len, &index, 0, &pos);
-
+
if (i == HASH_KEY_NON_EXISTANT) {
break;
}
-
+
if (incomplete_class &&
key_len == sizeof(MAGIC_MEMBER) &&
ZEND_U_EQUAL(i, key, key_len-1, MAGIC_MEMBER,
sizeof(MAGIC_MEMBER)-1)
@@ -845,7 +844,7 @@
if (ce) {
zstr prot_name, priv_name;
int prop_name_length;
-
+
do {
zend_u_mangle_property_name(&priv_name, &prop_name_length, Z_TYPE_PP(name),
ce->name, ce->name_length, Z_UNIVAL_PP(name), Z_UNILEN_PP(name), ce->type &
ZEND_INTERNAL_CLASS);
if
(zend_u_hash_find(Z_OBJPROP_P(struc), Z_TYPE_PP(name), priv_name,
prop_name_length + 1, (void *) &d) == SUCCESS) {
@@ -957,7 +956,7 @@
if (Z_OBJ_HT_P(struc)->get_class_entry) {
ce = Z_OBJCE_P(struc);
- }
+ }
if (ce && ce->serialize != NULL) {
/* has custom handler */
@@ -978,7 +977,7 @@
}
smart_str_appendl(buf, "\":",
2);
-
+
smart_str_append_long(buf,
serialized_length);
if (serialized_type ==
IS_UNICODE) {
smart_str_appendl(buf,
":U:{", 4);
@@ -989,7 +988,7 @@
} else {
smart_str_appendc(buf,
'N');
}
- smart_str_appendc(buf, '}');
+ smart_str_appendc(buf, '}');
} else {
smart_str_appendl(buf, "N;", 2);
}
@@ -998,7 +997,7 @@
}
return;
}
-
+
if (ce && ce != PHP_IC_ENTRY &&
zend_hash_exists(&ce->function_table, "__sleep", sizeof("__sleep"))) {
INIT_PZVAL(&fname);
ZVAL_ASCII_STRINGL(&fname, "__sleep",
sizeof("__sleep") - 1, 1);
@@ -1016,10 +1015,10 @@
}
zval_ptr_dtor(&retval_ptr);
}
- return;
+ return;
}
}
-
+
if (retval_ptr) {
zval_ptr_dtor(&retval_ptr);
}
@@ -1048,21 +1047,21 @@
ulong index;
uint key_len;
HashPosition pos;
-
+
zend_hash_internal_pointer_reset_ex(myht, &pos);
for (;; zend_hash_move_forward_ex(myht, &pos)) {
i = zend_hash_get_current_key_ex(myht,
&key, &key_len, &index, 0, &pos);
if (i == HASH_KEY_NON_EXISTANT) {
break;
}
-
+
if (incomplete_class &&
key_len == sizeof(MAGIC_MEMBER)
&&
ZEND_U_EQUAL(i, key, key_len -
1, MAGIC_MEMBER, sizeof(MAGIC_MEMBER) - 1)
) {
continue;
- }
-
+ }
+
switch (i) {
case HASH_KEY_IS_LONG:
php_var_serialize_long(buf, index);
@@ -1077,8 +1076,8 @@
/* we should still add element even if
it's not OK,
* since we already wrote the length of
the array before */
- if (zend_hash_get_current_data_ex(myht,
(void **) &data, &pos) != SUCCESS
- || !data
+ if (zend_hash_get_current_data_ex(myht,
(void **) &data, &pos) != SUCCESS
+ || !data
|| data == &struc
|| (Z_TYPE_PP(data) == IS_ARRAY
&& Z_ARRVAL_PP(data)->nApplyCount > 1)
) {
@@ -1100,7 +1099,7 @@
default:
smart_str_appendl(buf, "i:0;", 4);
return;
- }
+ }
}
/* }}} */
@@ -1110,7 +1109,7 @@
smart_str_0(buf);
}
/* }}} */
-
+
/* {{{ proto string serialize(mixed variable) U
Returns a string representation of variable (which can later be
unserialized) */
PHP_FUNCTION(serialize)
@@ -1149,9 +1148,8 @@
char *buf = NULL;
int buf_len;
const unsigned char *p;
-
php_unserialize_data_t var_hash;
-
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &buf,
&buf_len, UG(ascii_conv)) == FAILURE) {
RETURN_FALSE;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php