git » nmdb » commit fd12c47

Improve test2* argument handling.

author Alberto Bertogli
2006-09-13 03:59:31 UTC
committer Alberto Bertogli
2006-09-13 03:59:31 UTC
parent 623d019f992e8971d81fdfe1463f25e3fd72f934

Improve test2* argument handling.

libnmdb/test2c.c +6 -2
libnmdb/test2d.c +6 -2

diff --git a/libnmdb/test2c.c b/libnmdb/test2c.c
index 6570c1a..9811a78 100644
--- a/libnmdb/test2c.c
+++ b/libnmdb/test2c.c
@@ -25,8 +25,12 @@ int main(int argc, char **argv)
 	times = atoi(argv[1]);
 	ksize = atoi(argv[2]);
 	vsize = atoi(argv[3]);
-	if (times < 1 || ksize < 1 || vsize < 1) {
-		printf("Error: TIMES, KSIZE and VSIZE must be >= 1\n");
+	if (times < 1) {
+		printf("Error: TIMES must be >= 1\n");
+		return 1;
+	}
+	if (ksize < sizeof(int) || vsize < sizeof(int)) {
+		printf("Error: KSIZE and VSIZE must be >= sizeof(int)\n");
 		return 1;
 	}
 
diff --git a/libnmdb/test2d.c b/libnmdb/test2d.c
index e55b698..c7ca091 100644
--- a/libnmdb/test2d.c
+++ b/libnmdb/test2d.c
@@ -25,8 +25,12 @@ int main(int argc, char **argv)
 	times = atoi(argv[1]);
 	ksize = atoi(argv[2]);
 	vsize = atoi(argv[3]);
-	if (times < 1 || ksize < 1 || vsize < 1) {
-		printf("Error: TIMES, KSIZE and VSIZE must be >= 1\n");
+	if (times < 1) {
+		printf("Error: TIMES must be >= 1\n");
+		return 1;
+	}
+	if (ksize < sizeof(int) || vsize < sizeof(int)) {
+		printf("Error: KSIZE and VSIZE must be >= sizeof(int)\n");
 		return 1;
 	}