httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@avron.ICS.UCI.EDU>
Subject Re: Cleanup patches
Date Tue, 28 May 1996 03:24:07 GMT
> 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

Mime
View raw message