[OpenAFS-devel] [PATCH] flexelint: punctuation fixes
Joe Buehler
jbuehler@hekimian.com
Fri, 21 Nov 2003 15:22:51 -0500
This is a multi-part message in MIME format.
--------------070304080506080705030004
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
This patch is mainly replacement of semicolons with empty
brace blocks so the meaning is more immediately obvious.
There are a couple other fixes -- extra useless semicolons,
macro parameters that should be parenthesized, a useless
"while" statement tacked onto the end of a previous statement.
--
Joe Buehler
--------------070304080506080705030004
Content-Type: text/plain;
name="temp.patch.semicolons"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="temp.patch.semicolons"
--- ./src/WINNT/afsd/cm_dns.c.~1~ 2001-10-09 00:56:00.000000000 -0400
+++ ./src/WINNT/afsd/cm_dns.c 2003-11-20 14:29:30.000000000 -0500
@@ -479,7 +479,7 @@
fprintf(stderr,"---------------------------------\n");
-};
+}
void processReplyBuffer_AFSDB(SOCKET commSock, PDNS_HDR replyBuff, int *cellHosts, int *numServers, int *ttl)
/*PAFS_SRV_LIST (srvList)*/
--- ./src/WINNT/afsd/cm_dns.c.~1~ 2001-10-09 00:56:00.000000000 -0400
+++ ./src/WINNT/afsd/cm_dns.c 2003-11-20 14:29:30.000000000 -0500
@@ -581,7 +579,7 @@
return (ptr);
-};
+}
int getAFSServer(char *cellName, int *cellHosts, int *numServers, int *ttl)
{
--- ./src/WINNT/afssvrmgr/action.cpp.~1~ 2000-11-04 05:02:00.000000000 -0500
+++ ./src/WINNT/afssvrmgr/action.cpp 2003-11-19 14:35:37.000000000 -0500
@@ -29,7 +29,7 @@
typedef enum
{
actcolOPERATION,
- actcolELAPSED,
+ actcolELAPSED
} ACTIONCOLUMN;
static struct
--- ./src/WINNT/afssvrmgr/action.cpp.~1~ 2000-11-04 05:02:00.000000000 -0500
+++ ./src/WINNT/afssvrmgr/action.cpp 2003-11-19 14:35:37.000000000 -0500
@@ -92,7 +92,7 @@
atDUMP,
atRESTORE,
atSETRESTART,
- atCHANGEADDR,
+ atCHANGEADDR
} ACTIONTYPE;
typedef struct
--- ./src/WINNT/afssvrmgr/agg_prop.cpp.~1~ 2000-11-04 05:02:01.000000000 -0500
+++ ./src/WINNT/afssvrmgr/agg_prop.cpp 2003-11-19 14:48:22.000000000 -0500
@@ -53,7 +53,7 @@
if ((hTab = GetDlgItem (hCurrent, IDC_PROPSHEET_TABCTRL)) != NULL)
{
int nTabs = TabCtrl_GetItemCount (hTab);
- TabCtrl_SetCurSel (hTab, nTabs-1);
+ TabCtrl_SetCurSel (hTab, (nTabs-1));
NMHDR nm;
nm.hwndFrom = hTab;
--- ./src/WINNT/afssvrmgr/helpfunc.cpp.~1~ 2000-11-04 05:02:04.000000000 -0500
+++ ./src/WINNT/afssvrmgr/helpfunc.cpp 2003-11-19 16:31:23.000000000 -0500
@@ -542,14 +566,14 @@
GetDlgItemText (hDlg, 0x051F, szSys, cchRESOURCE);
if ((dw = NextSearch (cmd)) != 0)
{
- for (LPTSTR psz = &szSys[ lstrlen(szSys)-1 ]; *(psz-1) != TEXT('\n'); --psz);
+ for (LPTSTR psz = &szSys[ lstrlen(szSys)-1 ]; *(psz-1) != TEXT('\n'); --psz) { /* empty */ }
lstrcpy (szSys2, psz);
wsprintf (psz, TEXT("%c%s"), (TCHAR)dw, szSys2);
SetDlgItemText (hDlg, 0x051F, szSys);
}
else // (dw == 0)
{
- for (LPTSTR psz = szSys; *psz && (*psz != TEXT('\n')); ++psz);
+ for (LPTSTR psz = szSys; *psz && (*psz != TEXT('\n')); ++psz) { /* empty */ }
wsprintf (szSys2, TEXT("%s\n"), 1+psz);
SetDlgItemText (hDlg, 0x051F, szSys2);
}
--- ./src/WINNT/afsusrmgr/helpfunc.cpp.~1~ 2000-11-04 05:02:26.000000000 -0500
+++ ./src/WINNT/afsusrmgr/helpfunc.cpp 2003-11-20 14:03:37.000000000 -0500
@@ -488,14 +512,14 @@
GetDlgItemText (hDlg, 0x07E6, szSys, cchRESOURCE);
if ((dw = NextSearch (cmd)) != 0)
{
- for (LPTSTR psz = &szSys[ lstrlen(szSys)-1 ]; *(psz-1) != TEXT('\n'); --psz);
+ for (LPTSTR psz = &szSys[ lstrlen(szSys)-1 ]; *(psz-1) != TEXT('\n'); --psz) { /* empty */ }
lstrcpy (szSys2, psz);
wsprintf (psz, TEXT("%c%s"), (TCHAR)dw, szSys2);
SetDlgItemText (hDlg, 0x07E6, szSys);
}
else // (dw == 0)
{
- for (LPTSTR psz = szSys; *psz && (*psz != TEXT('\n')); ++psz);
+ for (LPTSTR psz = szSys; *psz && (*psz != TEXT('\n')); ++psz) { /* empty */ }
wsprintf (szSys2, TEXT("%s\n"), 1+psz);
SetDlgItemText (hDlg, 0x07E6, szSys2);
}
--- ./src/WINNT/license/main.cpp.~1~ 2000-11-04 05:03:04.000000000 -0500
+++ ./src/WINNT/license/main.cpp 2003-11-19 08:39:39.000000000 -0500
@@ -25,7 +25,7 @@
namespace g
{
int CodePage;
- };
+ }
LPTSTR EscapeSpecialCharacters (LPTSTR pachIn, size_t cchIn)
--- ./src/bozo/bnode.c.~1~ 2003-07-15 19:14:42.000000000 -0400
+++ ./src/bozo/bnode.c 2003-11-20 13:42:32.000000000 -0500
@@ -470,7 +470,7 @@
abnode->goal = BSTAT_SHUTDOWN;
/* put the bnode at the end of the list so we write bnode file in same order */
- for (lb = &allBnodes, nb = *lb; nb; lb = &nb->next, nb = *lb);
+ for (lb = &allBnodes, nb = *lb; nb; lb = &nb->next, nb = *lb) { /* empty */ }
*lb = abnode;
return 0;
--- ./src/bozo/bos.c.~1~ 2003-08-08 16:27:58.000000000 -0400
+++ ./src/bozo/bos.c 2003-11-20 14:34:53.000000000 -0500
@@ -245,8 +238,9 @@
code = ktc_GetToken(&sname, &ttoken, sizeof(ttoken), NULL);
if (code == 0) {
/* have tickets, will travel */
- if (ttoken.kvno >= 0 && ttoken.kvno <= 255);
- else {
+ if (ttoken.kvno >= 0 && ttoken.kvno <= 255) {
+ /* empty */
+ } else {
fprintf(stderr,
"bos: funny kvno (%d) in ticket, proceeding\n",
ttoken.kvno);
--- ./src/bucoord/commands.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/commands.c 2003-11-20 14:34:18.000000000 -0500
@@ -178,21 +171,21 @@
srand(r);
/* Count number of servers, remove one at a time */
- for (scount = 0, ss = serverlist; ss; ss = ss->next, scount++);
+ for (scount = 0, ss = serverlist; ss; ss = ss->next, scount++) { /* empty */ }
for (; scount; scount--) {
/* Pick a random server in list and remove it */
r = (rand() >> 4) % scount;
for (pss = &serverlist, ss = serverlist; r;
- pss = &ss->next, ss = ss->next, r--);
+ pss = &ss->next, ss = ss->next, r--) { /* empty */ }
*pss = ss->next;
/* Count number of partitions, remove one at a time */
- for (pcount = 0, ps = ss->partitions; ps; ps = ps->next, pcount++);
+ for (pcount = 0, ps = ss->partitions; ps; ps = ps->next, pcount++) { /* empty */ }
for (; pcount; pcount--) {
/* Pick a random parition in list and remove it */
r = (rand() >> 4) % pcount;
for (pps = &ss->partitions, ps = ss->partitions; r;
- pps = &ps->next, ps = ps->next, r--);
+ pps = &ps->next, ps = ps->next, r--) { /* empty */ }
*pps = ps->next;
ps->lastvdlist->next = *avols;
--- ./src/bucoord/config.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/config.c 2003-11-20 13:37:54.000000000 -0500
@@ -114,7 +113,7 @@
/* add this guy to the end of the list */
tlast = alist;
- for (tentry = *tlast; tentry; tlast = &tentry->next, tentry = *tlast);
+ for (tentry = *tlast; tentry; tlast = &tentry->next, tentry = *tlast) { /* empty */ }
/* tlast now points to the next pointer (or head pointer) we should overwrite */
tentry = (struct bc_hostEntry *)malloc(sizeof(struct bc_hostEntry));
--- ./src/bucoord/dsvs.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/dsvs.c 2003-11-20 13:38:58.000000000 -0500
@@ -227,7 +222,7 @@
} else {
/* Add to end of list */
for (tlast = &aconfig->vset, tset = *tlast; tset;
- tlast = &tset->next, tset = *tlast);
+ tlast = &tset->next, tset = *tlast) { /* empty */ }
*tlast = nset;
}
return 0;
--- ./src/bucoord/dsvs.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/dsvs.c 2003-11-20 13:38:58.000000000 -0500
@@ -334,7 +329,7 @@
tlast = &tset->ventries;
/* move to end of the list */
- for (tentry = *tlast; tentry; tlast = &tentry->next, tentry = *tlast);
+ for (tentry = *tlast; tentry; tlast = &tentry->next, tentry = *tlast) { /* empty */ }
tentry = (struct bc_volumeEntry *)malloc(sizeof(struct bc_volumeEntry));
memset(tentry, 0, sizeof(*tentry));
tentry->serverName = (char *)malloc(strlen(ahost) + 1);
--- ./src/bucoord/dump.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/dump.c 2003-11-20 13:39:03.000000000 -0500
@@ -98,7 +95,7 @@
* build array of volumes to be sent to backup system
*/
for (count = 0, tde = dumpTaskPtr->volumes; tde;
- tde = tde->next, count++);
+ tde = tde->next, count++) { /* empty */ }
volDesc =
(struct tc_dumpDesc *)malloc(count * sizeof(struct tc_dumpDesc));
if (!volDesc) {
--- ./src/bucoord/regex.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/regex.c 2003-11-20 13:38:46.000000000 -0500
@@ -335,19 +335,19 @@
case CDOT | CSTAR:
curlp = lp;
- while (*lp++);
+ while (*lp++) { /* empty */ }
goto star;
case CCHR | CSTAR:
curlp = lp;
- while (*lp++ == *ep);
+ while (*lp++ == *ep) { /* empty */ }
ep++;
goto star;
case CCL | CSTAR:
case NCCL | CSTAR:
curlp = lp;
- while (cclass(ep, *lp++, ep[-1] == (CCL | CSTAR)));
+ while (cclass(ep, *lp++, ep[-1] == (CCL | CSTAR))) { /* empty */ }
ep += *ep;
goto star;
--- ./src/bucoord/vol_sets.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/vol_sets.c 2003-11-20 13:39:13.000000000 -0500
@@ -518,7 +515,7 @@
/* append to the end */
for (ppvs = &bc_globalConfig->vset, pvs = *ppvs; pvs;
- ppvs = &pvs->next, pvs = *ppvs);
+ ppvs = &pvs->next, pvs = *ppvs) { /* empty */ }
*ppvs = tvs;
tvs->next = (struct bc_volumeSet *)0;
} /*r */
--- ./src/bucoord/vol_sets.c.~1~ 2003-07-15 19:14:47.000000000 -0400
+++ ./src/bucoord/vol_sets.c 2003-11-20 13:39:13.000000000 -0500
@@ -587,7 +584,7 @@
*/
for (ppve = &tvs->ventries, pve = *ppve; pve;
- ppve = &pve->next, pve = *ppve);
+ ppve = &pve->next, pve = *ppve) { /* empty */ }
*ppve = tve;
tve->next = (struct bc_volumeEntry *)0;
}
--- ./src/budb/db_hash.c.~1~ 2003-07-15 19:14:48.000000000 -0400
+++ ./src/budb/db_hash.c 2003-11-20 13:37:32.000000000 -0500
@@ -313,7 +313,7 @@
b = *blocksP;
/* find an allocated block or the beginning of the block array */
- for (i = bi; (i > 0) && (b[i] == 0); i--);
+ for (i = bi; (i > 0) && (b[i] == 0); i--) { /* empty */ }
while (1) {
if (b[i] == 0) {
--- ./src/comerr/error_msg.c.~1~ 2003-07-15 19:14:53.000000000 -0400
+++ ./src/comerr/error_msg.c 2003-11-18 08:08:14.000000000 -0500
@@ -145,7 +145,7 @@
strcat(buffer, error_table_name(table_num));
strcat(buffer, " ");
}
- for (cp = buffer; *cp; cp++);
+ for (cp = buffer; *cp; cp++) { /* empty */ }
if (offset >= 100) {
*cp++ = '0' + offset / 100;
offset %= 100;
--- ./src/config/util_cr.c.~1~ 2003-07-15 19:14:56.000000000 -0400
+++ ./src/config/util_cr.c 2003-11-18 12:52:19.000000000 -0500
@@ -575,16 +579,16 @@
printf("format error parameter %s\n", argv[i]);
exit(0xc000);
}
- while (*++skey == ' ');
+ while (*++skey == ' ') { /* empty */ }
sval = strstr(skey, "=");
if (sval == NULL) {
printf("format error parameter %s\n", argv[i]);
exit(0xc000);
}
ptr = sval;
- while (*--ptr == ' ');
+ while (*--ptr == ' ') { /* empty */ }
*(ptr + 1) = 0;
- while (*++sval == ' ');
+ while (*++sval == ' ') { /* empty */ }
if (ptr = strstr(sval, "*DatE*")) { // ok so lets substitute date in this string;
char tmpbuf[32];
*(ptr) = 0;
--- ./src/des/strng_to_key.c.~1~ 2003-07-15 19:15:00.000000000 -0400
+++ ./src/des/strng_to_key.c 2003-11-18 08:10:33.000000000 -0500
@@ -88,7 +88,7 @@
else
*--p_char ^= (int)temp & 01;
temp = temp >> 1;
- } while (--j > 0);
+ }
/* check and flip direction */
if ((i % 8) == 0)
--- ./src/kauth/admin_tools.c.~1~ 2003-07-15 19:15:16.000000000 -0400
+++ ./src/kauth/admin_tools.c 2003-11-20 14:30:18.000000000 -0500
@@ -634,7 +634,7 @@
}
/* no point in doing this any sooner than necessary */
- for (i = 0; i < 4; misc_auth_bytes[i++] = 0);
+ for (i = 0; i < 4; misc_auth_bytes[i++] = 0) { /* empty */ }
if (as->parms[4].items) {
if (util_isint(as->parms[4].items->data))
--- ./src/libadmin/cfg/cfginternal.c.~1~ 2003-07-15 19:15:25.000000000 -0400
+++ ./src/libadmin/cfg/cfginternal.c 2003-11-20 13:39:48.000000000 -0500
@@ -481,7 +481,7 @@
int i;
/* assuming IPv4 addrs returned */
- for (i = 0; hentryp->h_addr_list[i] != NULL; i++);
+ for (i = 0; hentryp->h_addr_list[i] != NULL; i++) { /* empty */ }
aCount = i;
if ((aList =
--- ./src/libadmin/test/client.c.~1~ 2003-08-08 17:54:41.000000000 -0400
+++ ./src/libadmin/test/client.c 2003-11-20 14:39:43.000000000 -0500
@@ -428,7 +417,7 @@
int i;
size_t type_len = strlen(type);
- for (i = 0; (map[i].tag) && strncasecmp(type, map[i].tag, type_len); i++);
+ for (i = 0; (map[i].tag) && strncasecmp(type, map[i].tag, type_len); i++) { /* empty */ }
if (map[i].tag == 0) {
/*
--- ./src/rxgen/rpc_scan.c.~1~ 2003-10-24 02:26:14.000000000 -0400
+++ ./src/rxgen/rpc_scan.c 2003-11-18 09:50:19.000000000 -0500
@@ -453,7 +503,7 @@
}
}
tokp->kind = TOK_IDENT;
- for (len = 0; isalnum(str[len]) || str[len] == '_'; len++);
+ for (len = 0; isalnum(str[len]) || str[len] == '_'; len++) { /* empty */ }
tokp->str = alloc(len + 1);
(void)strncpy(tokp->str, str, len);
tokp->str[len] = 0;
--- ./src/rxgen/rpc_util.c.~1~ 2003-07-15 19:16:41.000000000 -0400
+++ ./src/rxgen/rpc_util.c 2003-11-18 09:46:56.000000000 -0500
@@ -134,7 +134,7 @@
list **l;
list *lst;
- for (l = lstp; *l != NULL; l = (list **) & (*l)->next);
+ for (l = lstp; *l != NULL; l = (list **) & (*l)->next) { /* empty */ }
lst = ALLOC(list);
lst->val = val;
lst->next = NULL;
--- ./src/rxgen/rpc_util.c.~1~ 2003-07-15 19:16:41.000000000 -0400
+++ ./src/rxgen/rpc_util.c 2003-11-18 09:46:56.000000000 -0500
@@ -412,7 +417,7 @@
{
token *sp;
- for (sp = tokstrings; sp->kind != TOK_EOF && sp->kind != kind; sp++);
+ for (sp = tokstrings; sp->kind != TOK_EOF && sp->kind != kind; sp++) { /* empty */ }
return (sp->str);
}
--- ./src/ubik/beacon.c.~1~ 2003-07-15 19:17:05.000000000 -0400
+++ ./src/ubik/beacon.c 2003-11-20 13:37:10.000000000 -0500
@@ -591,10 +591,10 @@
*/
for (start = 0, end = totalServers - 1; (start < end); start++, end--) {
/* find the first zero entry from the beginning */
- for (; (start < end) && (aservers[start]); start++);
+ for (; (start < end) && (aservers[start]); start++) { /* empty */ }
/* find the last non-zero entry from the end */
- for (; (end >= 0) && (!aservers[end]); end--);
+ for (; (end >= 0) && (!aservers[end]); end--) { /* empty */ }
/* if there is nothing more to purge, exit from loop */
if (start >= end)
--- ./src/util/regex.c.~1~ 2003-07-15 19:17:16.000000000 -0400
+++ ./src/util/regex.c 2003-11-18 13:26:58.000000000 -0500
@@ -352,19 +352,19 @@
case CDOT | CSTAR:
curlp = lp;
- while (*lp++);
+ while (*lp++) { /* empty */ }
goto star;
case CCHR | CSTAR:
curlp = lp;
- while (*lp++ == *ep);
+ while (*lp++ == *ep) { /* empty */ }
ep++;
goto star;
case CCL | CSTAR:
case NCCL | CSTAR:
curlp = lp;
- while (cclass(ep, *lp++, ep[-1] == (CCL | CSTAR)));
+ while (cclass(ep, *lp++, ep[-1] == (CCL | CSTAR))) { /* empty */ }
ep += *ep;
goto star;
--- ./src/vlserver/vlprocs.c.~1~ 2003-11-12 09:23:30.000000000 -0500
+++ ./src/vlserver/vlprocs.c 2003-11-20 13:37:25.000000000 -0500
@@ -2778,7 +2778,7 @@
return VL_DUPREPSERVER;
for (j = 0;
VlEntry->serverNumber[j] != BADSERVERID
- && j < OMAXNSERVERS; j++);
+ && j < OMAXNSERVERS; j++) { /* empty */ }
if (j >= OMAXNSERVERS)
return VL_REPSFULL;
if ((serverindex =
--- ./src/vol/vnode.c.~1~ 2003-07-15 19:17:40.000000000 -0400
+++ ./src/vol/vnode.c 2003-11-20 13:52:55.000000000 -0500
@@ -324,7 +327,7 @@
for (vnp = VnodeHashTable[newHash];
vnp && (vnp->vnodeNumber != vnodeNumber || vnp->volumePtr != vp
|| vnp->volumePtr->cacheCheck != vnp->cacheCheck);
- vnp = vnp->hashNext);
+ vnp = vnp->hashNext) { /* empty */ }
if (vnp) {
/* slot already exists. May even not be in lruq (consider store file locking a file being deleted)
* so we may have to wait for it below */
--- ./src/vol/vnode.c.~1~ 2003-07-15 19:17:40.000000000 -0400
+++ ./src/vol/vnode.c 2003-11-20 13:52:55.000000000 -0500
@@ -483,7 +486,7 @@
for (vnp = VnodeHashTable[newHash];
vnp && (vnp->vnodeNumber != vnodeNumber || vnp->volumePtr != vp
|| vnp->volumePtr->cacheCheck != vnp->cacheCheck);
- vnp = vnp->hashNext);
+ vnp = vnp->hashNext) { /* empty */ }
vcp->gets++;
if (vnp == NULL) {
int n;
--- ./src/volser/dumpstuff.c.~1~ 2003-08-25 22:59:20.000000000 -0400
+++ ./src/volser/dumpstuff.c 2003-11-20 13:53:35.000000000 -0500
@@ -233,7 +233,7 @@
break;
}
if (to[-1]) {
- while ((c = iod_getc(iodp)) && c != EOF);
+ while ((c = iod_getc(iodp)) && c != EOF) { /* empty */ }
to[-1] = 0;
}
}
--------------070304080506080705030004--