- ZE coding style requires if ( instead of if(

This commit is contained in:
Andi Gutmans 2003-06-30 20:22:35 +00:00
parent 5ee72bb478
commit 288dacca0c
10 changed files with 68 additions and 68 deletions

View File

@ -305,7 +305,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC)
Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
}
zend_printf("%s Object (", class_name?class_name:"Unknown Class");
if(class_name) {
if (class_name) {
efree(class_name);
}
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
@ -358,7 +358,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int
Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
}
zend_printf("%s Object\n", class_name?class_name:"Unknown Class");
if(class_name) {
if (class_name) {
efree(class_name);
}
if (Z_OBJ_HANDLER_P(expr, get_properties)) {
@ -1017,7 +1017,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
zend_execute(EG(active_op_array) TSRMLS_CC);
if (EG(exception)) {
char ex_class_name[128];
if(Z_TYPE_P(EG(exception)) == IS_OBJECT) {
if (Z_TYPE_P(EG(exception)) == IS_OBJECT) {
strncpy(ex_class_name, Z_OBJ_CLASS_NAME_P(EG(exception)), 127);
ex_class_name[127] = '\0';
} else {
@ -1043,7 +1043,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
}
efree(params);
zval_ptr_dtor(&old_exception);
if(EG(exception)) {
if (EG(exception)) {
zval_ptr_dtor(&EG(exception));
EG(exception) = NULL;
}

View File

@ -1505,9 +1505,9 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
if(EG(active_op_array) && strcmp(lcname, "self") == 0) {
if (EG(active_op_array) && strcmp(lcname, "self") == 0) {
ce = EG(active_op_array)->scope;
} else if(strcmp(lcname, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
} else if (strcmp(lcname, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
ce = EG(active_op_array)->scope->parent;
} else if (zend_lookup_class(lcname, Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;

View File

@ -1321,9 +1321,9 @@ void zend_do_end_function_call(znode *function_name, znode *result, znode *argum
zend_op *opline;
if(is_method && function_name && function_name->op_type == IS_UNUSED) {
if (is_method && function_name && function_name->op_type == IS_UNUSED) {
/* clone */
if(argument_list->u.constant.value.lval != 0) {
if (argument_list->u.constant.value.lval != 0) {
zend_error(E_WARNING, "Clone method does not require arguments");
}
opline = &CG(active_op_array)->opcodes[function_name->u.constant.value.lval];

View File

@ -215,7 +215,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
int retval = 1;
char *colon;
if((colon = memchr(name, ':', name_len)) && colon[1] == ':') {
if ((colon = memchr(name, ':', name_len)) && colon[1] == ':') {
/* class constant */
zend_class_entry **ce = NULL, *scope;
int class_name_len = colon-name;
@ -223,7 +223,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
char *constant_name = colon+2;
zval **ret_constant;
if(EG(in_execution)) {
if (EG(in_execution)) {
scope = EG(scope);
} else {
scope = CG(active_class_entry);
@ -232,8 +232,8 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
lookup_name = do_alloca(class_name_len+1);
zend_str_tolower_copy(lookup_name, name, class_name_len);
lookup_name[class_name_len] = '\0';
if(class_name_len == sizeof("self")-1 && strcmp(lookup_name, "self") == 0) {
if(scope) {
if (class_name_len == sizeof("self")-1 && strcmp(lookup_name, "self") == 0) {
if (scope) {
ce = &scope;
} else {
zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
@ -248,12 +248,12 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
ce = &scope->parent;
}
} else {
if(zend_lookup_class(lookup_name, class_name_len, &ce TSRMLS_CC) != SUCCESS) {
if (zend_lookup_class(lookup_name, class_name_len, &ce TSRMLS_CC) != SUCCESS) {
retval = 0;
}
}
if(retval && ce) {
if (retval && ce) {
if (zend_hash_find(&((*ce)->constants_table), constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) {
retval = 0;
}
@ -261,7 +261,7 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC
retval = 0;
}
if(retval) {
if (retval) {
*result = **ret_constant;
zval_copy_ctor(result);
}

View File

@ -470,7 +470,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
if (op2) {
if (op2->op_type == IS_VAR) {
if (value == &T(op2->u.var).tmp_var) {
if(result->u.EA.type & EXT_TYPE_UNUSED) {
if (result->u.EA.type & EXT_TYPE_UNUSED) {
/* We are not going to use return value, drop it */
STR_FREE(value->value.str.val);
} else {
@ -2208,7 +2208,7 @@ int zend_add_var_handler(ZEND_OPCODE_HANDLER_ARGS)
static int zend_import_check_function(HashTable *target_ht, zend_function *function, zend_hash_key *hash_key, void *param)
{
if(zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) {
if (zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) {
zend_error(E_ERROR, "Import: function %s() already exists in current scope", function->common.function_name?function->common.function_name:"main");
}
return 1; /* OK */
@ -2243,7 +2243,7 @@ int zend_import_function_handler(ZEND_OPCODE_HANDLER_ARGS)
static int zend_import_check_class(HashTable *target_ht, zend_class_entry **ce, zend_hash_key *hash_key, void *param)
{
if(zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) {
if (zend_hash_quick_exists(target_ht, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) {
zend_error(E_ERROR, "Import: class '%s' already exists in current scope", (*ce)->name);
}
return 1; /* OK */
@ -3130,7 +3130,7 @@ int zend_clone_handler(ZEND_OPCODE_HANDLER_ARGS)
{
zval *obj = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
if(Z_TYPE_P(obj) != IS_OBJECT) {
if (Z_TYPE_P(obj) != IS_OBJECT) {
zend_error(E_WARNING, "__clone method called on non-object");
EX_T(EX(opline)->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(EX(opline)->result.u.var).var.ptr->refcount++;

View File

@ -542,10 +542,10 @@ int fast_call_user_function(HashTable *function_table, zval **object_pp, zval *f
int found = FAILURE;
lc_class = zend_str_tolower_dup(Z_STRVAL_PP(object_pp), Z_STRLEN_PP(object_pp));
if(EG(active_op_array) && strcmp(lc_class, "self") == 0) {
if (EG(active_op_array) && strcmp(lc_class, "self") == 0) {
ce = &(EG(active_op_array)->scope);
found = (*ce != NULL?SUCCESS:FAILURE);
} else if(strcmp(lc_class, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
} else if (strcmp(lc_class, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
ce = &(EG(active_op_array)->scope->parent);
found = (*ce != NULL?SUCCESS:FAILURE);
} else {

View File

@ -204,7 +204,7 @@ void *zend_mm_alloc(zend_mm_heap *heap, size_t size)
zend_mm_free_block **free_list_bucket;
size_t index;
/* The max() can probably be optimized with an if() which checks more specific cases */
/* The max() can probably be optimized with an if () which checks more specific cases */
true_size = MAX(ZEND_MM_ALIGNED_SIZE(size)+ZEND_MM_ALIGNED_HEADER_SIZE, ZEND_MM_ALIGNED_FREE_HEADER_SIZE);
index = ZEND_MM_BUCKET_INDEX(true_size);

View File

@ -119,7 +119,7 @@ static void zend_cleanup_op_array_data(zend_op_array *op_array)
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
{
if(function->type == ZEND_USER_FUNCTION) {
if (function->type == ZEND_USER_FUNCTION) {
zend_cleanup_op_array_data((zend_op_array *) function);
}
return 0;
@ -127,7 +127,7 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
{
if((*pce)->type == ZEND_USER_CLASS) {
if ((*pce)->type == ZEND_USER_CLASS) {
/* Clean all parts that can contain run-time data */
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
not contain objects and thus are not probelmatic */

View File

@ -93,13 +93,13 @@ ZEND_FUNCTION(reflection_function)
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
convert_to_string_ex(name);
zval_add_ref(name);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) name, sizeof(zval *), NULL);
if(zend_hash_find(EG(function_table), (char *)Z_STRVAL_PP(name), (int)(Z_STRLEN_PP(name) + 1), (void **)&fptr) == FAILURE) {
if (zend_hash_find(EG(function_table), (char *)Z_STRVAL_PP(name), (int)(Z_STRLEN_PP(name) + 1), (void **)&fptr) == FAILURE) {
zval *ex;
zval *tmp;
MAKE_STD_ZVAL(ex);
@ -144,10 +144,10 @@ ZEND_FUNCTION(reflection_function_isinternal)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
RETURN_FALSE;
}
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION);
@ -164,10 +164,10 @@ ZEND_FUNCTION(reflection_function_isuserdefined)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
return;
}
RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION);
@ -184,13 +184,13 @@ ZEND_FUNCTION(reflection_function_getfilename)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
return;
}
if(fptr->type == ZEND_USER_FUNCTION) {
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_STRING(fptr->op_array.filename, 1);
}
RETURN_FALSE;
@ -207,13 +207,13 @@ ZEND_FUNCTION(reflection_function_getstartline)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
return;
}
if(fptr->type == ZEND_USER_FUNCTION) {
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_start);
}
RETURN_FALSE;
@ -230,13 +230,13 @@ ZEND_FUNCTION(reflection_function_getendline)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
RETURN_FALSE;
}
if(fptr->type == ZEND_USER_FUNCTION) {
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_end);
}
RETURN_FALSE;
@ -253,13 +253,13 @@ ZEND_FUNCTION(reflection_function_getdoccomment)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
RETURN_FALSE;
}
if(fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
}
RETURN_FALSE;
@ -276,10 +276,10 @@ ZEND_FUNCTION(reflection_function_getstaticvariables)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL || fptr->op_array.static_variables == NULL) {
if ((fptr = intern->ptr) == NULL || fptr->op_array.static_variables == NULL) {
RETURN_FALSE;
}
array_init(return_value);
@ -302,11 +302,11 @@ ZEND_FUNCTION(reflection_function_invoke)
}
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL || (fptr = intern->ptr) == NULL) {
if (intern == NULL || (fptr = intern->ptr) == NULL) {
efree(params);
RETURN_FALSE;
}
if(fast_call_user_function(EG(function_table), NULL, NULL,
if (fast_call_user_function(EG(function_table), NULL, NULL,
&retval_ptr, argc, params,
1, NULL, &fptr TSRMLS_CC) == SUCCESS && retval_ptr) {
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);

View File

@ -93,13 +93,13 @@ ZEND_FUNCTION(reflection_function)
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
convert_to_string_ex(name);
zval_add_ref(name);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) name, sizeof(zval *), NULL);
if(zend_hash_find(EG(function_table), (char *)Z_STRVAL_PP(name), (int)(Z_STRLEN_PP(name) + 1), (void **)&fptr) == FAILURE) {
if (zend_hash_find(EG(function_table), (char *)Z_STRVAL_PP(name), (int)(Z_STRLEN_PP(name) + 1), (void **)&fptr) == FAILURE) {
zval *ex;
zval *tmp;
MAKE_STD_ZVAL(ex);
@ -144,10 +144,10 @@ ZEND_FUNCTION(reflection_function_isinternal)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
RETURN_FALSE;
}
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION);
@ -164,10 +164,10 @@ ZEND_FUNCTION(reflection_function_isuserdefined)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
return;
}
RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION);
@ -184,13 +184,13 @@ ZEND_FUNCTION(reflection_function_getfilename)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
return;
}
if(fptr->type == ZEND_USER_FUNCTION) {
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_STRING(fptr->op_array.filename, 1);
}
RETURN_FALSE;
@ -207,13 +207,13 @@ ZEND_FUNCTION(reflection_function_getstartline)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
return;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
return;
}
if(fptr->type == ZEND_USER_FUNCTION) {
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_start);
}
RETURN_FALSE;
@ -230,13 +230,13 @@ ZEND_FUNCTION(reflection_function_getendline)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
RETURN_FALSE;
}
if(fptr->type == ZEND_USER_FUNCTION) {
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_end);
}
RETURN_FALSE;
@ -253,13 +253,13 @@ ZEND_FUNCTION(reflection_function_getdoccomment)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL) {
if ((fptr = intern->ptr) == NULL) {
RETURN_FALSE;
}
if(fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
}
RETURN_FALSE;
@ -276,10 +276,10 @@ ZEND_FUNCTION(reflection_function_getstaticvariables)
}
object = getThis();
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL) {
if (intern == NULL) {
RETURN_FALSE;
}
if((fptr = intern->ptr) == NULL || fptr->op_array.static_variables == NULL) {
if ((fptr = intern->ptr) == NULL || fptr->op_array.static_variables == NULL) {
RETURN_FALSE;
}
array_init(return_value);
@ -302,11 +302,11 @@ ZEND_FUNCTION(reflection_function_invoke)
}
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
if(intern == NULL || (fptr = intern->ptr) == NULL) {
if (intern == NULL || (fptr = intern->ptr) == NULL) {
efree(params);
RETURN_FALSE;
}
if(fast_call_user_function(EG(function_table), NULL, NULL,
if (fast_call_user_function(EG(function_table), NULL, NULL,
&retval_ptr, argc, params,
1, NULL, &fptr TSRMLS_CC) == SUCCESS && retval_ptr) {
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);