]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Neat function prototypes, unshadowed local declarations.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 7 Jul 2010 13:13:36 +0000 (13:13 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 7 Jul 2010 13:13:36 +0000 (13:13 +0000)
git-svn-id: file:///svn/unbound/trunk@2188 be551aaa-1e26-0410-a405-d3ace91eadb9

58 files changed:
daemon/acl_list.c
daemon/acl_list.h
daemon/daemon.c
daemon/daemon.h
daemon/remote.c
daemon/worker.c
doc/Changelog
iterator/iter_donotq.c
iterator/iter_donotq.h
iterator/iter_fwd.c
iterator/iter_fwd.h
iterator/iter_hints.c
iterator/iter_hints.h
iterator/iter_priv.c
iterator/iter_priv.h
iterator/iter_resptype.c
iterator/iterator.c
iterator/iterator.h
libunbound/libunbound.c
pythonmod/pythonmod.c
pythonmod/pythonmod.h
services/localzone.c
services/localzone.h
testcode/asynclook.c
testcode/checklocks.c
testcode/checklocks.h
testcode/delayer.c
testcode/fake_event.c
testcode/fake_event.h
testcode/perf.c
testcode/pktview.c
testcode/replay.c
testcode/streamtcp.c
testcode/testbound.c
testcode/unitanchor.c
testcode/unitdname.c
testcode/unitlruhash.c
testcode/unitmain.c
testcode/unitmain.h
testcode/unitmsgparse.c
testcode/unitneg.c
testcode/unitregional.c
testcode/unitslabhash.c
testcode/unitverify.c
util/config_file.c
util/config_file.h
util/locks.c
util/locks.h
util/netevent.c
util/regional.c
util/regional.h
util/timehist.c
util/timehist.h
validator/autotrust.c
validator/val_anchor.c
validator/val_anchor.h
validator/validator.c
validator/validator.h

index acc893a6cde23fdfdb3d5955469e0df47719f113..48c8e0fe4db41cd707c39601f127eadbd3e3b8e5 100644 (file)
@@ -47,7 +47,7 @@
 #include "util/net_help.h"
 
 struct acl_list* 
-acl_list_create()
+acl_list_create(void)
 {
        struct acl_list* acl = (struct acl_list*)calloc(1,
                sizeof(struct acl_list));
index 47c4c5293ee3df9d1e3cbf80ab27152551ab94dc..03ac301bf32d4a26be403e86c21cc664bf88053c 100644 (file)
@@ -89,7 +89,7 @@ struct acl_addr {
  * Create acl structure 
  * @return new structure or NULL on error.
  */
-struct acl_list* acl_list_create();
+struct acl_list* acl_list_create(void);
 
 /**
  * Delete acl structure.
index 6f22620eec474c78f83b3638d723e01fb0c9a374..9413247597ab23e8119f1c81583ab98bfa07907c 100644 (file)
@@ -131,7 +131,7 @@ static RETSIGTYPE record_sigh(int sig)
  * Stores signals to replay later.
  */
 static void
-signal_handling_record()
+signal_handling_record(void)
 {
        if( signal(SIGTERM, record_sigh) == SIG_ERR ||
 #ifdef SIGQUIT
@@ -169,7 +169,7 @@ signal_handling_playback(struct worker* wrk)
 }
 
 struct daemon* 
-daemon_init()
+daemon_init(void)
 {
        struct daemon* daemon = (struct daemon*)calloc(1, 
                sizeof(struct daemon));
@@ -276,7 +276,7 @@ static void daemon_setup_modules(struct daemon* daemon)
  * @param shufport: the portlist output.
  * @return number of ports available.
  */
-int daemon_get_shufport(struct daemon* daemon, int* shufport)
+static int daemon_get_shufport(struct daemon* daemon, int* shufport)
 {
        int i, n, k, temp;
        int avail = 0;
@@ -339,12 +339,13 @@ daemon_create_workers(struct daemon* daemon)
        free(shufport);
 }
 
+#ifdef THREADS_DISABLED
 /**
  * Close all pipes except for the numbered thread.
  * @param daemon: daemon to close pipes in.
  * @param thr: thread number 0..num-1 of thread to skip.
  */
-void close_other_pipes(struct daemon* daemon, int thr)
+static void close_other_pipes(struct daemon* daemon, int thr)
 {
        int i;
        for(i=0; i<daemon->num; i++)
@@ -359,6 +360,7 @@ void close_other_pipes(struct daemon* daemon, int thr)
                        }
                }
 }
+#endif /* THREADS_DISABLED */
 
 /**
  * Function to start one thread. 
index c170eeda6735607cd13993e9be1628b1ec5fd83b..e0feaf59cd7ad4ce7e6e85592f1c7349f2e2deb9 100644 (file)
@@ -108,7 +108,7 @@ struct daemon {
  * Initialize daemon structure.
  * @return: The daemon structure, or NULL on error.
  */
-struct daemon* daemon_init();
+struct daemon* daemon_init(void);
 
 /**
  * Open shared listening ports (if needed).
index 2d770d497c050b4cb844812c11f18dc7a4bffc03..b9391499f5d9369a66605836e0ced5de147fef65 100644 (file)
@@ -1618,7 +1618,7 @@ do_list_local_data(SSL* ssl, struct worker* worker)
 }
 
 /** tell other processes to execute the command */
-void
+static void
 distribute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd)
 {
        int i;
index c8df933897c544bf053f7f6f69206b4487a5412a..210b2043594657bf3827840860275b8bf1016054 100644 (file)
@@ -141,7 +141,7 @@ debug_total_mem(size_t calctotal)
 #endif /* UNBOUND_ALLOC_STATS */
 
 /** Report on memory usage by this thread and global */
-void
+static void
 worker_mem_report(struct worker* ATTR_UNUSED(worker), 
        struct serviced_query* ATTR_UNUSED(cur_serv))
 {
index 9bd9d0a8f1bfa126a4ac0877363621271f3bf198..1da8c683c8e65d3b48791015e641acd0cdf0a630 100644 (file)
@@ -1,3 +1,6 @@
+7 July 2010: Wouter
+       - Neat function prototypes, unshadowed local declarations.
+
 6 July 2010: Wouter
        - failure to chown the pidfile is not fatal any more.
        - testbound uses UTC timezone.
index cc2930ec35a168b9035c98d920cbf0298b0d770c..bd606335bcdc3f05d49ee35e9e33fb4071d56b01 100644 (file)
@@ -49,7 +49,7 @@
 #include "util/net_help.h"
 
 struct iter_donotq* 
-donotq_create()
+donotq_create(void)
 {
        struct iter_donotq* dq = (struct iter_donotq*)calloc(1,
                sizeof(struct iter_donotq));
index c90b0ab2a85ba23c7c59b16113e8314c6ade5c78..4c4fcb289dc35a323f0082be29ded6de7801028d 100644 (file)
@@ -65,7 +65,7 @@ struct iter_donotq {
  * Create donotqueryaddresses structure 
  * @return new structure or NULL on error.
  */
-struct iter_donotq* donotq_create();
+struct iter_donotq* donotq_create(void);
 
 /**
  * Delete donotqueryaddresses structure.
index c8b23391532e44b5a33e39c79c209e5f94fef7c0..4d3ff16a0c5c0d98b21d564805bfbb701ad6421f 100644 (file)
@@ -67,7 +67,7 @@ fwd_cmp(const void* k1, const void* k2)
 }
 
 struct iter_forwards* 
-forwards_create()
+forwards_create(void)
 {
        struct iter_forwards* fwd = (struct iter_forwards*)calloc(1,
                sizeof(struct iter_forwards));
index ea7bd22a16d1d26905f5f32c5c6616b815f8ea86..8f3bc1fa2f28d3ea81c13dac28d00728ecf0a7ce 100644 (file)
@@ -89,7 +89,7 @@ struct iter_forward_zone {
  * Create forwards 
  * @return new forwards or NULL on error.
  */
-struct iter_forwards* forwards_create();
+struct iter_forwards* forwards_create(void);
 
 /**
  * Delete forwards.
index 7ded6982359de3e5d5b2f765195b3547de69be72..d896d680f90d54a45be186a26aa985e501993ade 100644 (file)
@@ -51,7 +51,7 @@
 #include "util/data/dname.h"
 
 struct iter_hints* 
-hints_create()
+hints_create(void)
 {
        struct iter_hints* hints = (struct iter_hints*)calloc(1,
                sizeof(struct iter_hints));
index 8a3974489b46f48846bac23b1ad76729d675245e..4540971b0a43ba52318b1524b361f66d6047f955 100644 (file)
@@ -81,7 +81,7 @@ struct iter_hints_stub {
  * Create hints 
  * @return new hints or NULL on error.
  */
-struct iter_hints* hints_create();
+struct iter_hints* hints_create(void);
 
 /**
  * Delete hints.
index 2d97a93ad0661bf98c45077e16d86d844ce55c66..fcfe5d6771cba4564a5f29a609f3676c43140bcb 100644 (file)
@@ -51,7 +51,7 @@
 #include "util/net_help.h"
 #include "util/storage/dnstree.h"
 
-struct iter_priv* priv_create()
+struct iter_priv* priv_create(void)
 {
        struct iter_priv* priv = (struct iter_priv*)calloc(1, sizeof(*priv));
        if(!priv)
index 164f69cc764da8dd2f8773598127153f06743a08..8140559f70361500d1034407c519c153546f6c70 100644 (file)
@@ -74,7 +74,7 @@ struct iter_priv {
  * Create priv structure 
  * @return new structure or NULL on error.
  */
-struct iter_priv* priv_create();
+struct iter_priv* priv_create(void);
 
 /**
  * Delete priv structure.
index 5d4844720d31c2cf384e9ccf1231cb19e1ca6e37..a41ee55aec47dd00dcfe4c7e78c68289a14bfc40 100644 (file)
@@ -141,7 +141,7 @@ response_type_from_server(int rdset,
                 * answer is there directly, our answer is there after 
                 * a cname, or there is just a cname. */
                for(i=0; i<msg->rep->an_numrrsets; i++) {
-                       struct ub_packed_rrset_key* s = msg->rep->rrsets[i];
+                       s = msg->rep->rrsets[i];
                        
                        /* if the answer section has NS rrset, and qtype ANY 
                         * and the delegation is lower, and no CNAMEs followed,
index 8f662fbec8cf6b7b0c08e5a081dd23b740a778e8..f716be15a8b276108b82ca5ebc2548a5b5aac655 100644 (file)
@@ -463,8 +463,7 @@ handle_cname_response(struct module_qstate* qstate, struct iter_qstate* iq,
  * @param initial_state The initial response state (normally this
  *          is QUERY_RESP_STATE, unless it is known that the request won't
  *          need iterative processing
- * @param final_state The final state for the response to this
- *          request.
+ * @param finalstate The final state for the response to this request.
  * @param subq_ret: if newly allocated, the subquerystate, or NULL if it does
  *     not need initialisation.
  * @param v: if true, validation is done on the subquery.
@@ -474,13 +473,13 @@ static int
 generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype, 
        uint16_t qclass, struct module_qstate* qstate, int id,
        struct iter_qstate* iq, enum iter_state initial_state, 
-       enum iter_state final_state, struct module_qstate** subq_ret, int v)
+       enum iter_state finalstate, struct module_qstate** subq_ret, int v)
 {
        struct module_qstate* subq = NULL;
        struct iter_qstate* subiq = NULL;
        uint16_t qflags = 0; /* OPCODE QUERY, no flags */
        struct query_info qinf;
-       int prime = (final_state == PRIME_RESP_STATE)?1:0;
+       int prime = (finalstate == PRIME_RESP_STATE)?1:0;
        qinf.qname = qname;
        qinf.qname_len = qnamelen;
        qinf.qtype = qtype;
@@ -523,7 +522,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
                subiq->depth = iq->depth+1;
                outbound_list_init(&subiq->outlist);
                subiq->state = initial_state;
-               subiq->final_state = final_state;
+               subiq->final_state = finalstate;
                subiq->qchase = subq->qinfo;
                subiq->chase_flags = subq->query_flags;
                subiq->refetch_glue = 0;
@@ -2672,7 +2671,7 @@ static struct module_func_block iter_block = {
 };
 
 struct module_func_block* 
-iter_get_funcblock()
+iter_get_funcblock(void)
 {
        return &iter_block;
 }
index 59dd4b16be3dd3f5c80362371a192a8479df8ed8..a2d3eab479f76c708c3bea6df12624fd40e4932c 100644 (file)
@@ -314,7 +314,7 @@ struct iter_prep_list {
  * Get the iterator function block.
  * @return: function block with function pointers to iterator methods.
  */
-struct module_func_block* iter_get_funcblock();
+struct module_func_block* iter_get_funcblock(void);
 
 /**
  * Get iterator state as a string
index 804eb96759c864e6ef736d280c6c783649cbab96..e75eb1c7ec07d144967cd8ab2ef919bcc09339f5 100644 (file)
@@ -67,7 +67,7 @@
 #endif /* UB_ON_WINDOWS */
 
 struct ub_ctx* 
-ub_ctx_create()
+ub_ctx_create(void)
 {
        struct ub_ctx* ctx;
        unsigned int seed;
index 1753869e50e23a0f629aad1e7818582fe786a120..d253cd274131ce673bab34b7dcadbf1e32b51ece 100644 (file)
@@ -375,7 +375,7 @@ static struct module_func_block pythonmod_block = {
    &pythonmod_clear, &pythonmod_get_mem
 };
 
-struct module_func_block* pythonmod_get_funcblock()
+struct module_func_block* pythonmod_get_funcblock(void)
 {
    return &pythonmod_block;
 }
index fef8067139bf0871a1bdb6bab368bda5bce4e852..b108cf9234c141fd9d26282f5957b0fc650b8337 100644 (file)
@@ -46,7 +46,7 @@
  * Get the module function block.
  * @return: function block with function pointers to module methods.
  */
-struct module_func_block* pythonmod_get_funcblock();
+struct module_func_block* pythonmod_get_funcblock(void);
 
 /** python module init */
 int pythonmod_init(struct module_env* env, int id);
index 248d45f9b4a46d366a29432a181ddbe33142afb0..452d043e9ba8af460077a2ca506f37d85fd875aa 100644 (file)
@@ -52,7 +52,7 @@
 #include "util/data/msgparse.h"
 
 struct local_zones* 
-local_zones_create()
+local_zones_create(void)
 {
        struct local_zones* zones = (struct local_zones*)calloc(1, 
                sizeof(*zones));
@@ -290,7 +290,7 @@ get_rr_nameclass(const char* str, uint8_t** nm, uint16_t* dclass)
  * @param type: type to look for (host order).
  * @return rrset pointer or NULL if not found.
  */
-struct local_rrset*
+static struct local_rrset*
 local_data_find_type(struct local_data* data, uint16_t type)
 {
        struct local_rrset* p;
index ed05a583139abe1c9a65582f13a206e1b74e70b8..38f4524e571a546711210745fd3712f5d4e0d882 100644 (file)
@@ -149,7 +149,7 @@ struct local_rrset {
  * Create local zones storage
  * @return new struct or NULL on error.
  */
-struct local_zones* local_zones_create();
+struct local_zones* local_zones_create(void);
 
 /**
  * Delete local zones storage
index 6abab7b2233d4676e9438d94595a66ed3ff2ec6a..7ec013c0cb9f566e5dcfbde5187e0c0a1b836c94 100644 (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");
index 520e6ddd16770bdbed6917c6e892f00ac2f9b98c..68cd419df2623d365db43be39e9e9720bd6f0ba0 100644 (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.",
index cf62cb58dd63dcbd2ee37ec1f7028471a4ae9483..de901da9afbacde2b537e34b8eab0b40543ecce2 100644 (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.
index b3b6ffcdbc1e2b832c13ac1bcb80021054157308..b42a3b1aa7cd93b4d6e042f221aa394e48421dce 100644 (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");
index 1fd80d2b1d9a1b86c417fad61014d00b3abead54..15c1ef5270a8154ce10b27eeb102ef4104a9aea9 100644 (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;
index 236be03b68446cea9892a47bd37caf012415a1ce..1a73de824c11dba77e6bbd649fbf57d031b7ee11 100644 (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.
index e079a19eaa457c43c023284f30e2aebe78ff9c2b..8dd697d5259a7b729897ec77bbe2ca2bc0d1bc72 100644 (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;
index 494f8e7b3b3375f25bd11041b0565fa313d81a69..fe202e71de8a1536d12da50c87b38a1f6cfdd1ee 100644 (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;
index 375fe2653f37b08cc57de521af1778c57157f056..c8b23fee196b00fa9fd400f9b3ed38e35446522d 100644 (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;
index 7dbac38fa313b650e502e3a3d528dc991a43e3c5..39d2db3178f206a0a6271741b1f8e3c8b7bbbd53 100644 (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");
index b283c11d928e482d78ebcbc40d771e15067bb3dd..c28b8bca750ca14eeddc5eec508c02a636906b32 100644 (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++;
index 346b417b778270ae83d0e916f3d11315b3b7e77c..e79eef098c36e282c9cd7620744c7353bb5ecfe4 100644 (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;
index fda2fd4e01ae11d7038e8d42e4fe01df03c541c5..6a078a6a378f0d42b3f84c9c4e84548d5bde83eb 100644 (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);
index 048ed5531528897be194531bed5f30a5404e040c..3bb7c26267d199eef09956f5bd7180be79cea09e 100644 (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. */
index 6258316c9f4bb3dee28e5c07ebecce4ed93e4e2b..c0985106c337feedf178ba4169f90d1e42a711de 100644 (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;
index fb4319b18b60779d4f22fef291e1fda0c8f4110d..6cfad3eb545d253571510d880a42720a5993cf69 100644 (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 */
index d1ef854bdd96d5f546896b4f2fdafcd421f823ca..1d4d1a3f291100d2255f2ec3ed3292118dc90328 100644 (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);
index f71d0d346e62273fc03172c072875b5cb778fa21..e18aefc34b679771f45b8036f244bb7241e3f613 100644 (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);
index 3d9223f3ad80d5f9e2a39983a8317a0eb8abced5..93249deb4ee49862f87bb3685d1201839feba090 100644 (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();
index 149cccc8be2e1a327cf2b9ed8b777c2b52fb309c..70f1c58b0ecd38e231077f58d46ba0546e81e97f 100644 (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. */
index ec8f2b10ad921a9807e7134b00847ae140e65240..4679cef8d76d43c38ef7125f098a90d2427d5496 100644 (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");
index ec0866c2500016c4709dc5b65393468719e49d1c..a406ac97001b74aa2863ab860168f1e819ef76bd 100644 (file)
@@ -70,7 +70,7 @@ int ub_c_wrap(void);
 static void init_outgoing_availports(int* array, int num);
 
 struct config_file* 
-config_create()
+config_create(void)
 {
        struct config_file* cfg;
        cfg = (struct config_file*)calloc(1, sizeof(struct config_file));
@@ -198,7 +198,7 @@ error_exit:
        return NULL;
 }
 
-struct config_file* config_create_forlib()
+struct config_file* config_create_forlib(void)
 {
        struct config_file* cfg = config_create();
        if(!cfg) return NULL;
@@ -848,7 +848,7 @@ int cfg_condense_ports(struct config_file* cfg, int** avail)
 }
 
 /** print error with file and line number */
-void ub_c_error_va_list(const char *fmt, va_list args)
+static void ub_c_error_va_list(const char *fmt, va_list args)
 {
        cfg_parser->errors++;
        fprintf(stderr, "%s:%d: error: ", cfg_parser->filename,
@@ -873,7 +873,7 @@ void ub_c_error(const char *str)
                cfg_parser->line, str);
 }
 
-int ub_c_wrap()
+int ub_c_wrap(void)
 {
        return 1;
 }
index 0ad374f449b93a988f98ebf7d3537eebfcca13ad..85e781c6337eca215b896800e3a6c450340a2a3e 100644 (file)
@@ -327,13 +327,13 @@ struct config_strlist_head {
  * Create config file structure. Filled with default values.
  * @return: the new structure or NULL on memory error.
  */
-struct config_file* config_create();
+struct config_file* config_create(void);
 
 /**
  * Create config file structure for library use. Filled with default values.
  * @return: the new structure or NULL on memory error.
  */
-struct config_file* config_create_forlib();
+struct config_file* config_create_forlib(void);
 
 /**
  * Read the config file from the specified filename.
index 272eb7a8e273cf1cfa1b3384cd1052853475863e..425f9b9d4568212ab61921c1946b69916d158d34 100644 (file)
@@ -48,7 +48,7 @@
 
 /** block all signals, masks them away. */
 void 
-ub_thread_blocksigs()
+ub_thread_blocksigs(void)
 {
 #if defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS) || defined(HAVE_SIGPROCMASK)
 #  if defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS)
index 911b7ce1d80cd7018d3841fd55c3314e5ee173d3..91be5c3e26f806b4639cc72b99e01efe79fc8f59 100644 (file)
  * The errno is logged to the logfile with a descriptive comment.
  */
 #define LOCKRET(func) do {\
-       int err;                \
-       if( (err=(func)) != 0)          \
+       int lockret_err;                \
+       if( (lockret_err=(func)) != 0)          \
                log_err("%s at %d could not " #func ": %s", \
-               __FILE__, __LINE__, strerror(err));     \
+               __FILE__, __LINE__, strerror(lockret_err));     \
        } while(0)
 
 /** DEBUG: use thread debug whenever possible */
@@ -283,7 +283,7 @@ typedef void* ub_thread_key_t;
  * Block all signals for this thread.
  * fatal exit on error.
  */
-void ub_thread_blocksigs();
+void ub_thread_blocksigs(void);
 
 /**
  * unblock one signal for this thread.
index a04a7cfccd23bc9f8a9b9b8b3507397013a7a4cb..8b479bfb1aa90b75a335a83b75c9872da6fd6ca9 100644 (file)
@@ -333,7 +333,7 @@ comm_point_send_udp_msg(struct comm_point *c, ldns_buffer* packet,
 }
 
 /** print debug ancillary info */
-void p_ancil(const char* str, struct comm_reply* r)
+static void p_ancil(const char* str, struct comm_reply* r)
 {
 #if defined(AF_INET6) && defined(IPV6_PKTINFO) && (defined(HAVE_RECVMSG) || defined(HAVE_SENDMSG))
        if(r->srctype != 4 && r->srctype != 6) {
@@ -380,7 +380,7 @@ void p_ancil(const char* str, struct comm_reply* r)
 }
 
 /** send a UDP reply over specified interface*/
-int
+static int
 comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
        struct sockaddr* addr, socklen_t addrlen, struct comm_reply* r) 
 {
@@ -482,7 +482,7 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
        struct comm_reply rep;
        struct msghdr msg;
        struct iovec iov[1];
-       ssize_t recv;
+       ssize_t rcv;
        char ancil[256];
        int i;
 #ifndef S_SPLINT_S
@@ -512,15 +512,15 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
                msg.msg_controllen = sizeof(ancil);
 #endif /* S_SPLINT_S */
                msg.msg_flags = 0;
-               recv = recvmsg(fd, &msg, 0);
-               if(recv == -1) {
+               rcv = recvmsg(fd, &msg, 0);
+               if(rcv == -1) {
                        if(errno != EAGAIN && errno != EINTR) {
                                log_err("recvmsg failed: %s", strerror(errno));
                        }
                        return;
                }
                rep.addrlen = msg.msg_namelen;
-               ldns_buffer_skip(rep.c->buffer, recv);
+               ldns_buffer_skip(rep.c->buffer, rcv);
                ldns_buffer_flip(rep.c->buffer);
                rep.srctype = 0;
 #ifndef S_SPLINT_S
@@ -574,7 +574,7 @@ void
 comm_point_udp_callback(int fd, short event, void* arg)
 {
        struct comm_reply rep;
-       ssize_t recv;
+       ssize_t rcv;
        int i;
 
        rep.c = (struct comm_point*)arg;
@@ -589,10 +589,10 @@ comm_point_udp_callback(int fd, short event, void* arg)
                rep.addrlen = (socklen_t)sizeof(rep.addr);
                log_assert(fd != -1);
                log_assert(ldns_buffer_remaining(rep.c->buffer) > 0);
-               recv = recvfrom(fd, (void*)ldns_buffer_begin(rep.c->buffer), 
+               rcv = recvfrom(fd, (void*)ldns_buffer_begin(rep.c->buffer), 
                        ldns_buffer_remaining(rep.c->buffer), 0, 
                        (struct sockaddr*)&rep.addr, &rep.addrlen);
-               if(recv == -1) {
+               if(rcv == -1) {
 #ifndef USE_WINSOCK
                        if(errno != EAGAIN && errno != EINTR)
                                log_err("recvfrom %d failed: %s", 
@@ -606,7 +606,7 @@ comm_point_udp_callback(int fd, short event, void* arg)
 #endif
                        return;
                }
-               ldns_buffer_skip(rep.c->buffer, recv);
+               ldns_buffer_skip(rep.c->buffer, rcv);
                ldns_buffer_flip(rep.c->buffer);
                rep.srctype = 0;
                fptr_ok(fptr_whitelist_comm_point(rep.c->callback));
index 37f243909fdd40f05d680e35d8afebb73e0793ac..8b1fcdbb2ac8b68828d2a460b4661cc8ba72939f 100644 (file)
@@ -63,7 +63,7 @@
 #endif
 
 struct regional* 
-regional_create()
+regional_create(void)
 {
        return regional_create_custom(REGIONAL_CHUNK_SIZE);
 }
index 6090b8804a0b22375d4901fa7fec9ef1d68f8551..250523a6d9b248877606cbc28d5c3dcc1cc9bf80 100644 (file)
@@ -80,7 +80,7 @@ struct regional
  * Create a new regional.
  * @return: newly allocated regional.
  */
-struct regional* regional_create();
+struct regional* regional_create(void);
 
 /**
  * Create a new region, with custom settings.
index 02d5df0597fb2399445c5d73a95a3656605690af..38e642778cd2a9f3612648c5022624a465374ba1 100644 (file)
@@ -80,7 +80,7 @@ dosetup(struct timehist* hist)
        }
 }
 
-struct timehist* timehist_setup()
+struct timehist* timehist_setup(void)
 {
        struct timehist* hist = (struct timehist*)calloc(1, 
                sizeof(struct timehist));
@@ -184,7 +184,7 @@ void timehist_log(struct timehist* hist, const char* name)
 }
 
 /** total number in histogram */
-size_t
+static size_t
 timehist_count(struct timehist* hist)
 {
        size_t i, res = 0;
index ab23f0128f239b5dad2bacdfe8d384afe011215c..d59448399b9b6b5d4ac82c64df568e7f92a77e33 100644 (file)
@@ -71,7 +71,7 @@ struct timehist {
  * Setup a histogram, default
  * @return histogram or NULL on malloc failure.
  */
-struct timehist* timehist_setup();
+struct timehist* timehist_setup(void);
 
 /**
  * Delete histogram
index b1170ed7f248039602df5a309efa445a1cdee1de..f31f627920b9ef4dd5c054647fea00d647621aa0 100644 (file)
@@ -2001,19 +2001,19 @@ autr_debug_print_tp(struct trust_anchor* tp)
        log_info("assembled %d DS and %d DNSKEYs", 
                (int)tp->numDS, (int)tp->numDNSKEY);
        if(0) { /* turned off because it prints to stderr */
-               ldns_buffer* buf = ldns_buffer_new(70000);
+               ldns_buffer* bf = ldns_buffer_new(70000);
                ldns_rr_list* list;
                if(tp->ds_rrset) {
-                       list = packed_rrset_to_rr_list(tp->ds_rrset, buf);
+                       list = packed_rrset_to_rr_list(tp->ds_rrset, bf);
                        ldns_rr_list_print(stderr, list);
                        ldns_rr_list_deep_free(list);
                }
                if(tp->dnskey_rrset) {
-                       list = packed_rrset_to_rr_list(tp->dnskey_rrset, buf);
+                       list = packed_rrset_to_rr_list(tp->dnskey_rrset, bf);
                        ldns_rr_list_print(stderr, list);
                        ldns_rr_list_deep_free(list);
                }
-               ldns_buffer_free(buf);
+               ldns_buffer_free(bf);
        }
        log_info("file %s", tp->autr->file);
        ctime_r(&tp->autr->last_queried, buf);
index 0b4ca4259cad80ce6c5e44cf3358e6fb48b2f997..97bec6a5f219ec3b4e787dc1edaf694be05f24fa 100644 (file)
@@ -72,7 +72,7 @@ anchor_cmp(const void* k1, const void* k2)
 }
 
 struct val_anchors* 
-anchors_create()
+anchors_create(void)
 {
        struct val_anchors* a = (struct val_anchors*)calloc(1, sizeof(*a));
        if(!a)
index 5a5fa4855429280f980307050db59ba4bec562d0..d2f3afc43f19753e35fd5269eb7ad5a1664f335c 100644 (file)
@@ -132,7 +132,7 @@ struct trust_anchor {
  * Create trust anchor storage
  * @return new storage or NULL on error.
  */
-struct val_anchors* anchors_create();
+struct val_anchors* anchors_create(void);
 
 /**
  * Delete trust anchor storage.
index f46656df694a9a313bc5f6b4abe23492aa7c0bbf..a8cb07279937de8add5d0a6a4b0a5cc809e45405 100644 (file)
@@ -2918,7 +2918,7 @@ static struct module_func_block val_block = {
 };
 
 struct module_func_block* 
-val_get_funcblock()
+val_get_funcblock(void)
 {
        return &val_block;
 }
index bad08479078e801ad74ab05373c370283c34ce31..18e905efcd2b6afb8f35c08311b7380735377176 100644 (file)
@@ -250,7 +250,7 @@ struct val_qstate {
  * Get the validator function block.
  * @return: function block with function pointers to validator methods.
  */
-struct module_func_block* val_get_funcblock();
+struct module_func_block* val_get_funcblock(void);
 
 /**
  * Get validator state as a string