diff options
Diffstat (limited to 'man3')
| -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 |
5 files changed, 6 insertions, 11 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) |
