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:
Simon Wilkinson 2012-05-17 12:33:28 +01:00 committed by Derrick Brashear
parent 3613d41515
commit 900f7cc5f7
8 changed files with 23 additions and 23 deletions

View File

@ -158,7 +158,7 @@ fd_set *IOMGR_AllocFDSet(void)
iomgrFreeFDSets = iomgrFreeFDSets->next; iomgrFreeFDSets = iomgrFreeFDSets->next;
} }
else { else {
t = (struct IOMGR_fd_set *)malloc(sizeof(fd_set)); t = malloc(sizeof(fd_set));
} }
if (!t) if (!t)
return (fd_set*)0; return (fd_set*)0;

View File

@ -281,7 +281,7 @@ LWP_CreateProcess(void *(*ep) (void *), int stacksize, int priority, void *parm,
/* Throw away all dead process control blocks */ /* Throw away all dead process control blocks */
purge_dead_pcbs(); purge_dead_pcbs();
if (lwp_init) { if (lwp_init) {
temp = (PROCESS) malloc(sizeof(struct lwp_pcb)); temp = malloc(sizeof(struct lwp_pcb));
if (temp == NULL) { if (temp == NULL) {
Set_LWP_RC(); Set_LWP_RC();
return LWP_ENOMEM; return LWP_ENOMEM;
@ -337,9 +337,9 @@ LWP_CreateProcess(void *(*ep) (void *), int stacksize, int priority, void *parm,
stackmemory = stackptr; stackmemory = stackptr;
#else #else
#ifdef AFS_DARWIN_ENV #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 */ #else /* !AFS_DARWIN_ENV */
if ((stackmemory = (char *)malloc(stacksize + 7)) == NULL) if ((stackmemory = malloc(stacksize + 7)) == NULL)
#endif /* !AFS_DARWIN_ENV */ #endif /* !AFS_DARWIN_ENV */
{ {
Set_LWP_RC(); 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 */ /* Throw away all dead process control blocks */
purge_dead_pcbs(); purge_dead_pcbs();
if (lwp_init) { if (lwp_init) {
temp = (PROCESS) malloc(sizeof(struct lwp_pcb)); temp = malloc(sizeof(struct lwp_pcb));
if (temp == NULL) { if (temp == NULL) {
Set_LWP_RC(); Set_LWP_RC();
return LWP_ENOMEM; return LWP_ENOMEM;
@ -444,7 +444,7 @@ LWP_CreateProcess2(void *(*ep) (void *), int stacksize, int priority, void *parm
else else
stacksize = stacksize =
STACK_ALIGN * ((stacksize + STACK_ALIGN - 1) / STACK_ALIGN); STACK_ALIGN * ((stacksize + STACK_ALIGN - 1) / STACK_ALIGN);
if ((stackptr = (char *)malloc(stacksize)) == NULL) { if ((stackptr = malloc(stacksize)) == NULL) {
Set_LWP_RC(); Set_LWP_RC();
return LWP_ENOMEM; return LWP_ENOMEM;
} }
@ -614,8 +614,8 @@ LWP_InitializeProcessSupport(int priority, PROCESS * pid)
blocked.count = 0; blocked.count = 0;
qwaiting.head = NULL; qwaiting.head = NULL;
qwaiting.count = 0; qwaiting.count = 0;
lwp_init = (struct lwp_ctl *)malloc(sizeof(struct lwp_ctl)); lwp_init = malloc(sizeof(struct lwp_ctl));
temp = (PROCESS) malloc(sizeof(struct lwp_pcb)); temp = malloc(sizeof(struct lwp_pcb));
if (lwp_init == NULL || temp == NULL) if (lwp_init == NULL || temp == NULL)
Abort_LWP("Insufficient Storage to Initialize LWP Support"); Abort_LWP("Insufficient Storage to Initialize LWP Support");
LWPANCHOR.processcnt = 1; LWPANCHOR.processcnt = 1;
@ -1032,7 +1032,7 @@ Initialize_PCB(PROCESS temp, int priority, char *stack, int stacksize,
i++; i++;
temp->name[31] = '\0'; temp->name[31] = '\0';
temp->status = READY; temp->status = READY;
temp->eventlist = (void **)malloc(EVINITSIZE * sizeof(void *)); temp->eventlist = malloc(EVINITSIZE * sizeof(void *));
temp->eventlistsize = EVINITSIZE; temp->eventlistsize = EVINITSIZE;
temp->eventcnt = 0; temp->eventcnt = 0;
temp->wakevent = 0; temp->wakevent = 0;

View File

@ -147,7 +147,7 @@ int LWP_InitializeProcessSupport(int priority, PROCESS *pid)
if (priority >= MAX_PRIORITIES) return LWP_EBADPRI; if (priority >= MAX_PRIORITIES) return LWP_EBADPRI;
pcb = (PROCESS)malloc(sizeof(*pcb)); pcb = malloc(sizeof(*pcb));
if (pcb == NULL) if (pcb == NULL)
Abort_LWP("Insufficient Storage to Initialize LWP PCB"); Abort_LWP("Insufficient Storage to Initialize LWP PCB");
(void) memset((void*)pcb, 0, sizeof(*pcb)); (void) memset((void*)pcb, 0, sizeof(*pcb));
@ -155,7 +155,7 @@ int LWP_InitializeProcessSupport(int priority, PROCESS *pid)
if (pcb == NULL) if (pcb == NULL)
Abort_LWP("Cannot convert main thread to LWP fiber"); 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) if (lwp_init == NULL)
Abort_LWP("Insufficient Storage to Initialize LWP CTL"); Abort_LWP("Insufficient Storage to Initialize LWP CTL");
(void) memset((void*)lwp_init, 0, sizeof(struct 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(); purge_dead_pcbs();
pcb = (PROCESS)malloc(sizeof(*pcb)); pcb = malloc(sizeof(*pcb));
if (pcb == NULL) if (pcb == NULL)
return LWP_ENOMEM; return LWP_ENOMEM;
(void) memset((void*)pcb, 0, sizeof(*pcb)); (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->funP = funP;
pcb->argP = argP; pcb->argP = argP;
pcb->status = READY; pcb->status = READY;
pcb->eventlist = (void**)malloc(EVINITSIZE*sizeof(void*)); pcb->eventlist = malloc(EVINITSIZE*sizeof(void*));
pcb->eventlistsize = pcb->eventlist ? EVINITSIZE : 0; pcb->eventlistsize = pcb->eventlist ? EVINITSIZE : 0;
pcb->eventcnt = 0; pcb->eventcnt = 0;
pcb->wakevent = 0; pcb->wakevent = 0;

View File

@ -39,7 +39,7 @@ init()
{ {
queue *q; queue *q;
q = (queue *) malloc(sizeof(queue)); q = malloc(sizeof(queue));
q->prev = q->next = q; q->prev = q->next = q;
return (q); return (q);
} }
@ -55,7 +55,7 @@ insert(queue * q, char *s)
{ {
queue *new; queue *new;
new = (queue *) malloc(sizeof(queue)); new = malloc(sizeof(queue));
new->data = s; new->data = s;
new->prev = q->prev; new->prev = q->prev;
q->prev->next = new; q->prev->next = new;

View File

@ -242,9 +242,9 @@ sendTest(int sockFD, int delay, int reqOOB, int size)
selcmd_t selCmd; selcmd_t selCmd;
time_t stime, etime; time_t stime, etime;
buf = (char *)malloc(size); buf = malloc(size);
assert(buf); assert(buf);
bufTest = (char *)malloc(size); bufTest = malloc(size);
assert(bufTest); assert(bufTest);
for (j = i = 0; i < size; i++, j++) { for (j = i = 0; i < size; i++, j++) {

View File

@ -376,7 +376,7 @@ handleWrite(clientHandle_t * ch, selcmd_t * sc)
if (sc->sc_flags & SC_WAIT_OOB) if (sc->sc_flags & SC_WAIT_OOB)
sendOOB(ch->ch_fd); sendOOB(ch->ch_fd);
buf = (char *)malloc(sc->sc_info); buf = malloc(sc->sc_info);
assert(buf); assert(buf);
i = 0; i = 0;

View File

@ -165,7 +165,7 @@ int LWP_CreateProcess(ep, stacksize, priority, parm, name, pid)
/* Throw away all dead process control blocks */ /* Throw away all dead process control blocks */
purge_dead_pcbs(); purge_dead_pcbs();
if (lwp_init) { if (lwp_init) {
temp = (PROCESS) malloc (sizeof (struct lwp_pcb)); temp = malloc (sizeof (struct lwp_pcb));
if (temp == NULL) { if (temp == NULL) {
Set_LWP_RC(); Set_LWP_RC();
return LWP_ENOMEM; return LWP_ENOMEM;
@ -174,7 +174,7 @@ int LWP_CreateProcess(ep, stacksize, priority, parm, name, pid)
stacksize = 1000; stacksize = 1000;
else else
stacksize = 4 * ((stacksize+3) / 4); stacksize = 4 * ((stacksize+3) / 4);
if ((stackptr = (char *) malloc(stacksize)) == NULL) { if ((stackptr = malloc(stacksize)) == NULL) {
Set_LWP_RC(); Set_LWP_RC();
return LWP_ENOMEM; return LWP_ENOMEM;
} }
@ -293,8 +293,8 @@ int LWP_InitializeProcessSupport(priority, pid)
} }
blocked.head = NULL; blocked.head = NULL;
blocked.count = 0; blocked.count = 0;
lwp_init = (struct lwp_ctl *) malloc(sizeof(struct lwp_ctl)); lwp_init = malloc(sizeof(struct lwp_ctl));
temp = (PROCESS) malloc(sizeof(struct lwp_pcb)); temp = malloc(sizeof(struct lwp_pcb));
if (lwp_init == NULL || temp == NULL) if (lwp_init == NULL || temp == NULL)
Abort_LWP("Insufficient Storage to Initialize LWP Support"); Abort_LWP("Insufficient Storage to Initialize LWP Support");
LWPANCHOR.processcnt = 1; LWPANCHOR.processcnt = 1;

View File

@ -37,7 +37,7 @@ typedef unsigned char bool;
#define expiration TotalTime #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 #define MILLION 1000000