mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
lwp: 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 is unnecessary noise. Change-Id: Ie41f7b831f0ba70796649e2493e014fe44f1c39e Reviewed-on: http://gerrit.openafs.org/7467 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
3613d41515
commit
900f7cc5f7
@ -158,7 +158,7 @@ fd_set *IOMGR_AllocFDSet(void)
|
||||
iomgrFreeFDSets = iomgrFreeFDSets->next;
|
||||
}
|
||||
else {
|
||||
t = (struct IOMGR_fd_set *)malloc(sizeof(fd_set));
|
||||
t = malloc(sizeof(fd_set));
|
||||
}
|
||||
if (!t)
|
||||
return (fd_set*)0;
|
||||
|
@ -281,7 +281,7 @@ LWP_CreateProcess(void *(*ep) (void *), int stacksize, int priority, void *parm,
|
||||
/* Throw away all dead process control blocks */
|
||||
purge_dead_pcbs();
|
||||
if (lwp_init) {
|
||||
temp = (PROCESS) malloc(sizeof(struct lwp_pcb));
|
||||
temp = malloc(sizeof(struct lwp_pcb));
|
||||
if (temp == NULL) {
|
||||
Set_LWP_RC();
|
||||
return LWP_ENOMEM;
|
||||
@ -337,9 +337,9 @@ LWP_CreateProcess(void *(*ep) (void *), int stacksize, int priority, void *parm,
|
||||
stackmemory = stackptr;
|
||||
#else
|
||||
#ifdef AFS_DARWIN_ENV
|
||||
if ((stackmemory = (char *)malloc(stacksize + STACK_ALIGN - 1)) == NULL)
|
||||
if ((stackmemory = malloc(stacksize + STACK_ALIGN - 1)) == NULL)
|
||||
#else /* !AFS_DARWIN_ENV */
|
||||
if ((stackmemory = (char *)malloc(stacksize + 7)) == NULL)
|
||||
if ((stackmemory = malloc(stacksize + 7)) == NULL)
|
||||
#endif /* !AFS_DARWIN_ENV */
|
||||
{
|
||||
Set_LWP_RC();
|
||||
@ -434,7 +434,7 @@ LWP_CreateProcess2(void *(*ep) (void *), int stacksize, int priority, void *parm
|
||||
/* Throw away all dead process control blocks */
|
||||
purge_dead_pcbs();
|
||||
if (lwp_init) {
|
||||
temp = (PROCESS) malloc(sizeof(struct lwp_pcb));
|
||||
temp = malloc(sizeof(struct lwp_pcb));
|
||||
if (temp == NULL) {
|
||||
Set_LWP_RC();
|
||||
return LWP_ENOMEM;
|
||||
@ -444,7 +444,7 @@ LWP_CreateProcess2(void *(*ep) (void *), int stacksize, int priority, void *parm
|
||||
else
|
||||
stacksize =
|
||||
STACK_ALIGN * ((stacksize + STACK_ALIGN - 1) / STACK_ALIGN);
|
||||
if ((stackptr = (char *)malloc(stacksize)) == NULL) {
|
||||
if ((stackptr = malloc(stacksize)) == NULL) {
|
||||
Set_LWP_RC();
|
||||
return LWP_ENOMEM;
|
||||
}
|
||||
@ -614,8 +614,8 @@ LWP_InitializeProcessSupport(int priority, PROCESS * pid)
|
||||
blocked.count = 0;
|
||||
qwaiting.head = NULL;
|
||||
qwaiting.count = 0;
|
||||
lwp_init = (struct lwp_ctl *)malloc(sizeof(struct lwp_ctl));
|
||||
temp = (PROCESS) malloc(sizeof(struct lwp_pcb));
|
||||
lwp_init = malloc(sizeof(struct lwp_ctl));
|
||||
temp = malloc(sizeof(struct lwp_pcb));
|
||||
if (lwp_init == NULL || temp == NULL)
|
||||
Abort_LWP("Insufficient Storage to Initialize LWP Support");
|
||||
LWPANCHOR.processcnt = 1;
|
||||
@ -1032,7 +1032,7 @@ Initialize_PCB(PROCESS temp, int priority, char *stack, int stacksize,
|
||||
i++;
|
||||
temp->name[31] = '\0';
|
||||
temp->status = READY;
|
||||
temp->eventlist = (void **)malloc(EVINITSIZE * sizeof(void *));
|
||||
temp->eventlist = malloc(EVINITSIZE * sizeof(void *));
|
||||
temp->eventlistsize = EVINITSIZE;
|
||||
temp->eventcnt = 0;
|
||||
temp->wakevent = 0;
|
||||
|
@ -147,7 +147,7 @@ int LWP_InitializeProcessSupport(int priority, PROCESS *pid)
|
||||
|
||||
if (priority >= MAX_PRIORITIES) return LWP_EBADPRI;
|
||||
|
||||
pcb = (PROCESS)malloc(sizeof(*pcb));
|
||||
pcb = malloc(sizeof(*pcb));
|
||||
if (pcb == NULL)
|
||||
Abort_LWP("Insufficient Storage to Initialize LWP PCB");
|
||||
(void) memset((void*)pcb, 0, sizeof(*pcb));
|
||||
@ -155,7 +155,7 @@ int LWP_InitializeProcessSupport(int priority, PROCESS *pid)
|
||||
if (pcb == NULL)
|
||||
Abort_LWP("Cannot convert main thread to LWP fiber");
|
||||
|
||||
lwp_init = (struct lwp_ctl *) malloc(sizeof(struct lwp_ctl));
|
||||
lwp_init = malloc(sizeof(struct lwp_ctl));
|
||||
if (lwp_init == NULL)
|
||||
Abort_LWP("Insufficient Storage to Initialize LWP CTL");
|
||||
(void) memset((void*)lwp_init, 0, sizeof(struct lwp_ctl));
|
||||
@ -213,7 +213,7 @@ int LWP_CreateProcess(int (*funP)(), int stacksize, int priority, void *argP,
|
||||
|
||||
purge_dead_pcbs();
|
||||
|
||||
pcb = (PROCESS)malloc(sizeof(*pcb));
|
||||
pcb = malloc(sizeof(*pcb));
|
||||
if (pcb == NULL)
|
||||
return LWP_ENOMEM;
|
||||
(void) memset((void*)pcb, 0, sizeof(*pcb));
|
||||
@ -485,7 +485,7 @@ static void Initialize_PCB(PROCESS pcb, int priority, int stacksize,
|
||||
pcb->funP = funP;
|
||||
pcb->argP = argP;
|
||||
pcb->status = READY;
|
||||
pcb->eventlist = (void**)malloc(EVINITSIZE*sizeof(void*));
|
||||
pcb->eventlist = malloc(EVINITSIZE*sizeof(void*));
|
||||
pcb->eventlistsize = pcb->eventlist ? EVINITSIZE : 0;
|
||||
pcb->eventcnt = 0;
|
||||
pcb->wakevent = 0;
|
||||
|
@ -39,7 +39,7 @@ init()
|
||||
{
|
||||
queue *q;
|
||||
|
||||
q = (queue *) malloc(sizeof(queue));
|
||||
q = malloc(sizeof(queue));
|
||||
q->prev = q->next = q;
|
||||
return (q);
|
||||
}
|
||||
@ -55,7 +55,7 @@ insert(queue * q, char *s)
|
||||
{
|
||||
queue *new;
|
||||
|
||||
new = (queue *) malloc(sizeof(queue));
|
||||
new = malloc(sizeof(queue));
|
||||
new->data = s;
|
||||
new->prev = q->prev;
|
||||
q->prev->next = new;
|
||||
|
@ -242,9 +242,9 @@ sendTest(int sockFD, int delay, int reqOOB, int size)
|
||||
selcmd_t selCmd;
|
||||
time_t stime, etime;
|
||||
|
||||
buf = (char *)malloc(size);
|
||||
buf = malloc(size);
|
||||
assert(buf);
|
||||
bufTest = (char *)malloc(size);
|
||||
bufTest = malloc(size);
|
||||
assert(bufTest);
|
||||
|
||||
for (j = i = 0; i < size; i++, j++) {
|
||||
|
@ -376,7 +376,7 @@ handleWrite(clientHandle_t * ch, selcmd_t * sc)
|
||||
if (sc->sc_flags & SC_WAIT_OOB)
|
||||
sendOOB(ch->ch_fd);
|
||||
|
||||
buf = (char *)malloc(sc->sc_info);
|
||||
buf = malloc(sc->sc_info);
|
||||
assert(buf);
|
||||
i = 0;
|
||||
|
||||
|
@ -165,7 +165,7 @@ int LWP_CreateProcess(ep, stacksize, priority, parm, name, pid)
|
||||
/* Throw away all dead process control blocks */
|
||||
purge_dead_pcbs();
|
||||
if (lwp_init) {
|
||||
temp = (PROCESS) malloc (sizeof (struct lwp_pcb));
|
||||
temp = malloc (sizeof (struct lwp_pcb));
|
||||
if (temp == NULL) {
|
||||
Set_LWP_RC();
|
||||
return LWP_ENOMEM;
|
||||
@ -174,7 +174,7 @@ int LWP_CreateProcess(ep, stacksize, priority, parm, name, pid)
|
||||
stacksize = 1000;
|
||||
else
|
||||
stacksize = 4 * ((stacksize+3) / 4);
|
||||
if ((stackptr = (char *) malloc(stacksize)) == NULL) {
|
||||
if ((stackptr = malloc(stacksize)) == NULL) {
|
||||
Set_LWP_RC();
|
||||
return LWP_ENOMEM;
|
||||
}
|
||||
@ -293,8 +293,8 @@ int LWP_InitializeProcessSupport(priority, pid)
|
||||
}
|
||||
blocked.head = NULL;
|
||||
blocked.count = 0;
|
||||
lwp_init = (struct lwp_ctl *) malloc(sizeof(struct lwp_ctl));
|
||||
temp = (PROCESS) malloc(sizeof(struct lwp_pcb));
|
||||
lwp_init = malloc(sizeof(struct lwp_ctl));
|
||||
temp = malloc(sizeof(struct lwp_pcb));
|
||||
if (lwp_init == NULL || temp == NULL)
|
||||
Abort_LWP("Insufficient Storage to Initialize LWP Support");
|
||||
LWPANCHOR.processcnt = 1;
|
||||
|
@ -37,7 +37,7 @@ typedef unsigned char bool;
|
||||
|
||||
#define expiration TotalTime
|
||||
|
||||
#define new_elem() ((struct TM_Elem *) malloc(sizeof(struct TM_Elem)))
|
||||
#define new_elem() (malloc(sizeof(struct TM_Elem)))
|
||||
|
||||
#define MILLION 1000000
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user