diff options
| -rw-r--r-- | man3/getgrouplist.3 | 3 | ||||
| -rw-r--r-- | man3/insque.3 | 4 | ||||
| -rw-r--r-- | man3/malloc_info.3 | 3 | ||||
| -rw-r--r-- | man3/pthread_create.3 | 3 | ||||
| -rw-r--r-- | man3/tsearch.3 | 4 | ||||
| -rw-r--r-- | man7/aio.7 | 6 |
6 files changed, 8 insertions, 15 deletions
diff --git a/man3/getgrouplist.3 b/man3/getgrouplist.3 index ff8d89e3f4..36a134949c 100644 --- a/man3/getgrouplist.3 +++ b/man3/getgrouplist.3 @@ -153,7 +153,6 @@ int main(int argc, char *argv[]) { int j, ngroups; - gid_t *groups; struct passwd *pw; struct group *gr; @@ -164,7 +163,7 @@ main(int argc, char *argv[]) ngroups = atoi(argv[2]); - groups = malloc(sizeof(*groups) * ngroups); + gid_t *groups = malloc(sizeof(*groups) * ngroups); if (groups == NULL) { perror("malloc"); exit(EXIT_FAILURE); diff --git a/man3/insque.3 b/man3/insque.3 index 005ad8cc19..b49040c1b3 100644 --- a/man3/insque.3 +++ b/man3/insque.3 @@ -180,9 +180,7 @@ struct element { static struct element * new_element(void) { - struct element *e; - - e = malloc(sizeof(*e)); + struct element *e = malloc(sizeof(*e)); if (e == NULL) { fprintf(stderr, "malloc() failed\en"); exit(EXIT_FAILURE); diff --git a/man3/malloc_info.3 b/man3/malloc_info.3 index 598478dcc9..a5a3195580 100644 --- a/man3/malloc_info.3 +++ b/man3/malloc_info.3 @@ -212,7 +212,6 @@ int main(int argc, char *argv[]) { int j, tn, sleepTime; - pthread_t *thr; if (argc < 4) { fprintf(stderr, @@ -226,7 +225,7 @@ main(int argc, char *argv[]) blockSize = atoi(argv[3]); sleepTime = (argc > 4) ? atoi(argv[4]) : 0; - thr = calloc(numThreads, sizeof(*thr)); + pthread_t *thr = calloc(numThreads, sizeof(*thr)); if (thr == NULL) errExit("calloc"); diff --git a/man3/pthread_create.3 b/man3/pthread_create.3 index 5ffb145869..9df8cfcda9 100644 --- a/man3/pthread_create.3 +++ b/man3/pthread_create.3 @@ -324,7 +324,6 @@ int main(int argc, char *argv[]) { int s, tnum, opt, num_threads; - struct thread_info *tinfo; pthread_attr_t attr; int stack_size; void *res; @@ -361,7 +360,7 @@ main(int argc, char *argv[]) /* Allocate memory for pthread_create() arguments */ - tinfo = calloc(num_threads, sizeof(*tinfo)); + struct thread_info *tinfo = calloc(num_threads, sizeof(*tinfo)); if (tinfo == NULL) handle_error("calloc"); diff --git a/man3/tsearch.3 b/man3/tsearch.3 index f0ff80e8cd..b34ef516c3 100644 --- a/man3/tsearch.3 +++ b/man3/tsearch.3 @@ -322,12 +322,12 @@ action(const void *nodep, VISIT which, int depth) int main(void) { - int i, *ptr; + int i; void *val; srand(time(NULL)); for (i = 0; i < 12; i++) { - ptr = xmalloc(sizeof(*ptr)); + int *ptr = xmalloc(sizeof(*ptr)); *ptr = rand() & 0xff; val = tsearch((void *) ptr, &root, compare); if (val == NULL) diff --git a/man7/aio.7 b/man7/aio.7 index d3ab3f4223..a9586a6943 100644 --- a/man7/aio.7 +++ b/man7/aio.7 @@ -294,8 +294,6 @@ aioSigHandler(int sig, siginfo_t *si, void *ucontext) int main(int argc, char *argv[]) { - struct ioRequest *ioList; - struct aiocb *aiocbList; struct sigaction sa; int s, j; int numReqs; /* Total number of queued I/O requests */ @@ -311,11 +309,11 @@ main(int argc, char *argv[]) /* Allocate our arrays */ - ioList = calloc(numReqs, sizeof(*ioList)); + struct ioRequest *ioList = calloc(numReqs, sizeof(*ioList)); if (ioList == NULL) errExit("calloc"); - aiocbList = calloc(numReqs, sizeof(*aiocbList)); + struct aiocb *aiocbList = calloc(numReqs, sizeof(*aiocbList)); if (aiocbList == NULL) errExit("calloc"); |
