You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@avron.ICS.UCI.EDU> on 1996/05/28 05:24:07 UTC

Re: Cleanup patches

> I have the following patches to cleanup some -Wall warnings.
> At least one real bug in the version of mod_auth_pg95.c that
> I had.

Style issues ...

> *** http_bprintf.c.orig	Mon May 27 21:41:56 1996
> --- http_bprintf.c	Mon May 27 21:49:21 1996
> ***************
> *** 62,69 ****
>       {
>       const char *f,*fStop,*percentPtr,*p;
>       char *fmtBuffPtr, *buffPtr;
> !     int op, performedOp, sizeModifier, buffCount, buffLen, specifierLength;
> !     int fastPath, n, auxBuffLen, buffReqd, minWidth, precision, exp;
>       char *auxBuffPtr = NULL;
>       int streamCount = 0;
>       char fmtBuff[FMT_BUFFLEN];
> --- 62,69 ----
>       {
>       const char *f,*fStop,*percentPtr,*p;
>       char *fmtBuffPtr, *buffPtr;
> !     int op, performedOp, sizeModifier, buffCount = 0, buffLen, specifierLength;
> !     int fastPath, n, auxBuffLen = 0, buffReqd, minWidth, precision, exp;
>       char *auxBuffPtr = NULL;
>       int streamCount = 0;
>       char fmtBuff[FMT_BUFFLEN];

It is generally bad practice to mix initializations with lists, so I would
rather see

        int op, performedOp, sizeModifier, buffLen, specifierLength;
        int fastPath, n, buffReqd, minWidth, precision, exp;
        int buffCount = 0;
        int auxBuffLen = 0;

> ***************
> *** 75,87 ****
>       unsigned unsignedArg;
>       unsigned long uLongArg;
>       unsigned short uShortArg;
> !     char *charPtrArg;
>       void *voidPtrArg;
>       int *intPtrArg;
>       long *longPtrArg;
>       short *shortPtrArg;
> !     double doubleArg;
> !     LONG_DOUBLE lDoubleArg;
>   
>       fmtBuff[0] = '%';
>       f=format;
> --- 75,87 ----
>       unsigned unsignedArg;
>       unsigned long uLongArg;
>       unsigned short uShortArg;
> !     char *charPtrArg = '\0';
>       void *voidPtrArg;
>       int *intPtrArg;
>       long *longPtrArg;
>       short *shortPtrArg;
> !     double doubleArg = .0;
> !     LONG_DOUBLE lDoubleArg = .0;
>   
>       fmtBuff[0] = '%';
>       f=format;

Again, some (admittedly broken) compilers puke on .0

        double doubleArg = 0.0;
        LONG_DOUBLE lDoubleArg = 0.0;

is less likely to cause problems.

Just suggestions -- these aren't things I would consider vetoing or
anything like that.

.......Roy