Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/regress/lib/libpthread/resolv * -t -> -n with consistency wi...
details: https://anonhg.NetBSD.org/src/rev/3f59fc967b5d
branches: trunk
changeset: 566897:3f59fc967b5d
user: christos <christos%NetBSD.org@localhost>
date: Sun May 23 16:59:11 2004 +0000
description:
* -t -> -n with consistency with the usage.
* count was off by one.
* allocate enough space for the stats arrays to hold all the host we read.
diffstat:
regress/lib/libpthread/resolv/resolv.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diffs (61 lines):
diff -r 15f5e111ae5c -r 3f59fc967b5d regress/lib/libpthread/resolv/resolv.c
--- a/regress/lib/libpthread/resolv/resolv.c Sun May 23 16:55:09 2004 +0000
+++ b/regress/lib/libpthread/resolv/resolv.c Sun May 23 16:59:11 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: resolv.c,v 1.5 2004/05/13 21:32:36 christos Exp $ */
+/* $NetBSD: resolv.c,v 1.6 2004/05/23 16:59:11 christos Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: resolv.c,v 1.5 2004/05/13 21:32:36 christos Exp $");
+__RCSID("$NetBSD: resolv.c,v 1.6 2004/05/23 16:59:11 christos Exp $");
#include <pthread.h>
#include <stdio.h>
@@ -126,8 +126,11 @@
resolvloop(void *p)
{
int *nhosts = (int *)p;
- while (--(*nhosts))
+ if (*nhosts == 0)
+ return;
+ do
resolvone(*nhosts);
+ while (--(*nhosts));
return NULL;
}
@@ -149,7 +152,7 @@
srandom(1234);
- while ((c = getopt(argc, argv, "dh:t:")) != -1)
+ while ((c = getopt(argc, argv, "dh:n:")) != -1)
switch (c) {
case 'd':
debug++;
@@ -157,7 +160,7 @@
case 'h':
nhosts = atoi(optarg);
break;
- case 't':
+ case 'n':
nthreads = atoi(optarg);
break;
default:
@@ -172,9 +175,9 @@
if ((nleft = malloc(nthreads * sizeof(int))) == NULL)
err(1, "malloc");
- if ((ask = calloc(nhosts, sizeof(int))) == NULL)
+ if ((ask = calloc(hosts->sl_cur, sizeof(int))) == NULL)
err(1, "calloc");
- if ((got = calloc(nhosts, sizeof(int))) == NULL)
+ if ((got = calloc(hosts->sl_cur, sizeof(int))) == NULL)
err(1, "calloc");
Home |
Main Index |
Thread Index |
Old Index