apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: svn commit: r1078507 - /apr/apr/trunk/dbd/apr_dbd_odbc.c
Date Wed, 09 Mar 2011 18:40:42 GMT
On Sun, Mar 6, 2011 at 11:34 AM,  <trawick@apache.org> wrote:
> Author: trawick
> Date: Sun Mar  6 16:34:46 2011
> New Revision: 1078507
>
> URL: http://svn.apache.org/viewvc?rev=1078507&view=rev
> Log:
> style changes only -- make it look a lot more like the bulk of APR
>
> Modified:
>    apr/apr/trunk/dbd/apr_dbd_odbc.c
>
> Modified: apr/apr/trunk/dbd/apr_dbd_odbc.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/dbd/apr_dbd_odbc.c?rev=1078507&r1=1078506&r2=1078507&view=diff
> ==============================================================================
> --- apr/apr/trunk/dbd/apr_dbd_odbc.c (original)
> +++ apr/apr/trunk/dbd/apr_dbd_odbc.c Sun Mar  6 16:34:46 2011
> @@ -1268,11 +1304,12 @@ static int odbc_get_row(apr_pool_t * poo
>
>     /* mark all the columns as needing SQLGetData unless they are bound  */
>     for (c = 0; c < res->ncols; c++) {
> -        if (res->colstate[c] != COL_BOUND)
> +        if (res->colstate[c] != COL_BOUND) {
>             res->colstate[c] = COL_AVAIL;
> -            /* some drivers do not null-term zero-len CHAR data */
> -            if (res->colptrs[c] )
> -                * (char *) res->colptrs[c] = 0;
> +        }
> +        /* some drivers do not null-term zero-len CHAR data */
> +        if (res->colptrs[c])
> +            *(char *)res->colptrs[c] = 0;
>     }

I just remembered...

The original code was a bit disturbing because of the indentation:

    /* mark all the columns as needing SQLGetData unless they are bound  */
    for (c = 0; c < res->ncols; c++) {
        if (res->colstate[c] != COL_BOUND)
            res->colstate[c] = COL_AVAIL;
            /* some drivers do not null-term zero-len CHAR data */
            if (res->colptrs[c] )
                * (char *) res->colptrs[c] = 0;
    }

>From the indentation, it looks like the second 'if' is part of a block
starting with res->colstate[c] = COL_AVAIL.

The behavior stayed the same across the reformat, and I can't confirm
that the original code was broken, but still...

Mime
View raw message