mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
Don't cast arguments to free()
free(3) is defined as: void free(void *ptr); so there is no need to cast the pointer argument being past to it to (char *), (void *), or whatever other randomness happened to be floating through the author's mind. Remove all such casts, as they are just noise. Change-Id: Ib7c8c259d53e9ce74fc486cb0997360044795395 Reviewed-on: http://gerrit.openafs.org/7453 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
8961793dbb
commit
d142c8f97a
@ -138,7 +138,7 @@ afsconf_fopen(const char *fname, const char *fmode)
|
||||
iop->buffer = malloc(BUFFER);
|
||||
if (iop->buffer == NULL) {
|
||||
(void) close(fd);
|
||||
free((void *) iop);
|
||||
free(iop);
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
@ -154,8 +154,8 @@ afsconf_fclose(afsconf_FILE *iop)
|
||||
return 0;
|
||||
}
|
||||
close(iop->_file);
|
||||
free((void *)iop->buffer);
|
||||
free((void *)iop);
|
||||
free(iop->buffer);
|
||||
free(iop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ EvalVolumeSet2(struct bc_config *aconfig,
|
||||
|
||||
/* Free memory allocated during VL call */
|
||||
if (bulkentries.nbulkentries_val) {
|
||||
free((char *)bulkentries.nbulkentries_val);
|
||||
free(bulkentries.nbulkentries_val);
|
||||
bulkentries.nbulkentries_val = 0;
|
||||
entries = 0;
|
||||
}
|
||||
@ -366,7 +366,7 @@ EvalVolumeSet2(struct bc_config *aconfig,
|
||||
|
||||
error_exit:
|
||||
if (bulkentries.nbulkentries_val) {
|
||||
free((char *)bulkentries.nbulkentries_val);
|
||||
free(bulkentries.nbulkentries_val);
|
||||
}
|
||||
return (code);
|
||||
} /*EvalVolumeSet2 */
|
||||
|
@ -307,7 +307,7 @@ parseServerList(struct cmd_item *itemPtr)
|
||||
ERROR(code);
|
||||
|
||||
/* free space for the server args */
|
||||
free((char *)serverArgs);
|
||||
free(serverArgs);
|
||||
|
||||
error_exit:
|
||||
return (code);
|
||||
|
@ -341,8 +341,8 @@ int ADMINAPI
|
||||
cfg_CellServDbStatusDeallocate(cfg_cellServDbStatus_t * statusItempP,
|
||||
afs_status_p st)
|
||||
{
|
||||
if ( statusItempP )
|
||||
free((void *)statusItempP);
|
||||
if ( statusItempP )
|
||||
free(statusItempP);
|
||||
|
||||
if (st != NULL) {
|
||||
*st = 0;
|
||||
|
@ -1206,7 +1206,7 @@ int ADMINAPI
|
||||
cfg_StringDeallocate(char *stringDataP, /* (multi)string to deallocate */
|
||||
afs_status_p st)
|
||||
{ /* completion status */
|
||||
free((void *)stringDataP);
|
||||
free(stringDataP);
|
||||
if (st != NULL) {
|
||||
*st = 0;
|
||||
}
|
||||
@ -1222,7 +1222,7 @@ int ADMINAPI
|
||||
cfg_PartitionListDeallocate(cfg_partitionEntry_t * partitionListDataP,
|
||||
afs_status_p st)
|
||||
{
|
||||
free((void *)partitionListDataP);
|
||||
free(partitionListDataP);
|
||||
if (st != NULL) {
|
||||
*st = 0;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ int LWP_CreateProcess(int (*funP)(), int stacksize, int priority, void *argP,
|
||||
|
||||
pcb->fiber = CreateFiber(stacksize, Enter_LWP, pcb);
|
||||
if (pcb->fiber == NULL) {
|
||||
free((void*)pcb);
|
||||
free(pcb);
|
||||
return LWP_EINIT;
|
||||
}
|
||||
Debug(0, ("Create: pcb=0x%p, funP=0x%p, argP=0x%p\n", pcb, funP, argP))
|
||||
@ -622,8 +622,8 @@ static void Free_PCB(PROCESS pid)
|
||||
if (pid->fiber != NULL) {
|
||||
DeleteFiber(pid->fiber);
|
||||
}
|
||||
if (pid->eventlist != NULL) free((void*)pid->eventlist);
|
||||
free((void*)pid);
|
||||
if (pid->eventlist != NULL) free(pid->eventlist);
|
||||
free(pid);
|
||||
}
|
||||
|
||||
static void Dispose_of_Dead_PCB(PROCESS cur)
|
||||
|
@ -46,7 +46,7 @@ IOMGR_AllocFDSet(void)
|
||||
void
|
||||
IOMGR_FreeFDSet(fd_set * fds)
|
||||
{
|
||||
free((char *)fds);
|
||||
free(fds);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -196,7 +196,7 @@ simplify_bitmap(struct bitmap *map)
|
||||
mp2->m_page);
|
||||
#endif
|
||||
*mpp = mp2->m_next;
|
||||
free((char *)mp2);
|
||||
free(mp2);
|
||||
} else
|
||||
mpp = &mp2->m_next;
|
||||
}
|
||||
@ -214,7 +214,7 @@ or_bitmap(struct bitmap *left, struct bitmap *right)
|
||||
for (i = 0; i < MDATA; ++i)
|
||||
lmap->m_data[i] |= rmap->m_data[i];
|
||||
*rightmp = rmap->m_next;
|
||||
free((char *)rmap);
|
||||
free(rmap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -237,14 +237,14 @@ and_bitmap(struct bitmap *left, struct bitmap *right)
|
||||
for (i = 0; i < MDATA; ++i)
|
||||
sig |= (lmap->m_data[i] &= rmap->m_data[i]);
|
||||
*rightmp = rmap->m_next;
|
||||
free((char *)rmap);
|
||||
free(rmap);
|
||||
break;
|
||||
}
|
||||
if (rmap && sig) {
|
||||
leftmp = &lmap->m_next;
|
||||
} else {
|
||||
*leftmp = lmap->m_next;
|
||||
free((char *)lmap);
|
||||
free(lmap);
|
||||
}
|
||||
}
|
||||
free_map((struct map *)right);
|
||||
@ -270,14 +270,14 @@ bic_bitmap(struct bitmap *left, struct bitmap *right)
|
||||
for (i = 0; i < MDATA; ++i)
|
||||
sig |= (lmap->m_data[i] &= ~rmap->m_data[i]);
|
||||
*rightmp = rmap->m_next;
|
||||
free((char *)rmap);
|
||||
free(rmap);
|
||||
break;
|
||||
}
|
||||
if (!rmap || sig) {
|
||||
leftmp = &lmap->m_next;
|
||||
} else {
|
||||
*leftmp = lmap->m_next;
|
||||
free((char *)lmap);
|
||||
free(lmap);
|
||||
}
|
||||
}
|
||||
free_map((struct map *)right);
|
||||
|
@ -123,7 +123,7 @@ popsource(void)
|
||||
fclose(source);
|
||||
source = sp->s_file;
|
||||
shead = sp->s_next;
|
||||
free((char *)sp);
|
||||
free(sp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ closedir(DIR * dir)
|
||||
|
||||
if (dir->h != INVALID_HANDLE_VALUE)
|
||||
FindClose(dir->h);
|
||||
free((void *)dir);
|
||||
free(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -354,9 +354,9 @@ inocleanup()
|
||||
if (inphead == NULL)
|
||||
return;
|
||||
for (inpp = &inpsort[inplast - 1]; inpp >= inpsort; inpp--)
|
||||
free((char *)(*inpp));
|
||||
free((char *)inphead);
|
||||
free((char *)inpsort);
|
||||
free(*inpp);
|
||||
free(inphead);
|
||||
free(inpsort);
|
||||
inphead = inpsort = NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -893,7 +893,7 @@ checkfilesys(filesys, parname)
|
||||
ckfini();
|
||||
free(blockmap);
|
||||
free(statemap);
|
||||
free((char *)lncntp);
|
||||
free(lncntp);
|
||||
lncntp = NULL;
|
||||
blockmap = statemap = NULL;
|
||||
#ifdef AFS_SUN5_ENV
|
||||
|
@ -96,7 +96,7 @@ pass4()
|
||||
zlnp->zlncnt = zlnhead->zlncnt;
|
||||
zlnp = zlnhead;
|
||||
zlnhead = zlnhead->next;
|
||||
free((char *)zlnp);
|
||||
free(zlnp);
|
||||
clri(&idesc, "UNREF", 1);
|
||||
break;
|
||||
}
|
||||
@ -176,7 +176,7 @@ pass4check(idesc)
|
||||
dlp->dup = duplist->dup;
|
||||
dlp = duplist;
|
||||
duplist = duplist->next;
|
||||
free((char *)dlp);
|
||||
free(dlp);
|
||||
break;
|
||||
}
|
||||
if (dlp == 0) {
|
||||
|
@ -364,7 +364,7 @@ ckfini()
|
||||
flush(fswritefd, bp);
|
||||
nbp = bp->b_prev;
|
||||
free(bp->b_un.b_buf);
|
||||
free((char *)bp);
|
||||
free(bp);
|
||||
}
|
||||
#ifdef AFS_SUN5_ENVX
|
||||
pbp = pdirbp = NULL;
|
||||
|
@ -999,7 +999,7 @@ h_Enumerate(int (*proc) (struct host*, void *), void *param)
|
||||
}
|
||||
H_UNLOCK;
|
||||
}
|
||||
free((void *)list);
|
||||
free(list);
|
||||
} /* h_Enumerate */
|
||||
|
||||
|
||||
|
@ -535,7 +535,7 @@ handleit(struct cmd_syndesc *as, void *arock)
|
||||
for (i = 0; i < nentries; i++, entry++)
|
||||
display_entry(entry, 0);
|
||||
if (entries.bulkentries_val)
|
||||
free((char *)entries.bulkentries_val);
|
||||
free(entries.bulkentries_val);
|
||||
} else if (!strcmp(oper, "lan2")) {
|
||||
int nentries, i, si, nsi, t = 0;
|
||||
nbulkentries entries;
|
||||
@ -572,7 +572,7 @@ handleit(struct cmd_syndesc *as, void *arock)
|
||||
for (i = 0; i < nentries; i++, entry++)
|
||||
display_entryN(entry, 0);
|
||||
if (entries.nbulkentries_val)
|
||||
free((char *)entries.nbulkentries_val);
|
||||
free(entries.nbulkentries_val);
|
||||
}
|
||||
printf("--- %d volumes ---\n", t);
|
||||
} else if (!strcmp(oper, "ln")) {
|
||||
@ -617,7 +617,7 @@ handleit(struct cmd_syndesc *as, void *arock)
|
||||
for (vllist = linkedvldbs.node; vllist; vllist = vllist1) {
|
||||
vllist1 = vllist->next_vldb;
|
||||
display_entry((struct vldbentry *)&vllist->VldbEntry, 0);
|
||||
free((char *)vllist);
|
||||
free(vllist);
|
||||
}
|
||||
} else if (!strcmp(oper, "di")) {
|
||||
sscanf(&(*argp)[0], "%d", &id);
|
||||
@ -743,7 +743,7 @@ handleit(struct cmd_syndesc *as, void *arock)
|
||||
printf("[0x%x %u] %s\n", *addrp, *addrp,
|
||||
hostutil_GetNameByINet(ntohl(*addrp)));
|
||||
}
|
||||
free((char *)addrs.bulkaddrs_val);
|
||||
free(addrs.bulkaddrs_val);
|
||||
} else if (!strcmp(oper, "gau")) {
|
||||
int nentries, i, j;
|
||||
afs_uint32 *addrp;
|
||||
@ -799,13 +799,13 @@ handleit(struct cmd_syndesc *as, void *arock)
|
||||
hostutil_GetNameByINet(mhaddrp[j]));
|
||||
}
|
||||
if (mhaddrs.bulkaddrs_val)
|
||||
free((char *)mhaddrs.bulkaddrs_val);
|
||||
free(mhaddrs.bulkaddrs_val);
|
||||
} else {
|
||||
printf("[0x%x %u] %s\n", *addrp, *addrp,
|
||||
hostutil_GetNameByINet(ntohl(*addrp)));
|
||||
}
|
||||
}
|
||||
free((char *)addrs.bulkaddrs_val);
|
||||
free(addrs.bulkaddrs_val);
|
||||
} else if (!strcmp(oper, "mhc")) {
|
||||
afs_uint32 serveraddrs[MAXSERVERID + 1][VL_MAXIPADDRS_PERMH];
|
||||
afs_int32 serveraddrtype[MAXSERVERID + 1];
|
||||
@ -860,7 +860,7 @@ handleit(struct cmd_syndesc *as, void *arock)
|
||||
for (j = 0; j < nentries2; j++) {
|
||||
serveraddrs[i][j] = ntohl(addrp2[j]);
|
||||
}
|
||||
free((char *)addrs2.bulkaddrs_val);
|
||||
free(addrs2.bulkaddrs_val);
|
||||
}
|
||||
|
||||
if (nargs) {
|
||||
@ -875,7 +875,7 @@ handleit(struct cmd_syndesc *as, void *arock)
|
||||
}
|
||||
}
|
||||
}
|
||||
free((char *)addrs1.bulkaddrs_val);
|
||||
free(addrs1.bulkaddrs_val);
|
||||
|
||||
/* Look for any duplicates */
|
||||
for (i = 0; i < MAXSERVERID + 1; i++) {
|
||||
|
@ -1760,7 +1760,7 @@ SVL_ListAttributesN2(struct rx_call *rxcall,
|
||||
countAbort(this_op);
|
||||
ubik_AbortTrans(ctx.trans);
|
||||
if (vldbentries->nbulkentries_val)
|
||||
free((char *)vldbentries->nbulkentries_val);
|
||||
free(vldbentries->nbulkentries_val);
|
||||
vldbentries->nbulkentries_val = 0;
|
||||
vldbentries->nbulkentries_len = 0;
|
||||
*nextstartindex = -1;
|
||||
|
@ -757,7 +757,7 @@ xfs_ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile,
|
||||
|
||||
closedir(top_dirp);
|
||||
if (renames)
|
||||
free((char *)renames);
|
||||
free(renames);
|
||||
if (inodeFile != INVALID_FD) {
|
||||
if (OS_SYNC(inodeFile) == -1) {
|
||||
Log("Unable to successfully fsync inode file for %s\n", mountedOn);
|
||||
@ -787,7 +787,7 @@ xfs_ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile,
|
||||
if (top_dirp)
|
||||
closedir(top_dirp);
|
||||
if (renames)
|
||||
free((char *)renames);
|
||||
free(renames);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -6489,7 +6489,7 @@ VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class)
|
||||
vip->bitmap = BitMap;
|
||||
vip->bitmapOffset = 0;
|
||||
} else
|
||||
free((byte *) BitMap);
|
||||
free(BitMap);
|
||||
#endif /* BITMAP_LATER */
|
||||
#ifdef AFS_DEMAND_ATTACH_FS
|
||||
VChangeState_r(vp, state_save);
|
||||
|
@ -1295,9 +1295,9 @@ RestoreVolume(struct rx_call *call, Volume * avp, int incremental,
|
||||
out:
|
||||
/* Free the malloced space above */
|
||||
if (b1)
|
||||
free((char *)b1);
|
||||
free(b1);
|
||||
if (b2)
|
||||
free((char *)b2);
|
||||
free(b2);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user