summaryrefslogtreecommitdiff
path: root/testcode
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2018-05-12 11:49:30 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2018-05-12 11:49:30 +0000
commitfbdb9ac866a647da0919b224f05cca039afc02fa (patch)
treea4ddb15b51a795c9f985e693a04d992a94f4f455 /testcode
parent31f8d531e1359c7acd82cff9ab798cdeac277adc (diff)
Diffstat (limited to 'testcode')
-rw-r--r--testcode/asynclook.c4
-rw-r--r--testcode/checklocks.c2
-rw-r--r--testcode/checklocks.h10
-rw-r--r--testcode/fake_event.c16
-rw-r--r--testcode/lock_verify.c18
-rw-r--r--testcode/memstats.c14
-rw-r--r--testcode/replay.c26
-rw-r--r--testcode/replay.h20
-rw-r--r--testcode/unitlruhash.c76
-rw-r--r--testcode/unitmain.c2
-rw-r--r--testcode/unitneg.c4
-rw-r--r--testcode/unitslabhash.c62
-rw-r--r--testcode/unitverify.c4
13 files changed, 129 insertions, 129 deletions
diff --git a/testcode/asynclook.c b/testcode/asynclook.c
index 96cb2e3b26132..a2bdb62130b79 100644
--- a/testcode/asynclook.c
+++ b/testcode/asynclook.c
@@ -64,7 +64,7 @@ struct track_id {
/** true if cancelled */
int cancel;
/** a lock on this structure for thread safety */
- lock_basic_t lock;
+ lock_basic_type lock;
};
/**
@@ -164,7 +164,7 @@ struct ext_thr_info {
/** thread num for debug */
int thread_num;
/** thread id */
- ub_thread_t tid;
+ ub_thread_type tid;
/** context */
struct ub_ctx* ctx;
/** size of array to query */
diff --git a/testcode/checklocks.c b/testcode/checklocks.c
index dab98491e224e..7e6f0bb5db57f 100644
--- a/testcode/checklocks.c
+++ b/testcode/checklocks.c
@@ -61,7 +61,7 @@ static int key_created = 0;
/** if the key was deleted, i.e. we have quit */
static int key_deleted = 0;
/** we hide the thread debug info with this key. */
-static ub_thread_key_t thr_debug_key;
+static ub_thread_key_type thr_debug_key;
/** the list of threads, so all threads can be examined. NULL if unused. */
static struct thr_check* thread_infos[THRDEBUG_MAX_THREADS];
/** do we check locking order */
diff --git a/testcode/checklocks.h b/testcode/checklocks.h
index 936f282756f72..182a93858d92c 100644
--- a/testcode/checklocks.h
+++ b/testcode/checklocks.h
@@ -307,7 +307,7 @@ struct checked_lock_mutex { struct checked_lock* c_m; };
struct checked_lock_spl { struct checked_lock* c_spl; };
/** debugging rwlock */
-typedef struct checked_lock_rw lock_rw_t;
+typedef struct checked_lock_rw lock_rw_type;
#define lock_rw_init(lock) checklock_init(check_lock_rwlock, &((lock)->c_rw), __func__, __FILE__, __LINE__)
#define lock_rw_destroy(lock) checklock_destroy(check_lock_rwlock, &((lock)->c_rw), __func__, __FILE__, __LINE__)
#define lock_rw_rdlock(lock) checklock_rdlock(check_lock_rwlock, (lock)->c_rw, __func__, __FILE__, __LINE__)
@@ -315,26 +315,26 @@ typedef struct checked_lock_rw lock_rw_t;
#define lock_rw_unlock(lock) checklock_unlock(check_lock_rwlock, (lock)->c_rw, __func__, __FILE__, __LINE__)
/** debugging mutex */
-typedef struct checked_lock_mutex lock_basic_t;
+typedef struct checked_lock_mutex lock_basic_type;
#define lock_basic_init(lock) checklock_init(check_lock_mutex, &((lock)->c_m), __func__, __FILE__, __LINE__)
#define lock_basic_destroy(lock) checklock_destroy(check_lock_mutex, &((lock)->c_m), __func__, __FILE__, __LINE__)
#define lock_basic_lock(lock) checklock_lock(check_lock_mutex, (lock)->c_m, __func__, __FILE__, __LINE__)
#define lock_basic_unlock(lock) checklock_unlock(check_lock_mutex, (lock)->c_m, __func__, __FILE__, __LINE__)
/** debugging spinlock */
-typedef struct checked_lock_spl lock_quick_t;
+typedef struct checked_lock_spl lock_quick_type;
#define lock_quick_init(lock) checklock_init(check_lock_spinlock, &((lock)->c_spl), __func__, __FILE__, __LINE__)
#define lock_quick_destroy(lock) checklock_destroy(check_lock_spinlock, &((lock)->c_spl), __func__, __FILE__, __LINE__)
#define lock_quick_lock(lock) checklock_lock(check_lock_spinlock, (lock)->c_spl, __func__, __FILE__, __LINE__)
#define lock_quick_unlock(lock) checklock_unlock(check_lock_spinlock, (lock)->c_spl, __func__, __FILE__, __LINE__)
/** we use the pthread id, our thr_check structure is kept behind the scenes */
-typedef pthread_t ub_thread_t;
+typedef pthread_t ub_thread_type;
#define ub_thread_create(thr, func, arg) checklock_thrcreate(thr, func, arg)
#define ub_thread_self() pthread_self()
#define ub_thread_join(thread) checklock_thrjoin(thread)
-typedef pthread_key_t ub_thread_key_t;
+typedef pthread_key_t ub_thread_key_type;
#define ub_thread_key_create(key, f) LOCKRET(pthread_key_create(key, f))
#define ub_thread_key_set(key, v) LOCKRET(pthread_setspecific(key, v))
#define ub_thread_key_get(key) pthread_getspecific(key)
diff --git a/testcode/fake_event.c b/testcode/fake_event.c
index bc6588617f055..2072089381f7f 100644
--- a/testcode/fake_event.c
+++ b/testcode/fake_event.c
@@ -318,7 +318,7 @@ answer_callback_from_entry(struct replay_runtime* runtime,
struct comm_point c;
struct comm_reply repinfo;
void* cb_arg = pend->cb_arg;
- comm_point_callback_t* cb = pend->callback;
+ comm_point_callback_type* cb = pend->callback;
memset(&c, 0, sizeof(c));
c.fd = -1;
@@ -422,7 +422,7 @@ fake_pending_callback(struct replay_runtime* runtime,
struct comm_reply repinfo;
struct comm_point c;
void* cb_arg;
- comm_point_callback_t* cb;
+ comm_point_callback_type* cb;
memset(&c, 0, sizeof(c));
if(!p) fatal_exit("No pending queries.");
@@ -735,7 +735,7 @@ struct listen_dnsport*
listen_create(struct comm_base* base, struct listen_port* ATTR_UNUSED(ports),
size_t bufsize, int ATTR_UNUSED(tcp_accept_count),
void* ATTR_UNUSED(sslctx), struct dt_env* ATTR_UNUSED(dtenv),
- comm_point_callback_t* cb, void* cb_arg)
+ comm_point_callback_type* cb, void* cb_arg)
{
struct replay_runtime* runtime = (struct replay_runtime*)base;
struct listen_dnsport* l= calloc(1, sizeof(struct listen_dnsport));
@@ -937,7 +937,7 @@ outside_network_quit_prepare(struct outside_network* ATTR_UNUSED(outnet))
struct pending*
pending_udp_query(struct serviced_query* sq, sldns_buffer* packet,
- int timeout, comm_point_callback_t* callback, void* callback_arg)
+ int timeout, comm_point_callback_type* callback, void* callback_arg)
{
struct replay_runtime* runtime = (struct replay_runtime*)
sq->outnet->base;
@@ -987,7 +987,7 @@ pending_udp_query(struct serviced_query* sq, sldns_buffer* packet,
struct waiting_tcp*
pending_tcp_query(struct serviced_query* sq, sldns_buffer* packet,
- int timeout, comm_point_callback_t* callback, void* callback_arg)
+ int timeout, comm_point_callback_type* callback, void* callback_arg)
{
struct replay_runtime* runtime = (struct replay_runtime*)
sq->outnet->base;
@@ -1041,7 +1041,7 @@ struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
int ATTR_UNUSED(tcp_upstream), int ATTR_UNUSED(ssl_upstream),
struct sockaddr_storage* addr, socklen_t addrlen, uint8_t* zone,
size_t zonelen, struct module_qstate* qstate,
- comm_point_callback_t* callback, void* callback_arg,
+ comm_point_callback_type* callback, void* callback_arg,
sldns_buffer* ATTR_UNUSED(buff), struct module_env* ATTR_UNUSED(env))
{
struct replay_runtime* runtime = (struct replay_runtime*)outnet->base;
@@ -1160,7 +1160,7 @@ void listening_ports_free(struct listen_port* list)
struct comm_point* comm_point_create_local(struct comm_base* ATTR_UNUSED(base),
int ATTR_UNUSED(fd), size_t ATTR_UNUSED(bufsize),
- comm_point_callback_t* ATTR_UNUSED(callback),
+ comm_point_callback_type* ATTR_UNUSED(callback),
void* ATTR_UNUSED(callback_arg))
{
return calloc(1, 1);
@@ -1168,7 +1168,7 @@ struct comm_point* comm_point_create_local(struct comm_base* ATTR_UNUSED(base),
struct comm_point* comm_point_create_raw(struct comm_base* ATTR_UNUSED(base),
int ATTR_UNUSED(fd), int ATTR_UNUSED(writing),
- comm_point_callback_t* ATTR_UNUSED(callback),
+ comm_point_callback_type* ATTR_UNUSED(callback),
void* ATTR_UNUSED(callback_arg))
{
/* no pipe comm possible */
diff --git a/testcode/lock_verify.c b/testcode/lock_verify.c
index de2882b24c119..666a7029d64d8 100644
--- a/testcode/lock_verify.c
+++ b/testcode/lock_verify.c
@@ -68,7 +68,7 @@ struct order_id {
/** a lock */
struct order_lock {
/** rbnode in all tree */
- rbnode_t node;
+ rbnode_type node;
/** lock id */
struct order_id id;
/** the creation file */
@@ -76,7 +76,7 @@ struct order_lock {
/** creation line */
int create_line;
/** set of all locks that are smaller than this one (locked earlier) */
- rbtree_t* smaller;
+ rbtree_type* smaller;
/** during depthfirstsearch, this is a linked list of the stack
* of locks. points to the next lock bigger than this one. */
struct lock_ref* dfs_next;
@@ -89,7 +89,7 @@ struct order_lock {
/** reference to a lock in a rbtree set */
struct lock_ref {
/** rbnode, key is an order_id ptr */
- rbnode_t node;
+ rbnode_type node;
/** the lock referenced */
struct order_lock* lock;
/** why is this ref */
@@ -181,7 +181,7 @@ static int readup_str(char** str, FILE* in)
}
/** read creation entry */
-static void read_create(rbtree_t* all, FILE* in)
+static void read_create(rbtree_type* all, FILE* in)
{
struct order_lock* o = calloc(1, sizeof(struct order_lock));
if(!o) fatal_exit("malloc failure");
@@ -210,7 +210,7 @@ static void read_create(rbtree_t* all, FILE* in)
/** insert lock entry (empty) into list */
static struct order_lock*
-insert_lock(rbtree_t* all, struct order_id* id)
+insert_lock(rbtree_type* all, struct order_id* id)
{
struct order_lock* o = calloc(1, sizeof(struct order_lock));
if(!o) fatal_exit("malloc failure");
@@ -223,7 +223,7 @@ insert_lock(rbtree_t* all, struct order_id* id)
}
/** read lock entry */
-static void read_lock(rbtree_t* all, FILE* in, int val)
+static void read_lock(rbtree_type* all, FILE* in, int val)
{
struct order_id prev_id, now_id;
struct lock_ref* ref;
@@ -256,7 +256,7 @@ static void read_lock(rbtree_t* all, FILE* in, int val)
}
/** read input file */
-static void readinput(rbtree_t* all, char* file)
+static void readinput(rbtree_type* all, char* file)
{
FILE *in = fopen(file, "r");
int fst;
@@ -367,7 +367,7 @@ static void check_order_lock(struct order_lock* lock)
}
/** Check ordering of locks */
-static void check_order(rbtree_t* all_locks)
+static void check_order(rbtree_type* all_locks)
{
/* check each lock */
struct order_lock* lock;
@@ -391,7 +391,7 @@ static void check_order(rbtree_t* all_locks)
int
main(int argc, char* argv[])
{
- rbtree_t* all_locks;
+ rbtree_type* all_locks;
int i;
time_t starttime = time(NULL);
#ifdef USE_THREAD_DEBUG
diff --git a/testcode/memstats.c b/testcode/memstats.c
index e837bbf3b49d9..dc29058ad7747 100644
--- a/testcode/memstats.c
+++ b/testcode/memstats.c
@@ -51,7 +51,7 @@
*/
struct codeline {
/** rbtree node */
- rbnode_t node;
+ rbnode_type node;
/** the name of the file:linenumber */
char* codeline;
/** the name of the function */
@@ -99,7 +99,7 @@ match(char* line)
/** find or alloc codeline in tree */
static struct codeline*
-get_codeline(rbtree_t* tree, char* key, char* func)
+get_codeline(rbtree_type* tree, char* key, char* func)
{
struct codeline* cl = (struct codeline*)rbtree_search(tree, key);
if(!cl) {
@@ -118,7 +118,7 @@ get_codeline(rbtree_t* tree, char* key, char* func)
/** read up the malloc stats */
static void
-read_malloc_stat(char* line, rbtree_t* tree)
+read_malloc_stat(char* line, rbtree_type* tree)
{
char codeline[10240];
char name[10240];
@@ -143,7 +143,7 @@ read_malloc_stat(char* line, rbtree_t* tree)
/** read up the calloc stats */
static void
-read_calloc_stat(char* line, rbtree_t* tree)
+read_calloc_stat(char* line, rbtree_type* tree)
{
char codeline[10240];
char name[10240];
@@ -180,7 +180,7 @@ get_file_size(const char* fname)
/** read the logfile */
static void
-readfile(rbtree_t* tree, const char* fname)
+readfile(rbtree_type* tree, const char* fname)
{
off_t total = get_file_size(fname);
off_t done = (off_t)0;
@@ -216,7 +216,7 @@ readfile(rbtree_t* tree, const char* fname)
/** print memory stats */
static void
-printstats(rbtree_t* tree)
+printstats(rbtree_type* tree)
{
struct codeline* cl;
uint64_t total = 0, tcalls = 0;
@@ -235,7 +235,7 @@ printstats(rbtree_t* tree)
/** main program */
int main(int argc, const char* argv[])
{
- rbtree_t* tree = 0;
+ rbtree_type* tree = 0;
log_init(NULL, 0, 0);
if(argc != 2) {
usage();
diff --git a/testcode/replay.c b/testcode/replay.c
index 22670eb932769..b45bde8067298 100644
--- a/testcode/replay.c
+++ b/testcode/replay.c
@@ -63,7 +63,7 @@
* done (successfully).
* @return expanded text, malloced. NULL on failure.
*/
-static char* macro_expand(rbtree_t* store,
+static char* macro_expand(rbtree_type* store,
struct replay_runtime* runtime, char** text);
/** compare of time values */
@@ -548,7 +548,7 @@ replay_var_compare(const void* a, const void* b)
return strcmp(x->name, y->name);
}
-rbtree_t*
+rbtree_type*
macro_store_create(void)
{
return rbtree_create(&replay_var_compare);
@@ -556,7 +556,7 @@ macro_store_create(void)
/** helper function to delete macro values */
static void
-del_macro(rbnode_t* x, void* ATTR_UNUSED(arg))
+del_macro(rbnode_type* x, void* ATTR_UNUSED(arg))
{
struct replay_var* v = (struct replay_var*)x;
free(v->name);
@@ -565,7 +565,7 @@ del_macro(rbnode_t* x, void* ATTR_UNUSED(arg))
}
void
-macro_store_delete(rbtree_t* store)
+macro_store_delete(rbtree_type* store)
{
if(!store)
return;
@@ -615,7 +615,7 @@ do_buf_insert(char* buf, size_t remain, char* after, char* inserted)
/** do macro recursion */
static char*
-do_macro_recursion(rbtree_t* store, struct replay_runtime* runtime,
+do_macro_recursion(rbtree_type* store, struct replay_runtime* runtime,
char* at, size_t remain)
{
char* after = at+2;
@@ -632,7 +632,7 @@ do_macro_recursion(rbtree_t* store, struct replay_runtime* runtime,
/** get var from store */
static struct replay_var*
-macro_getvar(rbtree_t* store, char* name)
+macro_getvar(rbtree_type* store, char* name)
{
struct replay_var k;
k.node.key = &k;
@@ -642,7 +642,7 @@ macro_getvar(rbtree_t* store, char* name)
/** do macro variable */
static char*
-do_macro_variable(rbtree_t* store, char* buf, size_t remain)
+do_macro_variable(rbtree_type* store, char* buf, size_t remain)
{
struct replay_var* v;
char* at = buf+1;
@@ -776,7 +776,7 @@ do_macro_range(char* buf)
}
static char*
-macro_expand(rbtree_t* store, struct replay_runtime* runtime, char** text)
+macro_expand(rbtree_type* store, struct replay_runtime* runtime, char** text)
{
char buf[10240];
char* at = *text;
@@ -844,7 +844,7 @@ macro_expand(rbtree_t* store, struct replay_runtime* runtime, char** text)
}
char*
-macro_process(rbtree_t* store, struct replay_runtime* runtime, char* text)
+macro_process(rbtree_type* store, struct replay_runtime* runtime, char* text)
{
char buf[10240];
char* next, *expand;
@@ -872,14 +872,14 @@ macro_process(rbtree_t* store, struct replay_runtime* runtime, char* text)
}
char*
-macro_lookup(rbtree_t* store, char* name)
+macro_lookup(rbtree_type* store, char* name)
{
struct replay_var* x = macro_getvar(store, name);
if(!x) return strdup("");
return strdup(x->value);
}
-void macro_print_debug(rbtree_t* store)
+void macro_print_debug(rbtree_type* store)
{
struct replay_var* x;
RBTREE_FOR(x, struct replay_var*, store) {
@@ -888,7 +888,7 @@ void macro_print_debug(rbtree_t* store)
}
int
-macro_assign(rbtree_t* store, char* name, char* value)
+macro_assign(rbtree_type* store, char* name, char* value)
{
struct replay_var* x = macro_getvar(store, name);
if(x) {
@@ -918,7 +918,7 @@ macro_assign(rbtree_t* store, char* name, char* value)
void testbound_selftest(void)
{
/* test the macro store */
- rbtree_t* store = macro_store_create();
+ rbtree_type* store = macro_store_create();
char* v;
int r;
int num_asserts = 0;
diff --git a/testcode/replay.h b/testcode/replay.h
index 05bd442f57f52..b33950304d12b 100644
--- a/testcode/replay.h
+++ b/testcode/replay.h
@@ -280,7 +280,7 @@ struct replay_runtime {
struct fake_timer* timer_list;
/** callback to call for incoming queries */
- comm_point_callback_t* callback_query;
+ comm_point_callback_type* callback_query;
/** user argument for incoming query callback */
void *cb_arg;
@@ -305,7 +305,7 @@ struct replay_runtime {
/**
* Tree of macro values. Of type replay_var
*/
- rbtree_t* vars;
+ rbtree_type* vars;
};
/**
@@ -325,7 +325,7 @@ struct fake_pending {
/** qtype */
int qtype;
/** The callback function to call when answer arrives (or timeout) */
- comm_point_callback_t* callback;
+ comm_point_callback_type* callback;
/** callback user argument */
void* cb_arg;
/** original timeout in seconds from 'then' */
@@ -380,7 +380,7 @@ struct fake_timer {
*/
struct replay_var {
/** rbtree node. Key is this structure. Sorted by name. */
- rbnode_t node;
+ rbnode_type node;
/** the variable name */
char* name;
/** the variable value */
@@ -413,13 +413,13 @@ struct fake_timer* replay_get_oldest_timer(struct replay_runtime* runtime);
* Create variable storage
* @return new or NULL on failure.
*/
-rbtree_t* macro_store_create(void);
+rbtree_type* macro_store_create(void);
/**
* Delete variable storage
* @param store: the macro storage to free up.
*/
-void macro_store_delete(rbtree_t* store);
+void macro_store_delete(rbtree_type* store);
/**
* Apply macro substitution to string.
@@ -428,7 +428,7 @@ void macro_store_delete(rbtree_t* store);
* @param text: string to work on.
* @return newly malloced string with result.
*/
-char* macro_process(rbtree_t* store, struct replay_runtime* runtime,
+char* macro_process(rbtree_type* store, struct replay_runtime* runtime,
char* text);
/**
@@ -438,7 +438,7 @@ char* macro_process(rbtree_t* store, struct replay_runtime* runtime,
* @return newly malloced string with result or strdup("") if not found.
* or NULL on malloc failure.
*/
-char* macro_lookup(rbtree_t* store, char* name);
+char* macro_lookup(rbtree_type* store, char* name);
/**
* Set macro value.
@@ -447,10 +447,10 @@ char* macro_lookup(rbtree_t* store, char* name);
* @param value: text to set it to. Not expanded.
* @return false on failure.
*/
-int macro_assign(rbtree_t* store, char* name, char* value);
+int macro_assign(rbtree_type* store, char* name, char* value);
/** Print macro variables stored as debug info */
-void macro_print_debug(rbtree_t* store);
+void macro_print_debug(rbtree_type* store);
/** testbounds self test */
void testbound_selftest(void);
diff --git a/testcode/unitlruhash.c b/testcode/unitlruhash.c
index 28fc617f4676e..e196f0b632111 100644
--- a/testcode/unitlruhash.c
+++ b/testcode/unitlruhash.c
@@ -45,9 +45,9 @@
#include "util/storage/slabhash.h" /* for the test structures */
/** use this type for the lruhash test key */
-typedef struct slabhash_testkey testkey_t;
+typedef struct slabhash_testkey testkey_type;
/** use this type for the lruhash test data */
-typedef struct slabhash_testdata testdata_t;
+typedef struct slabhash_testdata testdata_type;
/** delete key */
static void delkey(struct slabhash_testkey* k) {
@@ -56,10 +56,10 @@ static void delkey(struct slabhash_testkey* k) {
static void deldata(struct slabhash_testdata* d) {free(d);}
/** hash func, very bad to improve collisions */
-static hashvalue_t myhash(int id) {return (hashvalue_t)id & 0x0f;}
+static hashvalue_type myhash(int id) {return (hashvalue_type)id & 0x0f;}
/** allocate new key, fill in hash */
-static testkey_t* newkey(int id) {
- testkey_t* k = (testkey_t*)calloc(1, sizeof(testkey_t));
+static testkey_type* newkey(int id) {
+ testkey_type* k = (testkey_type*)calloc(1, sizeof(testkey_type));
if(!k) fatal_exit("out of memory");
k->id = id;
k->entry.hash = myhash(id);
@@ -68,9 +68,9 @@ static testkey_t* newkey(int id) {
return k;
}
/** new data el */
-static testdata_t* newdata(int val) {
- testdata_t* d = (testdata_t*)calloc(1,
- sizeof(testdata_t));
+static testdata_type* newdata(int val) {
+ testdata_type* d = (testdata_type*)calloc(1,
+ sizeof(testdata_type));
if(!d) fatal_exit("out of memory");
d->data = val;
return d;
@@ -80,12 +80,12 @@ static testdata_t* newdata(int val) {
static void
test_bin_find_entry(struct lruhash* table)
{
- testkey_t* k = newkey(12);
- testdata_t* d = newdata(128);
- testkey_t* k2 = newkey(12 + 1024);
- testkey_t* k3 = newkey(14);
- testkey_t* k4 = newkey(12 + 1024*2);
- hashvalue_t h = myhash(12);
+ testkey_type* k = newkey(12);
+ testdata_type* d = newdata(128);
+ testkey_type* k2 = newkey(12 + 1024);
+ testkey_type* k3 = newkey(14);
+ testkey_type* k4 = newkey(12 + 1024*2);
+ hashvalue_type h = myhash(12);
struct lruhash_bin bin;
memset(&bin, 0, sizeof(bin));
bin_init(&bin, 1);
@@ -161,8 +161,8 @@ test_bin_find_entry(struct lruhash* table)
/** test lru_front lru_remove */
static void test_lru(struct lruhash* table)
{
- testkey_t* k = newkey(12);
- testkey_t* k2 = newkey(14);
+ testkey_type* k = newkey(12);
+ testkey_type* k2 = newkey(14);
lock_quick_lock(&table->lock);
unit_assert( table->lru_start == NULL && table->lru_end == NULL);
@@ -208,10 +208,10 @@ static void test_lru(struct lruhash* table)
static void
test_short_table(struct lruhash* table)
{
- testkey_t* k = newkey(12);
- testkey_t* k2 = newkey(14);
- testdata_t* d = newdata(128);
- testdata_t* d2 = newdata(129);
+ testkey_type* k = newkey(12);
+ testkey_type* k2 = newkey(14);
+ testdata_type* d = newdata(128);
+ testdata_type* d2 = newdata(129);
k->entry.data = d;
k2->entry.data = d2;
@@ -232,11 +232,11 @@ test_short_table(struct lruhash* table)
/** test adding a random element */
static void
-testadd(struct lruhash* table, testdata_t* ref[])
+testadd(struct lruhash* table, testdata_type* ref[])
{
int numtoadd = random() % HASHTESTMAX;
- testdata_t* data = newdata(numtoadd);
- testkey_t* key = newkey(numtoadd);
+ testdata_type* data = newdata(numtoadd);
+ testkey_type* key = newkey(numtoadd);
key->entry.data = data;
lruhash_insert(table, myhash(numtoadd), &key->entry, data, NULL);
ref[numtoadd] = data;
@@ -244,10 +244,10 @@ testadd(struct lruhash* table, testdata_t* ref[])
/** test adding a random element */
static void
-testremove(struct lruhash* table, testdata_t* ref[])
+testremove(struct lruhash* table, testdata_type* ref[])
{
int num = random() % HASHTESTMAX;
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
lruhash_remove(table, myhash(num), key);
ref[num] = NULL;
delkey(key);
@@ -255,12 +255,12 @@ testremove(struct lruhash* table, testdata_t* ref[])
/** test adding a random element */
static void
-testlookup(struct lruhash* table, testdata_t* ref[])
+testlookup(struct lruhash* table, testdata_type* ref[])
{
int num = random() % HASHTESTMAX;
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
struct lruhash_entry* en = lruhash_lookup(table, myhash(num), key, 0);
- testdata_t* data = en? (testdata_t*)en->data : NULL;
+ testdata_type* data = en? (testdata_type*)en->data : NULL;
if(en) {
unit_assert(en->key);
unit_assert(en->data);
@@ -310,11 +310,11 @@ check_table(struct lruhash* table)
/** test adding a random element (unlimited range) */
static void
-testadd_unlim(struct lruhash* table, testdata_t** ref)
+testadd_unlim(struct lruhash* table, testdata_type** ref)
{
int numtoadd = random() % (HASHTESTMAX * 10);
- testdata_t* data = newdata(numtoadd);
- testkey_t* key = newkey(numtoadd);
+ testdata_type* data = newdata(numtoadd);
+ testkey_type* key = newkey(numtoadd);
key->entry.data = data;
lruhash_insert(table, myhash(numtoadd), &key->entry, data, NULL);
if(ref)
@@ -323,10 +323,10 @@ testadd_unlim(struct lruhash* table, testdata_t** ref)
/** test adding a random element (unlimited range) */
static void
-testremove_unlim(struct lruhash* table, testdata_t** ref)
+testremove_unlim(struct lruhash* table, testdata_type** ref)
{
int num = random() % (HASHTESTMAX*10);
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
lruhash_remove(table, myhash(num), key);
if(ref)
ref[num] = NULL;
@@ -335,12 +335,12 @@ testremove_unlim(struct lruhash* table, testdata_t** ref)
/** test adding a random element (unlimited range) */
static void
-testlookup_unlim(struct lruhash* table, testdata_t** ref)
+testlookup_unlim(struct lruhash* table, testdata_type** ref)
{
int num = random() % (HASHTESTMAX*10);
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
struct lruhash_entry* en = lruhash_lookup(table, myhash(num), key, 0);
- testdata_t* data = en? (testdata_t*)en->data : NULL;
+ testdata_type* data = en? (testdata_type*)en->data : NULL;
if(en) {
unit_assert(en->key);
unit_assert(en->data);
@@ -360,7 +360,7 @@ static void
test_long_table(struct lruhash* table)
{
/* assuming it all fits in the hashtable, this check will work */
- testdata_t* ref[HASHTESTMAX * 100];
+ testdata_type* ref[HASHTESTMAX * 100];
size_t i;
memset(ref, 0, sizeof(ref));
/* test assumption */
@@ -422,7 +422,7 @@ struct test_thr {
/** thread num, first entry. */
int num;
/** id */
- ub_thread_t id;
+ ub_thread_type id;
/** hash table */
struct lruhash* table;
};
diff --git a/testcode/unitmain.c b/testcode/unitmain.c
index 988346a1efc92..e3d7a59b4c4ca 100644
--- a/testcode/unitmain.c
+++ b/testcode/unitmain.c
@@ -73,7 +73,7 @@ int testcount = 0;
/** test alloc code */
static void
alloc_test(void) {
- alloc_special_t *t1, *t2;
+ alloc_special_type *t1, *t2;
struct alloc_cache major, minor1, minor2;
int i;
diff --git a/testcode/unitneg.c b/testcode/unitneg.c
index 36fa6b906e3f5..2b67df18232f7 100644
--- a/testcode/unitneg.c
+++ b/testcode/unitneg.c
@@ -242,7 +242,7 @@ static void remove_item(struct val_neg_cache* neg)
{
int n, i;
struct val_neg_data* d;
- rbnode_t* walk;
+ rbnode_type* walk;
struct val_neg_zone* z;
lock_basic_lock(&neg->lock);
@@ -324,7 +324,7 @@ static size_t sumtrees_inuse(struct val_neg_cache* neg)
RBTREE_FOR(z, struct val_neg_zone*, &neg->tree) {
/* get count of highest parent for num in use */
d = (struct val_neg_data*)rbtree_first(&z->tree);
- if(d && (rbnode_t*)d!=RBTREE_NULL)
+ if(d && (rbnode_type*)d!=RBTREE_NULL)
res += d->count;
}
return res;
diff --git a/testcode/unitslabhash.c b/testcode/unitslabhash.c
index 7834688835727..565d361394d1c 100644
--- a/testcode/unitslabhash.c
+++ b/testcode/unitslabhash.c
@@ -44,24 +44,24 @@
#include "util/storage/slabhash.h"
/** use this type for the slabhash test key */
-typedef struct slabhash_testkey testkey_t;
+typedef struct slabhash_testkey testkey_type;
/** use this type for the slabhash test data */
-typedef struct slabhash_testdata testdata_t;
+typedef struct slabhash_testdata testdata_type;
/** delete key */
static void delkey(struct slabhash_testkey* k) {
lock_rw_destroy(&k->entry.lock); free(k);}
/** hash func, very bad to improve collisions, both high and low bits */
-static hashvalue_t myhash(int id) {
- hashvalue_t h = (hashvalue_t)id & 0x0f;
+static hashvalue_type myhash(int id) {
+ hashvalue_type h = (hashvalue_type)id & 0x0f;
h |= (h << 28);
return h;
}
/** allocate new key, fill in hash */
-static testkey_t* newkey(int id) {
- testkey_t* k = (testkey_t*)calloc(1, sizeof(testkey_t));
+static testkey_type* newkey(int id) {
+ testkey_type* k = (testkey_type*)calloc(1, sizeof(testkey_type));
if(!k) fatal_exit("out of memory");
k->id = id;
k->entry.hash = myhash(id);
@@ -70,9 +70,9 @@ static testkey_t* newkey(int id) {
return k;
}
/** new data el */
-static testdata_t* newdata(int val) {
- testdata_t* d = (testdata_t*)calloc(1,
- sizeof(testdata_t));
+static testdata_type* newdata(int val) {
+ testdata_type* d = (testdata_type*)calloc(1,
+ sizeof(testdata_type));
if(!d) fatal_exit("out of memory");
d->data = val;
return d;
@@ -82,10 +82,10 @@ static testdata_t* newdata(int val) {
static void
test_short_table(struct slabhash* table)
{
- testkey_t* k = newkey(12);
- testkey_t* k2 = newkey(14);
- testdata_t* d = newdata(128);
- testdata_t* d2 = newdata(129);
+ testkey_type* k = newkey(12);
+ testkey_type* k2 = newkey(14);
+ testdata_type* d = newdata(128);
+ testdata_type* d2 = newdata(129);
k->entry.data = d;
k2->entry.data = d2;
@@ -106,11 +106,11 @@ test_short_table(struct slabhash* table)
/** test adding a random element */
static void
-testadd(struct slabhash* table, testdata_t* ref[])
+testadd(struct slabhash* table, testdata_type* ref[])
{
int numtoadd = random() % HASHTESTMAX;
- testdata_t* data = newdata(numtoadd);
- testkey_t* key = newkey(numtoadd);
+ testdata_type* data = newdata(numtoadd);
+ testkey_type* key = newkey(numtoadd);
key->entry.data = data;
slabhash_insert(table, myhash(numtoadd), &key->entry, data, NULL);
ref[numtoadd] = data;
@@ -118,10 +118,10 @@ testadd(struct slabhash* table, testdata_t* ref[])
/** test adding a random element */
static void
-testremove(struct slabhash* table, testdata_t* ref[])
+testremove(struct slabhash* table, testdata_type* ref[])
{
int num = random() % HASHTESTMAX;
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
slabhash_remove(table, myhash(num), key);
ref[num] = NULL;
delkey(key);
@@ -129,12 +129,12 @@ testremove(struct slabhash* table, testdata_t* ref[])
/** test adding a random element */
static void
-testlookup(struct slabhash* table, testdata_t* ref[])
+testlookup(struct slabhash* table, testdata_type* ref[])
{
int num = random() % HASHTESTMAX;
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
struct lruhash_entry* en = slabhash_lookup(table, myhash(num), key, 0);
- testdata_t* data = en? (testdata_t*)en->data : NULL;
+ testdata_type* data = en? (testdata_type*)en->data : NULL;
if(en) {
unit_assert(en->key);
unit_assert(en->data);
@@ -193,11 +193,11 @@ check_table(struct slabhash* table)
/** test adding a random element (unlimited range) */
static void
-testadd_unlim(struct slabhash* table, testdata_t** ref)
+testadd_unlim(struct slabhash* table, testdata_type** ref)
{
int numtoadd = random() % (HASHTESTMAX * 10);
- testdata_t* data = newdata(numtoadd);
- testkey_t* key = newkey(numtoadd);
+ testdata_type* data = newdata(numtoadd);
+ testkey_type* key = newkey(numtoadd);
key->entry.data = data;
slabhash_insert(table, myhash(numtoadd), &key->entry, data, NULL);
if(ref)
@@ -206,10 +206,10 @@ testadd_unlim(struct slabhash* table, testdata_t** ref)
/** test adding a random element (unlimited range) */
static void
-testremove_unlim(struct slabhash* table, testdata_t** ref)
+testremove_unlim(struct slabhash* table, testdata_type** ref)
{
int num = random() % (HASHTESTMAX*10);
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
slabhash_remove(table, myhash(num), key);
if(ref)
ref[num] = NULL;
@@ -218,12 +218,12 @@ testremove_unlim(struct slabhash* table, testdata_t** ref)
/** test adding a random element (unlimited range) */
static void
-testlookup_unlim(struct slabhash* table, testdata_t** ref)
+testlookup_unlim(struct slabhash* table, testdata_type** ref)
{
int num = random() % (HASHTESTMAX*10);
- testkey_t* key = newkey(num);
+ testkey_type* key = newkey(num);
struct lruhash_entry* en = slabhash_lookup(table, myhash(num), key, 0);
- testdata_t* data = en? (testdata_t*)en->data : NULL;
+ testdata_type* data = en? (testdata_type*)en->data : NULL;
if(en) {
unit_assert(en->key);
unit_assert(en->data);
@@ -243,7 +243,7 @@ static void
test_long_table(struct slabhash* table)
{
/* assuming it all fits in the hashtable, this check will work */
- testdata_t* ref[HASHTESTMAX * 100];
+ testdata_type* ref[HASHTESTMAX * 100];
size_t i;
memset(ref, 0, sizeof(ref));
/* test assumption */
@@ -301,7 +301,7 @@ struct slab_test_thr {
/** thread num, first entry. */
int num;
/** id */
- ub_thread_t id;
+ ub_thread_type id;
/** hash table */
struct slabhash* table;
};
diff --git a/testcode/unitverify.c b/testcode/unitverify.c
index f6445e2815c40..b74ea5131b90a 100644
--- a/testcode/unitverify.c
+++ b/testcode/unitverify.c
@@ -412,7 +412,7 @@ nsectest(void)
/** Test hash algo - NSEC3 hash it and compare result */
static void
-nsec3_hash_test_entry(struct entry* e, rbtree_t* ct,
+nsec3_hash_test_entry(struct entry* e, rbtree_type* ct,
struct alloc_cache* alloc, struct regional* region,
sldns_buffer* buf)
{
@@ -468,7 +468,7 @@ nsec3_hash_test(const char* fname)
*
* The test does not perform canonicalization during the compare.
*/
- rbtree_t ct;
+ rbtree_type ct;
struct regional* region = regional_create();
struct alloc_cache alloc;
sldns_buffer* buf = sldns_buffer_new(65535);