git » nmdb » commit 9087d36

Make the value buffer independant in test1*

author Alberto Bertogli
2007-01-06 18:14:34 UTC
committer Alberto Bertogli
2007-01-06 18:14:34 UTC
parent 9fb4da2656aea2695b406d168313d0cb5793573b

Make the value buffer independant in test1*

libnmdb/test1c.c +4 -4
libnmdb/test1d.c +4 -4

diff --git a/libnmdb/test1c.c b/libnmdb/test1c.c
index 8b356ac..e83a2e9 100644
--- a/libnmdb/test1c.c
+++ b/libnmdb/test1c.c
@@ -12,7 +12,7 @@
 int main(int argc, char **argv)
 {
 	int i, r, times;
-	unsigned char *key, *val;
+	unsigned char *key, *val, *gval;
 	size_t ksize, vsize;
 	unsigned long elapsed, misses = 0;
 	nmdb_t *db;
@@ -46,11 +46,11 @@ int main(int argc, char **argv)
 	elapsed = timer_stop();
 	printf("%lu\n", elapsed);
 
-	val = malloc(128 * 1024);
+	gval = malloc(128 * 1024);
 	printf("get... ");
 	timer_start();
 	for (i = 0; i < times; i++) {
-		r = nmdb_cache_get(db, key, ksize, val, vsize);
+		r = nmdb_cache_get(db, key, ksize, gval, vsize);
 		if (r < 0) {
 			perror("Get");
 			return 1;
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
 	}
 	elapsed = timer_stop();
 	printf("%lu\n", elapsed);
-	free(val);
+	free(gval);
 
 	printf("get misses: %ld\n", misses);
 
diff --git a/libnmdb/test1d.c b/libnmdb/test1d.c
index cdc526e..0d40de5 100644
--- a/libnmdb/test1d.c
+++ b/libnmdb/test1d.c
@@ -12,7 +12,7 @@
 int main(int argc, char **argv)
 {
 	int i, r, times;
-	unsigned char *key, *val;
+	unsigned char *key, *val, *gval;
 	size_t ksize, vsize;
 	unsigned long elapsed, misses = 0;
 	nmdb_t *db;
@@ -46,11 +46,11 @@ int main(int argc, char **argv)
 	elapsed = timer_stop();
 	printf("%lu\n", elapsed);
 
-	val = malloc(128 * 1024);
+	gval = malloc(128 * 1024);
 	printf("get... ");
 	timer_start();
 	for (i = 0; i < times; i++) {
-		r = nmdb_get(db, key, ksize, val, vsize);
+		r = nmdb_get(db, key, ksize, gval, vsize);
 		if (r < 0) {
 			perror("Get");
 			return 1;
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
 	}
 	elapsed = timer_stop();
 	printf("%lu\n", elapsed);
-	free(val);
+	free(gval);
 
 	printf("get misses: %ld\n", misses);