Commit 6880d604 authored by Yoni Fogel's avatar Yoni Fogel

moved dbt_init and dbt_init_malloc from most tests to test.h

git-svn-id: file:///svn/tokudb@1004 c7de825b-a66e-492c-adef-691d508d4ae1
parent 964dca79
......@@ -23,3 +23,16 @@ void parse_args (int argc, const char *argv[]) {
argv++;
}
}
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
......@@ -13,18 +13,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void db_put(DB *db, int k, int v) {
DB_TXN * const null_txn = 0;
......
......@@ -11,12 +11,6 @@
// DIR is defined in the Makefile
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DB *db;
DB_ENV *env;
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void expect_cursor_get(DBC *cursor, int k, int v, int op) {
int kk, vv;
......
......@@ -25,12 +25,6 @@ DB_TXN *const null_txn = 0;
DB_ENV *dbenv;
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
void* lastmalloced;
......
......@@ -13,18 +13,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void db_put(DB *db, int k, int v) {
DBT key, val;
......
......@@ -25,12 +25,6 @@ DB* sdb;
DB_TXN *const null_txn = 0;
DB_ENV *dbenv = 0;
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
void* lastmalloced = NULL;
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void expect(DBC *cursor, int k, int v) {
DBT key, val;
......
......@@ -15,18 +15,7 @@
int errors;
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void db_put(DB *db, int k, int v, u_int32_t put_flags, int rexpect) {
DBT key, val;
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void expect(DBC *cursor, int k, int v) {
DBT key, val;
......
......@@ -13,18 +13,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
DBT *dbt_init_zero(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void db_put(DB *db, int k, int v) {
DB_TXN * const null_txn = 0;
......
......@@ -8,12 +8,6 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
void test_get (int dup_mode) {
DB_ENV * const null_env = 0;
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void test_hsoc_1(int pagesize, int dup_mode) {
if (verbose) printf("test_hsoc:%d %d\n", pagesize, dup_mode);
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void test_insert(int n, int dup_mode) {
if (verbose) printf("test_insert:%d %d\n", n, dup_mode);
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void test_key_size_limit(int dup_mode) {
if (verbose) printf("test_key_size_limit:%d\n", dup_mode);
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void test_rand_insert(int n, int dup_mode) {
if (verbose) printf("test_rand_insert:%d %d\n", n, dup_mode);
......
......@@ -16,18 +16,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
int keycompare (const void *key1, unsigned int key1len, const void *key2, unsigned int key2len) {
if (key1len==key2len) {
......
......@@ -12,18 +12,7 @@
#include "test.h"
DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
memset(dbt, 0, sizeof *dbt);
dbt->data = data;
dbt->size = size;
return dbt;
}
DBT *dbt_init_malloc(DBT *dbt) {
memset(dbt, 0, sizeof *dbt);
dbt->flags = DB_DBT_MALLOC;
return dbt;
}
void expect_cursor_get(DBC *cursor, int k, int v, int op) {
int kk, vv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment