thetaphi                Tue Jul 25 09:19:39 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/sybase_ct      php_sybase_ct.c 
  Log:
  revert shitty whitespace patch (forgot to reconfigure my editor after 
reinstallation)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.103.2.5.2.4&r2=1.103.2.5.2.5&diff_format=u
Index: php-src/ext/sybase_ct/php_sybase_ct.c
diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.4 
php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.5
--- php-src/ext/sybase_ct/php_sybase_ct.c:1.103.2.5.2.4 Tue Jul 25 08:42:54 2006
+++ php-src/ext/sybase_ct/php_sybase_ct.c       Tue Jul 25 09:19:38 2006
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_sybase_ct.c,v 1.103.2.5.2.4 2006/07/25 08:42:54 thetaphi Exp $ */
+/* $Id: php_sybase_ct.c,v 1.103.2.5.2.5 2006/07/25 09:19:38 thetaphi Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -161,7 +161,7 @@
 }
 
 /* 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 @@
                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 @@
                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 @@
                }
        }
 
-       /* 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 @@
        }
        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 @@
                        }
                }
        }
-
+       
        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 @@
        }
 
        /* 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 @@
 
 /* }}} */
 
-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 @@
                         * dead ourselves.
                         */
                        result->sybase_ptr->dead = 1;
-
+                       
                case CS_CANCELED:
                default:
                        _free_sybase_result(result);
@@ -1131,12 +1131,12 @@
        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 @@
                        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 @@
                                                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 @@
                                                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 @@
        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 @@
        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; i<num_fields; i++) {
                ct_describe(sybase_ptr->cmd, i+1, &result->datafmt[i]);
                result->types[i] = result->datafmt[i].datatype;
@@ -1338,7 +1338,7 @@
                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 @@
        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 @@
                        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 @@
                                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 @@
                                                                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 @@
                        }
                }
 
-               /* 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 @@
        }
 
        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 @@
        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 @@
        }
 
        array_init(return_value);
-
+       
        j= 1;
        for (i=0; i<result->num_fields; i++) {
                ALLOC_ZVAL(tmp);
@@ -1799,7 +1799,7 @@
                        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 @@
        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 @@
                /* 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 @@
        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 @@
 
        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 @@
        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 @@
        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 @@
 
 
 /* {{{ 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 @@
                case 2:          /* Connection-based message handler */
                        if (zend_get_parameters_ex(2, &param, 
&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 @@
                default:
                        WRONG_PARAM_COUNT;
        }
-
+       
        /* Clean out old callback */
        if (*callback) {
                zval_ptr_dtor(callback);
@@ -2242,7 +2242,7 @@
                        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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to