bos: Don't cast returns from malloc()

malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it's
unecessary noise.

Change-Id: If6f0dbc00b31f5d9a1622984c6ac9eba83c04900
Reviewed-on: http://gerrit.openafs.org/7459
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Simon Wilkinson 2012-05-17 10:03:16 +01:00 committed by Derrick Brashear
parent 25bc7849ca
commit 0cf3c58d80
4 changed files with 18 additions and 19 deletions

View File

@ -911,8 +911,7 @@ bnode_ParseLine(char *aline, struct bnode_token **alist)
if (inToken) { if (inToken) {
inToken = 0; /* end of this token */ inToken = 0; /* end of this token */
*tptr++ = 0; *tptr++ = 0;
ttok = ttok = malloc(sizeof(struct bnode_token));
(struct bnode_token *)malloc(sizeof(struct bnode_token));
ttok->next = (struct bnode_token *)0; ttok->next = (struct bnode_token *)0;
ttok->key = strdup(tbuffer); ttok->key = strdup(tbuffer);
if (last) { if (last) {

View File

@ -396,7 +396,7 @@ SBOZO_GetCellName(struct rx_call *acall, char **aname)
code = afsconf_GetLocalCell(bozo_confdir, tname, sizeof(tname)); code = afsconf_GetLocalCell(bozo_confdir, tname, sizeof(tname));
if (code) { if (code) {
/* must set output parameters even if aborting */ /* must set output parameters even if aborting */
*aname = (char *)malloc(1); *aname = malloc(1);
**aname = 0; **aname = 0;
} else { } else {
*aname = strdup(tname); *aname = strdup(tname);
@ -432,7 +432,7 @@ SBOZO_GetCellHost(struct rx_call *acall, afs_uint32 awhich, char **aname)
goto done; goto done;
fail: fail:
*aname = (char *)malloc(1); /* return fake string */ *aname = malloc(1); /* return fake string */
**aname = 0; **aname = 0;
done: done:
@ -697,7 +697,7 @@ SBOZO_ListSUsers(struct rx_call *acall, afs_int32 an, char **aname)
afs_int32 code; afs_int32 code;
char *tp; char *tp;
tp = *aname = (char *)malloc(256); tp = *aname = malloc(256);
*tp = 0; /* in case getnthuser doesn't null-terminate the string */ *tp = 0; /* in case getnthuser doesn't null-terminate the string */
code = afsconf_GetNthUser(bozo_confdir, an, tp, 256); code = afsconf_GetNthUser(bozo_confdir, an, tp, 256);
@ -1101,7 +1101,7 @@ SBOZO_GetStatus(struct rx_call *acall, char *ainstance, afs_int32 *astat,
goto fail; goto fail;
} }
*astatDescr = (char *)malloc(BOZO_BSSIZE); *astatDescr = malloc(BOZO_BSSIZE);
code = bnode_GetString(tb, *astatDescr, BOZO_BSSIZE); code = bnode_GetString(tb, *astatDescr, BOZO_BSSIZE);
bnode_Release(tb); bnode_Release(tb);
if (code) if (code)
@ -1109,7 +1109,7 @@ SBOZO_GetStatus(struct rx_call *acall, char *ainstance, afs_int32 *astat,
return 0; return 0;
fail: fail:
*astatDescr = (char *)malloc(1); *astatDescr = malloc(1);
**astatDescr = 0; **astatDescr = 0;
return code; return code;
} }
@ -1205,7 +1205,7 @@ SBOZO_EnumerateInstance(struct rx_call *acall, afs_int32 anum,
{ {
struct eidata tdata; struct eidata tdata;
*ainstance = (char *)malloc(BOZO_BSSIZE); *ainstance = malloc(BOZO_BSSIZE);
**ainstance = 0; **ainstance = 0;
tdata.counter = anum; tdata.counter = anum;
tdata.iname = *ainstance; tdata.iname = *ainstance;
@ -1343,7 +1343,7 @@ SBOZO_GetInstanceInfo(IN struct rx_call *acall,
struct bnode *tb; struct bnode *tb;
tb = bnode_FindInstance(ainstance); tb = bnode_FindInstance(ainstance);
*atype = (char *)malloc(BOZO_BSSIZE); *atype = malloc(BOZO_BSSIZE);
**atype = 0; **atype = 0;
if (!tb) if (!tb)
return BZNOENT; return BZNOENT;
@ -1379,7 +1379,7 @@ SBOZO_GetInstanceParm(struct rx_call *acall,
char *tp; char *tp;
afs_int32 code; afs_int32 code;
tp = (char *)malloc(BOZO_BSSIZE); tp = malloc(BOZO_BSSIZE);
*aparm = tp; *aparm = tp;
*tp = 0; /* null-terminate string in error case */ *tp = 0; /* null-terminate string in error case */
tb = bnode_FindInstance(ainstance); tb = bnode_FindInstance(ainstance);
@ -1470,11 +1470,11 @@ SBOZO_GetInstanceStrings(struct rx_call *acall, char *abnodeName,
{ {
struct bnode *tb; struct bnode *tb;
*as2 = (char *)malloc(1); *as2 = malloc(1);
**as2 = 0; **as2 = 0;
*as3 = (char *)malloc(1); *as3 = malloc(1);
**as3 = 0; **as3 = 0;
*as4 = (char *)malloc(1); *as4 = malloc(1);
**as4 = 0; **as4 = 0;
tb = bnode_FindInstance(abnodeName); tb = bnode_FindInstance(abnodeName);
if (!tb) if (!tb)
@ -1484,13 +1484,13 @@ SBOZO_GetInstanceStrings(struct rx_call *acall, char *abnodeName,
if (tb->lastErrorName) { if (tb->lastErrorName) {
*as1 = strdup(tb->lastErrorName); *as1 = strdup(tb->lastErrorName);
} else { } else {
*as1 = (char *)malloc(1); *as1 = malloc(1);
**as1 = 0; **as1 = 0;
} }
return 0; return 0;
fail: fail:
*as1 = (char *)malloc(1); *as1 = malloc(1);
**as1 = 0; **as1 = 0;
return BZNOENT; return BZNOENT;
} }

View File

@ -392,7 +392,7 @@ ReadBozoFile(char *aname)
goto fail; /* no "parm " either */ goto fail; /* no "parm " either */
} }
if (!parms[i]) /* make sure there's space */ if (!parms[i]) /* make sure there's space */
parms[i] = (char *)malloc(BOZO_BSSIZE); parms[i] = malloc(BOZO_BSSIZE);
strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */ strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */
thisparms[i] = parms[i]; thisparms[i] = parms[i];
} }

View File

@ -40,9 +40,9 @@ main(int argc, char **argv)
time_t procStartTime = -1, rsTime = -1, lastAnyExit = -1, lastErrorExit = -1; time_t procStartTime = -1, rsTime = -1, lastAnyExit = -1, lastErrorExit = -1;
char *timeStamp; char *timeStamp;
typep = (char *)malloc(50); typep = malloc(50);
cmd = (char *)malloc(50); cmd = malloc(50);
bufp = bufp1 = (char *)malloc(1000); bufp = bufp1 = malloc(1000);
while (fgets(buf, sizeof(buf), fin)) { while (fgets(buf, sizeof(buf), fin)) {
code = sscanf(buf, "%s %s\n", typep, cmd); code = sscanf(buf, "%s %s\n", typep, cmd);
if (code < 2) { if (code < 2) {