- Neat function prototypes, unshadowed local declarations.

git-svn-id: file:///svn/unbound/trunk@2188 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards
2010-07-07 13:13:36 +00:00
parent 391e1912de
commit f042f0dd5d
58 changed files with 136 additions and 132 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ struct lookinfo {
static int num_wait = 0;
/** usage information for asynclook */
void usage(char* argv[])
static void usage(char* argv[])
{
printf("usage: %s [options] name ...\n", argv[0]);
printf("names are looked up at the same time, asynchronously.\n");
+5 -5
View File
@@ -68,7 +68,7 @@ int check_locking_order = 1;
static pid_t check_lock_pid;
/** print all possible debug info on the state of the system */
static void total_debug_info();
static void total_debug_info(void);
/** print pretty lock error and exit */
static void lock_error(struct checked_lock* lock,
@@ -674,7 +674,7 @@ static void* checklock_main(void* arg)
}
/** init the main thread */
void checklock_start()
void checklock_start(void)
{
if(!key_created) {
struct thr_check* thisthr = (struct thr_check*)calloc(1,
@@ -692,7 +692,7 @@ void checklock_start()
}
/** stop checklocks */
void checklock_stop()
void checklock_stop(void)
{
if(key_created) {
int i;
@@ -726,7 +726,7 @@ checklock_thrcreate(pthread_t* id, void* (*func)(void*), void* arg)
/** count number of thread infos */
static int
count_thread_infos()
count_thread_infos(void)
{
int cnt = 0;
int i;
@@ -795,7 +795,7 @@ thread_debug_info(struct thr_check* thr)
}
static void
total_debug_info()
total_debug_info(void)
{
int i;
log_info("checklocks: supervising %d threads.",
+2 -2
View File
@@ -206,12 +206,12 @@ size_t lock_get_mem(void* lock);
/**
* Initialise checklock. Sets up internal debug structures.
*/
void checklock_start();
void checklock_start(void);
/**
* Cleanup internal debug state.
*/
void checklock_stop();
void checklock_stop(void);
/**
* Init locks.
+1 -1
View File
@@ -139,7 +139,7 @@ struct tcp_proxy {
};
/** usage information for delayer */
void usage(char* argv[])
static void usage(char* argv[])
{
printf("usage: %s [options]\n", argv[0]);
printf(" -f addr : use addr, forward to that server, @port.\n");
+1 -1
View File
@@ -98,7 +98,7 @@ fake_event_init(struct replay_scenario* scen)
}
void
fake_event_cleanup()
fake_event_cleanup(void)
{
replay_scenario_delete(saved_scenario);
saved_scenario = NULL;
+1 -1
View File
@@ -61,7 +61,7 @@ void fake_event_init(struct replay_scenario* scen);
/**
* Deinit fake event services.
*/
void fake_event_cleanup();
void fake_event_cleanup(void);
/**
* Get filename to store temporary config stuff. The pid is added. in /tmp.
+6 -6
View File
@@ -492,13 +492,13 @@ qlist_parse_line(ldns_buffer* buf, char* p)
ldns_buffer_write_u16_at(buf, 0, 0); /* zero ID */
if(rec) LDNS_RD_SET(ldns_buffer_begin(buf));
if(edns) {
struct edns_data edns;
memset(&edns, 0, sizeof(edns));
edns.edns_present = 1;
edns.udp_size = EDNS_ADVERTISED_SIZE;
struct edns_data ed;
memset(&ed, 0, sizeof(ed));
ed.edns_present = 1;
ed.udp_size = EDNS_ADVERTISED_SIZE;
/* Set DO bit in all EDNS datagrams ... */
edns.bits = EDNS_DO;
attach_edns_record(buf, &edns);
ed.bits = EDNS_DO;
attach_edns_record(buf, &ed);
}
ldns_rdf_deep_free(rdf);
return 1;
+6 -6
View File
@@ -48,7 +48,7 @@
#include "testcode/readhex.h"
/** usage information for pktview */
void usage(char* argv[])
static void usage(char* argv[])
{
printf("usage: %s\n", argv[0]);
printf("present hex packet on stdin.\n");
@@ -56,7 +56,7 @@ void usage(char* argv[])
}
/** read hex input */
void read_input(ldns_buffer* pkt, FILE* in)
static void read_input(ldns_buffer* pkt, FILE* in)
{
char buf[102400];
char* np = buf;
@@ -69,7 +69,7 @@ void read_input(ldns_buffer* pkt, FILE* in)
}
/** analyze domain name in packet, possibly compressed */
void analyze_dname(ldns_buffer* pkt)
static void analyze_dname(ldns_buffer* pkt)
{
size_t oldpos = ldns_buffer_position(pkt);
size_t len;
@@ -84,7 +84,7 @@ void analyze_dname(ldns_buffer* pkt)
}
/** analyze rdata in packet */
void analyze_rdata(ldns_buffer*pkt, const ldns_rr_descriptor* desc,
static void analyze_rdata(ldns_buffer*pkt, const ldns_rr_descriptor* desc,
uint16_t rdlen)
{
int rdf = 0;
@@ -124,7 +124,7 @@ void analyze_rdata(ldns_buffer*pkt, const ldns_rr_descriptor* desc,
}
/** analyze rr in packet */
void analyze_rr(ldns_buffer* pkt, int q)
static void analyze_rr(ldns_buffer* pkt, int q)
{
uint16_t type, dclass, len;
uint32_t ttl;
@@ -150,7 +150,7 @@ void analyze_rr(ldns_buffer* pkt, int q)
}
/** analyse pkt */
void analyze(ldns_buffer* pkt)
static void analyze(ldns_buffer* pkt)
{
uint16_t i, f, qd, an, ns, ar;
int rrnum = 0;
+1 -1
View File
@@ -624,7 +624,7 @@ do_macro_recursion(rbtree_t* store, struct replay_runtime* runtime,
}
/** get var from store */
struct replay_var*
static struct replay_var*
macro_getvar(rbtree_t* store, char* name)
{
struct replay_var k;
+1 -1
View File
@@ -58,7 +58,7 @@
#endif
/** usage information for streamtcp */
void usage(char* argv[])
static void usage(char* argv[])
{
printf("usage: %s [options] name type class ...\n", argv[0]);
printf(" sends the name-type-class queries over TCP.\n");
+3 -3
View File
@@ -82,14 +82,14 @@ testbound_usage()
/**
* Add options from string to passed argc. splits on whitespace.
* @param optarg: the option argument, "-v -p 12345" or so.
* @param args: the option argument, "-v -p 12345" or so.
* @param pass_argc: ptr to the argc for unbound. Modified.
* @param pass_argv: the argv to pass to unbound. Modified.
*/
static void
add_opts(const char* optarg, int* pass_argc, char* pass_argv[])
add_opts(const char* args, int* pass_argc, char* pass_argv[])
{
const char *p = optarg, *np;
const char *p = args, *np;
size_t len;
while(p && isspace((int)*p))
p++;
+1 -1
View File
@@ -121,7 +121,7 @@ test_anchors(ldns_buffer* buff, struct val_anchors* a)
unit_assert(anchors_lookup(a, (uint8_t*)"\002oo\000", 4, c) == NULL);
}
void anchors_test()
void anchors_test(void)
{
ldns_buffer* buff = ldns_buffer_new(65800);
struct val_anchors* a;
+14 -14
View File
@@ -100,7 +100,7 @@ dname_test_qdtl(ldns_buffer* buff)
/** test query_dname_compare */
static void
dname_test_query_dname_compare()
dname_test_query_dname_compare(void)
{
unit_show_func("util/data/dname.c", "query_dname_compare");
unit_assert(query_dname_compare((uint8_t*)"", (uint8_t*)"") == 0);
@@ -130,7 +130,7 @@ dname_test_query_dname_compare()
/** test dname_count_labels */
static void
dname_test_count_labels()
dname_test_count_labels(void)
{
unit_show_func("util/data/dname.c", "dname_count_labels");
unit_assert(dname_count_labels((uint8_t*)"") == 1);
@@ -143,7 +143,7 @@ dname_test_count_labels()
/** test dname_count_size_labels */
static void
dname_test_count_size_labels()
dname_test_count_size_labels(void)
{
size_t sz = 0;
unit_show_func("util/data/dname.c", "dname_count_size_labels");
@@ -270,7 +270,7 @@ dname_test_pkt_dname_len(ldns_buffer* buff)
/** test dname_lab_cmp */
static void
dname_test_dname_lab_cmp()
dname_test_dname_lab_cmp(void)
{
int ml = 0; /* number of labels that matched exactly */
unit_show_func("util/data/dname.c", "dname_lab_cmp");
@@ -372,7 +372,7 @@ dname_test_dname_lab_cmp()
/** test dname_subdomain_c */
static void
dname_test_subdomain()
dname_test_subdomain(void)
{
unit_show_func("util/data/dname.c", "dname_subdomain");
unit_assert(dname_subdomain_c(
@@ -409,7 +409,7 @@ dname_test_subdomain()
/** test dname_strict_subdomain */
static void
dname_test_strict_subdomain()
dname_test_strict_subdomain(void)
{
unit_show_func("util/data/dname.c", "dname_strict_subdomain");
unit_assert(!dname_strict_subdomain(
@@ -446,7 +446,7 @@ dname_test_strict_subdomain()
/** test dname_is_root */
static void
dname_test_isroot()
dname_test_isroot(void)
{
unit_show_func("util/data/dname.c", "dname_isroot");
unit_assert(dname_is_root((uint8_t*)"\000"));
@@ -459,7 +459,7 @@ dname_test_isroot()
/** test dname_remove_label */
static void
dname_test_removelabel()
dname_test_removelabel(void)
{
uint8_t* orig = (uint8_t*)"\007example\003com\000";
uint8_t* n = orig;
@@ -478,7 +478,7 @@ dname_test_removelabel()
/** test dname_signame_label_count */
static void
dname_test_sigcount()
dname_test_sigcount(void)
{
unit_show_func("util/data/dname.c", "dname_signame_label_count");
unit_assert(dname_signame_label_count((uint8_t*)"\000") == 0);
@@ -498,7 +498,7 @@ dname_test_sigcount()
/** test dname_is_wild routine */
static void
dname_test_iswild()
dname_test_iswild(void)
{
unit_show_func("util/data/dname.c", "dname_iswild");
unit_assert( !dname_is_wild((uint8_t*)"\000") );
@@ -509,7 +509,7 @@ dname_test_iswild()
/** test dname_canonical_compare */
static void
dname_test_canoncmp()
dname_test_canoncmp(void)
{
unit_show_func("util/data/dname.c", "dname_canonical_compare");
/* equality */
@@ -729,7 +729,7 @@ dname_test_canoncmp()
/** Test dname_get_shared_topdomain */
static void
dname_test_topdomain()
dname_test_topdomain(void)
{
unit_show_func("util/data/dname.c", "dname_get_shared_topdomain");
unit_assert( query_dname_compare(
@@ -751,7 +751,7 @@ dname_test_topdomain()
/** Test dname_valid */
static void
dname_test_valid()
dname_test_valid(void)
{
unit_show_func("util/data/dname.c", "dname_valid");
unit_assert( dname_valid(
@@ -831,7 +831,7 @@ dname_setup_bufs(ldns_buffer* loopbuf, ldns_buffer* boundbuf)
ldns_buffer_flip(boundbuf);
}
void dname_test()
void dname_test(void)
{
ldns_buffer* loopbuf = ldns_buffer_new(14);
ldns_buffer* boundbuf = ldns_buffer_new(16);
+1 -1
View File
@@ -477,7 +477,7 @@ test_threaded_table(struct lruhash* table)
if(0) lruhash_status(table, "hashtest", 1);
}
void lruhash_test()
void lruhash_test(void)
{
/* start very very small array, so it can do lots of table_grow() */
/* also small in size so that reclaim has to be done quickly. */
+6 -6
View File
@@ -65,7 +65,7 @@ int testcount = 0;
#include "util/alloc.h"
/** test alloc code */
static void
alloc_test() {
alloc_test(void) {
alloc_special_t *t1, *t2;
struct alloc_cache major, minor1, minor2;
int i;
@@ -104,7 +104,7 @@ alloc_test() {
#include "util/net_help.h"
/** test net code */
static void
net_test()
net_test(void)
{
const char* t4[] = {"\000\000\000\000",
"\200\000\000\000",
@@ -309,7 +309,7 @@ net_test()
#include "util/config_file.h"
/** test config_file: cfg_parse_memsize */
static void
config_memsize_test()
config_memsize_test(void)
{
size_t v = 0;
unit_show_func("util/config_file.c", "cfg_parse_memsize");
@@ -348,7 +348,7 @@ config_memsize_test()
#include "util/rtt.h"
/** test RTT code */
static void
rtt_test()
rtt_test(void)
{
int init = 376;
int i;
@@ -375,7 +375,7 @@ rtt_test()
#include "util/config_file.h"
/** test host cache */
static void
infra_test()
infra_test(void)
{
struct sockaddr_storage one;
socklen_t onelen;
@@ -444,7 +444,7 @@ infra_test()
#include "util/random.h"
/** test randomness */
static void
rnd_test()
rnd_test(void)
{
struct ub_randstate* r;
int num = 1000, i;
+8 -8
View File
@@ -57,20 +57,20 @@ void unit_show_func(const char* file, const char* func);
void unit_show_feature(const char* feature);
/** unit test lruhashtable implementation */
void lruhash_test();
void lruhash_test(void);
/** unit test slabhashtable implementation */
void slabhash_test();
void slabhash_test(void);
/** unit test for msgreply and msgparse */
void msgparse_test();
void msgparse_test(void);
/** unit test dname handling functions */
void dname_test();
void dname_test(void);
/** unit test trust anchor storage functions */
void anchors_test();
void anchors_test(void);
/** unit test for verification functions */
void verify_test();
void verify_test(void);
/** unit test for negative cache functions */
void neg_test();
void neg_test(void);
/** unit test for regional allocator functions */
void regional_test();
void regional_test(void);
#endif /* TESTCODE_UNITMAIN_H */
+1 -1
View File
@@ -573,7 +573,7 @@ testfromdrillfile(ldns_buffer* pkt, struct alloc_cache* alloc,
fclose(in);
}
void msgparse_test()
void msgparse_test(void)
{
ldns_buffer* pkt = ldns_buffer_new(65553);
ldns_buffer* out = ldns_buffer_new(65553);
+2 -2
View File
@@ -91,7 +91,7 @@ static void print_neg_cache(struct val_neg_cache* neg)
}
/** get static pointer to random zone name */
static char* get_random_zone()
static char* get_random_zone(void)
{
static char zname[256];
int labels = random() % 3;
@@ -526,7 +526,7 @@ static void stress_test(struct val_neg_cache* neg)
}
}
void neg_test()
void neg_test(void)
{
struct val_neg_cache* neg;
srandom(48);
+3 -3
View File
@@ -195,7 +195,7 @@ corner_cases(struct regional* r)
/** test specific cases */
static void
specific_cases()
specific_cases(void)
{
struct regional* r = regional_create();
corner_cases(r);
@@ -228,7 +228,7 @@ burden_test(size_t max)
/** randomly allocate stuff */
static void
random_burden()
random_burden(void)
{
size_t max_alloc = 2048 + 128; /* small chance of LARGE */
int i;
@@ -236,7 +236,7 @@ random_burden()
burden_test(max_alloc);
}
void regional_test()
void regional_test(void)
{
unit_show_feature("regional");
specific_cases();
+1 -1
View File
@@ -356,7 +356,7 @@ test_threaded_table(struct slabhash* table)
if(0) slabhash_status(table, "hashtest", 1);
}
void slabhash_test()
void slabhash_test(void)
{
/* start very very small array, so it can do lots of table_grow() */
/* also small in size so that reclaim has to be done quickly. */
+2 -2
View File
@@ -343,7 +343,7 @@ unitest_nsec_has_type_rdata(char* bitmap, size_t len, uint16_t type)
/** Test NSEC type bitmap routine */
static void
nsectest()
nsectest(void)
{
/* bitmap starts at type bitmap rdata field */
/* from rfc 4034 example */
@@ -465,7 +465,7 @@ nsec3_hash_test(const char* fname)
}
void
verify_test()
verify_test(void)
{
unit_show_feature("signature verify");
verifytest_file("testdata/test_signatures.1", "20070818005004");