From: Uwe Schindler Date: Tue, 25 Jul 2006 09:19:38 +0000 (+0000) Subject: revert shitty whitespace patch (forgot to reconfigure my editor after reinstallation) X-Git-Tag: php-5.2.0RC2~221 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c1da9dbc8ba89e3a6460831e9773f932fde8f44a;p=php revert shitty whitespace patch (forgot to reconfigure my editor after reinstallation) --- diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c index 7fa8591e96..413f1d8542 100644 --- a/ext/sybase_ct/php_sybase_ct.c +++ b/ext/sybase_ct/php_sybase_ct.c @@ -161,7 +161,7 @@ static void _free_sybase_result(sybase_result *result) } /* Forward declaration */ -static int php_sybase_finish_results (sybase_result *result TSRMLS_DC); +static int php_sybase_finish_results (sybase_result *result); static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) { @@ -172,7 +172,7 @@ static void php_free_sybase_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) if (result->sybase_ptr->cmd) { ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); } - php_sybase_finish_results(result TSRMLS_CC); + php_sybase_finish_results(result); } _free_sybase_result(result); @@ -290,10 +290,10 @@ static int _call_message_handler(zval *callback_name, CS_SERVERMSG *srvmsg TSRML ZVAL_LONG(line, srvmsg->line); args[3] = &line; - MAKE_STD_ZVAL(text); + MAKE_STD_ZVAL(text); ZVAL_STRING(text, srvmsg->text, 1); args[4] = &text; - + if (call_user_function_ex(EG(function_table), NULL, callback_name, &retval, 5, args, 0, NULL TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cannot call the messagehandler %s", Z_STRVAL_P(callback_name)); } @@ -401,10 +401,10 @@ static PHP_GINIT_FUNCTION(sybase) } } - /* Set the timeout, which is per context and can't be set with - * ct_con_props(), so set it globally from the config value if + /* Set the timeout, which is per context and can't be set with + * ct_con_props(), so set it globally from the config value if * requested. The default is CS_NO_LIMIT. - * + * * Note that despite some noise in the documentation about using * signals to implement timeouts, they are actually implemented * by using poll() or select() on Solaris and Linux. @@ -502,7 +502,7 @@ static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char } if (appname) { ct_con_props(sybase->connection, CS_SET, CS_APPNAME, appname, CS_NULLTERM, NULL); - } else { + } else { ct_con_props(sybase->connection, CS_SET, CS_APPNAME, SybCtG(appname), CS_NULLTERM, NULL); } @@ -527,7 +527,7 @@ static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char } } } - + if (cfg_get_long("sybct.packet_size", &packetsize) == SUCCESS) { if (ct_con_props(sybase->connection, CS_SET, CS_PACKETSIZE, (CS_VOID *)&packetsize, CS_UNUSED, NULL) != CS_SUCCEED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Unable to update connection packetsize."); @@ -535,15 +535,15 @@ static int php_sybase_do_connect_internal(sybase_link *sybase, char *host, char } /* Set the login timeout. Actually, the login timeout is per context - * and not per connection, but we will update the context here to + * and not per connection, but we will update the context here to * allow for code such as the following: - * + * * ini_set('sybct.login_timeout', $timeout); * sybase_connect(...) - * - * Note that preceding calls to sybase_connect() will now use the + * + * Note that preceding calls to sybase_connect() will now use the * updated value and not the default one! - * + * * The default value for CS_LOGIN_TIMEOUT is 60 (1 minute). */ if (SybCtG(login_timeout) != -1) { @@ -1020,12 +1020,12 @@ PHP_FUNCTION(sybase_select_db) /* }}} */ -static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) +static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) { int i, fail; CS_RETCODE retcode; CS_INT restype; - + efree(result->datafmt); efree(result->lengths); efree(result->indicators); @@ -1101,7 +1101,7 @@ static int php_sybase_finish_results(sybase_result *result TSRMLS_DC) * dead ourselves. */ result->sybase_ptr->dead = 1; - + case CS_CANCELED: default: _free_sybase_result(result); @@ -1131,12 +1131,12 @@ static int php_sybase_fetch_result_row (sybase_result *result, int numrows) int i, j; CS_INT retcode; TSRMLS_FETCH(); - + /* We've already fetched everything */ if (result->last_retcode == CS_END_DATA || result->last_retcode == CS_END_RESULTS) { return result->last_retcode; } - + if (numrows!=-1) numrows+= result->num_rows; while ((retcode=ct_fetch(result->sybase_ptr->cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL))==CS_SUCCEED || retcode==CS_ROW_FAIL) { @@ -1145,7 +1145,7 @@ static int php_sybase_fetch_result_row (sybase_result *result, int numrows) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Error reading row %d", result->num_rows); } */ - + result->num_rows++; i= result->store ? result->num_rows- 1 : 0; if (i >= result->blocks_initialized*SYBASE_ROWS_BLOCK) { @@ -1171,10 +1171,10 @@ static int php_sybase_fetch_result_row (sybase_result *result, int numrows) ZVAL_LONG(&result->data[i][j], strtol(result->tmp_buffer[j], NULL, 10)); break; } - + case 2: { /* This indicates a float */ - RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); + RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); break; } @@ -1183,43 +1183,43 @@ static int php_sybase_fetch_result_row (sybase_result *result, int numrows) errno = 0; Z_LVAL(result->data[i][j]) = strtol(result->tmp_buffer[j], NULL, 10); if (errno == ERANGE) { - + /* An overflow occurred, so try to fit it into a double */ - RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); + RETURN_DOUBLE_VAL(result->data[i][j], result->tmp_buffer[j], result->lengths[j]); break; } Z_TYPE(result->data[i][j]) = IS_LONG; break; } - + default: { /* This indicates anything else, return it as string */ ZVAL_STRINGL(&result->data[i][j], result->tmp_buffer[j], result->lengths[j]- 1, 1); break; - } + } } } } if (numrows!=-1 && result->num_rows>=numrows) break; } - + result->last_retcode= retcode; switch (retcode) { case CS_END_DATA: retcode = php_sybase_finish_results(result TSRMLS_CC); break; - + case CS_ROW_FAIL: case CS_SUCCEED: break; - + default: _free_sybase_result(result); result = NULL; retcode = CS_FAIL; /* Just to be sure */ break; } - + return retcode; } @@ -1238,7 +1238,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int if (ct_res_info(sybase_ptr->cmd, CS_NUMDATA, &num_fields, CS_UNUSED, NULL)!=CS_SUCCEED) { return NULL; } - + result = (sybase_result *) emalloc(sizeof(sybase_result)); result->data = (zval **) safe_emalloc(sizeof(zval *), SYBASE_ROWS_BLOCK, 0); result->fields = NULL; @@ -1254,7 +1254,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int result->datafmt = (CS_DATAFMT *) safe_emalloc(sizeof(CS_DATAFMT), num_fields, 0); result->numerics = (unsigned char *) safe_emalloc(sizeof(unsigned char), num_fields, 0); result->types = (CS_INT *) safe_emalloc(sizeof(CS_INT), num_fields, 0); - + for (i=0; icmd, i+1, &result->datafmt[i]); result->types[i] = result->datafmt[i].datatype; @@ -1338,7 +1338,7 @@ static sybase_result * php_sybase_fetch_result_set (sybase_link *sybase_ptr, int result->fields[i].numeric = result->numerics[i]; Z_TYPE(result->fields[i]) = result->types[i]; } - + if (buffered) { retcode = CS_SUCCEED; } else { @@ -1406,26 +1406,26 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) if (sybase_ptr->dead) { RETURN_FALSE; } - + /* Check to see if a previous sybase_unbuffered_query has read all rows */ if (sybase_ptr->active_result_index) { zval *tmp = NULL; - + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "called without first fetching all rows from a previous unbuffered query"); if (sybase_ptr->cmd) { ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL); } - + /* Get the resultset and free it */ ALLOC_ZVAL(tmp); Z_LVAL_P(tmp)= sybase_ptr->active_result_index; Z_TYPE_P(tmp)= IS_RESOURCE; INIT_PZVAL(tmp); ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result); - + /* Causes the following segfault: Program received signal SIGSEGV, Segmentation fault. - 0x8144380 in _efree (ptr=0x81fe024, __zend_filename=0x81841a0 "php4/ext/sybase_ct/php_sybase_ct.c", + 0x8144380 in _efree (ptr=0x81fe024, __zend_filename=0x81841a0 "php4/ext/sybase_ct/php_sybase_ct.c", __zend_lineno=946, __zend_orig_filename=0x0, __zend_orig_lineno=0) at php4/Zend/zend_alloc.c:229 php4/Zend/zend_alloc.c:229:7284:beg:0x8144380 */ @@ -1434,7 +1434,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) php_sybase_finish_results(result TSRMLS_CC); } #endif - + zval_ptr_dtor(&tmp); zend_list_delete(sybase_ptr->active_result_index); sybase_ptr->active_result_index= 0; @@ -1514,7 +1514,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) status = Q_RESULT; break; } - + /* Check for left-over results */ if (!buffered && status != Q_RESULT) { while ((retcode = ct_results(sybase_ptr->cmd, &restype))==CS_SUCCEED) { @@ -1539,7 +1539,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) RETURN_FALSE; } status = Q_RESULT; - retcode = result->last_retcode; + retcode = result->last_retcode; } else { /* Unexpected results, cancel them. */ ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT); @@ -1585,7 +1585,7 @@ static void php_sybase_query (INTERNAL_FUNCTION_PARAMETERS, int buffered) } } - /* Retry deadlocks up until deadlock_retry_count times */ + /* Retry deadlocks up until deadlock_retry_count times */ if (sybase_ptr->deadlock && SybCtG(deadlock_retry_count) != -1 && ++deadlock_count > SybCtG(deadlock_retry_count)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Retried deadlock %d times [max: %ld], giving up", deadlock_count- 1, SybCtG(deadlock_retry_count)); if (result != NULL) { @@ -1661,14 +1661,14 @@ PHP_FUNCTION(sybase_free_result) } ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result); - + /* Did we fetch up until the end? */ if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Cancelling the rest of the results"); */ ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_ALL); php_sybase_finish_results(result TSRMLS_CC); } - + zend_list_delete(Z_LVAL_PP(sybase_result_index)); RETURN_TRUE; } @@ -1733,14 +1733,14 @@ PHP_FUNCTION(sybase_fetch_row) if (ZEND_NUM_ARGS() !=1 || zend_get_parameters_ex(1, &sybase_result_index) == FAILURE) { WRONG_PARAM_COUNT; } - + ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result); /* Unbuffered? */ if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS) { php_sybase_fetch_result_row(result, 1); } - + /* At the end? */ if (result->cur_row >= result->num_rows) { RETURN_FALSE; @@ -1784,7 +1784,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int numerics) } array_init(return_value); - + j= 1; for (i=0; inum_fields; i++) { ALLOC_ZVAL(tmp); @@ -1799,7 +1799,7 @@ static void php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int numerics) zend_hash_index_update(Z_ARRVAL_P(return_value), i, (void *) &tmp, sizeof(zval *), NULL); tmp->refcount++; } - + if (zend_hash_exists(Z_ARRVAL_P(return_value), result->fields[i].name, strlen(result->fields[i].name)+1)) { snprintf(name, 32, "%s%d", result->fields[i].name, j); result->fields[i].name= estrdup(name); @@ -1818,13 +1818,13 @@ PHP_FUNCTION(sybase_fetch_object) zval **object= NULL; zval *sybase_result_index; zend_class_entry *ce= NULL; - + /* Was a second parameter given? */ if (2 == ZEND_NUM_ARGS()) { if (zend_get_parameters_ex(2, &sybase_result_index, &object) == FAILURE) { WRONG_PARAM_COUNT; } - + switch (Z_TYPE_PP(object)) { case IS_OBJECT: ce = Z_OBJCE_PP(object); @@ -1846,12 +1846,12 @@ PHP_FUNCTION(sybase_fetch_object) /* Reset no. of arguments to 1 so that we can use INTERNAL_FUNCTION_PARAM_PASSTHRU */ ht= 1; } - + php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (Z_TYPE_P(return_value)==IS_ARRAY) { object_and_properties_init( - return_value, - ce ? ce : ZEND_STANDARD_CLASS_DEF_PTR, + return_value, + ce ? ce : ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value) ); } @@ -1894,7 +1894,7 @@ PHP_FUNCTION(sybase_data_seek) if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && Z_LVAL_PP(offset)>=result->num_rows) { php_sybase_fetch_result_row(result, Z_LVAL_PP(offset)+ 1); } - + if (Z_LVAL_PP(offset)<0 || Z_LVAL_PP(offset)>=result->num_rows) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad row offset %ld, must be betweem 0 and %d", Z_LVAL_PP(offset), result->num_rows - 1); RETURN_FALSE; @@ -2017,7 +2017,7 @@ PHP_FUNCTION(sybase_field_seek) convert_to_long_ex(offset); field_offset = Z_LVAL_PP(offset); - + if (field_offset<0 || field_offset >= result->num_fields) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Sybase: Bad column offset"); RETURN_FALSE; @@ -2045,7 +2045,7 @@ PHP_FUNCTION(sybase_result) ZEND_FETCH_RESOURCE(result, sybase_result *, sybase_result_index, -1, "Sybase result", le_result); convert_to_long_ex(row); - + /* Unbuffered ? */ if (result->last_retcode != CS_END_DATA && result->last_retcode != CS_END_RESULTS && Z_LVAL_PP(row) >= result->num_rows) { php_sybase_fetch_result_row(result, Z_LVAL_PP(row)); @@ -2132,7 +2132,7 @@ PHP_MINFO_FUNCTION(sybase) sprintf(buf, "%ld", SybCtG(min_server_severity)); php_info_print_table_row(2, "Min server severity", buf); sprintf(buf, "%ld", SybCtG(min_client_severity)); - php_info_print_table_row(2, "Min client severity", buf); + php_info_print_table_row(2, "Min client severity", buf); php_info_print_table_row(2, "Application Name", SybCtG(appname)); sprintf(buf, "%ld", SybCtG(deadlock_retry_count)); php_info_print_table_row(2, "Deadlock retry count", buf); @@ -2187,7 +2187,7 @@ PHP_FUNCTION(sybase_deadlock_retry_count) /* {{{ proto bool sybase_set_message_handler(mixed error_func [, resource connection]) - Set the error handler, to be called when a server message is raised. + Set the error handler, to be called when a server message is raised. If error_func is NULL the handler will be deleted */ PHP_FUNCTION(sybase_set_message_handler) { @@ -2206,7 +2206,7 @@ PHP_FUNCTION(sybase_set_message_handler) case 2: /* Connection-based message handler */ if (zend_get_parameters_ex(2, ¶m, &sybase_link_index) == FAILURE) { RETURN_FALSE; - } + } ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, -1, "Sybase-Link", le_link, le_plink); callback = &sybase_ptr->callback_name; break; @@ -2214,7 +2214,7 @@ PHP_FUNCTION(sybase_set_message_handler) default: WRONG_PARAM_COUNT; } - + /* Clean out old callback */ if (*callback) { zval_ptr_dtor(callback); @@ -2242,7 +2242,7 @@ PHP_FUNCTION(sybase_set_message_handler) php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argumented is expected to be either NULL, an array or string, %s given", zend_zval_type_name(*param)); RETURN_FALSE; } - + ALLOC_ZVAL(*callback); **callback = **param; INIT_PZVAL(*callback);