mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- fix various compiler warnings (reported by Paul Wouters).
git-svn-id: file:///svn/unbound/trunk@2497 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
c4cac78f10
commit
b72d40f3dd
7 changed files with 76 additions and 16 deletions
|
|
@ -3,6 +3,7 @@
|
|||
unused functions in lookup3.c.
|
||||
- iana portlist updated.
|
||||
- fix EDNS1480 change memleak and TCP fallback.
|
||||
- fix various compiler warnings (reported by Paul Wouters).
|
||||
|
||||
15 September 2011: Wouter
|
||||
- release 1.4.13.
|
||||
|
|
|
|||
|
|
@ -301,7 +301,9 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
}
|
||||
/* see if it already exists, if not, create one */
|
||||
if(!s) {
|
||||
#ifdef UNBOUND_DEBUG
|
||||
struct rbnode_t* n;
|
||||
#endif
|
||||
s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0);
|
||||
if(!s) {
|
||||
log_err("mesh_state_create: out of memory; SERVFAIL");
|
||||
|
|
@ -310,7 +312,10 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
comm_point_send_reply(rep);
|
||||
return;
|
||||
}
|
||||
n = rbtree_insert(&mesh->all, &s->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &s->node);
|
||||
log_assert(n != NULL);
|
||||
/* set detached (it is now) */
|
||||
mesh->num_detached_states++;
|
||||
|
|
@ -369,12 +374,17 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
|
||||
/* see if it already exists, if not, create one */
|
||||
if(!s) {
|
||||
#ifdef UNBOUND_DEBUG
|
||||
struct rbnode_t* n;
|
||||
#endif
|
||||
s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0);
|
||||
if(!s) {
|
||||
return 0;
|
||||
}
|
||||
n = rbtree_insert(&mesh->all, &s->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &s->node);
|
||||
log_assert(n != NULL);
|
||||
/* set detached (it is now) */
|
||||
mesh->num_detached_states++;
|
||||
|
|
@ -408,7 +418,9 @@ void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
uint16_t qflags, uint32_t leeway)
|
||||
{
|
||||
struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
struct rbnode_t* n;
|
||||
#endif
|
||||
/* already exists, and for a different purpose perhaps.
|
||||
* if mesh_no_list, keep it that way. */
|
||||
if(s) {
|
||||
|
|
@ -429,7 +441,10 @@ void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
|
|||
log_err("prefetch mesh_state_create: out of memory");
|
||||
return;
|
||||
}
|
||||
n = rbtree_insert(&mesh->all, &s->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &s->node);
|
||||
log_assert(n != NULL);
|
||||
/* set detached (it is now) */
|
||||
mesh->num_detached_states++;
|
||||
|
|
@ -627,11 +642,16 @@ void mesh_detach_subs(struct module_qstate* qstate)
|
|||
{
|
||||
struct mesh_area* mesh = qstate->env->mesh;
|
||||
struct mesh_state_ref* ref, lookup;
|
||||
#ifdef UNBOUND_DEBUG
|
||||
struct rbnode_t* n;
|
||||
#endif
|
||||
lookup.node.key = &lookup;
|
||||
lookup.s = qstate->mesh_info;
|
||||
RBTREE_FOR(ref, struct mesh_state_ref*, &qstate->mesh_info->sub_set) {
|
||||
n = rbtree_delete(&ref->s->super_set, &lookup);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_delete(&ref->s->super_set, &lookup);
|
||||
log_assert(n != NULL); /* must have been present */
|
||||
if(!ref->s->reply_list && !ref->s->cb_list
|
||||
&& ref->s->super_set.count == 0) {
|
||||
|
|
@ -654,14 +674,19 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo,
|
|||
return 0;
|
||||
}
|
||||
if(!sub) {
|
||||
#ifdef UNBOUND_DEBUG
|
||||
struct rbnode_t* n;
|
||||
#endif
|
||||
/* create a new one */
|
||||
sub = mesh_state_create(qstate->env, qinfo, qflags, prime);
|
||||
if(!sub) {
|
||||
log_err("mesh_attach_sub: out of memory");
|
||||
return 0;
|
||||
}
|
||||
n = rbtree_insert(&mesh->all, &sub->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_insert(&mesh->all, &sub->node);
|
||||
log_assert(n != NULL);
|
||||
/* set detached (it is now) */
|
||||
mesh->num_detached_states++;
|
||||
|
|
@ -684,7 +709,9 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo,
|
|||
|
||||
int mesh_state_attachment(struct mesh_state* super, struct mesh_state* sub)
|
||||
{
|
||||
#ifdef UNBOUND_DEBUG
|
||||
struct rbnode_t* n;
|
||||
#endif
|
||||
struct mesh_state_ref* subref; /* points to sub, inserted in super */
|
||||
struct mesh_state_ref* superref; /* points to super, inserted in sub */
|
||||
if( !(subref = regional_alloc(super->s.region,
|
||||
|
|
@ -698,9 +725,15 @@ int mesh_state_attachment(struct mesh_state* super, struct mesh_state* sub)
|
|||
superref->s = super;
|
||||
subref->node.key = subref;
|
||||
subref->s = sub;
|
||||
n = rbtree_insert(&sub->super_set, &superref->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_insert(&sub->super_set, &superref->node);
|
||||
log_assert(n != NULL);
|
||||
n = rbtree_insert(&super->sub_set, &subref->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_insert(&super->sub_set, &subref->node);
|
||||
log_assert(n != NULL);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1145,7 +1145,9 @@ serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec,
|
|||
int want_dnssec, struct sockaddr_storage* addr, socklen_t addrlen)
|
||||
{
|
||||
struct serviced_query* sq = (struct serviced_query*)malloc(sizeof(*sq));
|
||||
#ifdef UNBOUND_DEBUG
|
||||
rbnode_t* ins;
|
||||
#endif
|
||||
if(!sq)
|
||||
return NULL;
|
||||
sq->node.key = sq;
|
||||
|
|
@ -1165,7 +1167,10 @@ serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec,
|
|||
sq->status = serviced_initial;
|
||||
sq->retry = 0;
|
||||
sq->to_be_deleted = 0;
|
||||
ins = rbtree_insert(outnet->serviced, &sq->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
ins =
|
||||
#endif
|
||||
rbtree_insert(outnet->serviced, &sq->node);
|
||||
log_assert(ins != NULL); /* must not be already present */
|
||||
return sq;
|
||||
}
|
||||
|
|
@ -1401,11 +1406,13 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c,
|
|||
int dobackup = (sq->cblist && sq->cblist->next); /* >1 cb*/
|
||||
uint8_t *backup_p = NULL;
|
||||
size_t backlen = 0;
|
||||
rbnode_t* rem;
|
||||
#ifdef UNBOUND_DEBUG
|
||||
rbnode_t* rem =
|
||||
#endif
|
||||
/* remove from tree, and schedule for deletion, so that callbacks
|
||||
* can safely deregister themselves and even create new serviced
|
||||
* queries that are identical to this one. */
|
||||
rem = rbtree_delete(sq->outnet->serviced, sq);
|
||||
rbtree_delete(sq->outnet->serviced, sq);
|
||||
log_assert(rem); /* should have been present */
|
||||
sq->to_be_deleted = 1;
|
||||
verbose(VERB_ALGO, "svcd callbacks start");
|
||||
|
|
@ -1798,8 +1805,10 @@ void outnet_serviced_query_stop(struct serviced_query* sq, void* cb_arg)
|
|||
callback_list_remove(sq, cb_arg);
|
||||
/* if callbacks() routine scheduled deletion, let it do that */
|
||||
if(!sq->cblist && !sq->to_be_deleted) {
|
||||
rbnode_t* rem;
|
||||
rem = rbtree_delete(sq->outnet->serviced, sq);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
rbnode_t* rem =
|
||||
#endif
|
||||
rbtree_delete(sq->outnet->serviced, sq);
|
||||
log_assert(rem); /* should be present */
|
||||
serviced_delete(sq);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1583,7 +1583,9 @@ xml_parse(BIO* xml, time_t now)
|
|||
(void)BIO_seek(data.ds, 0);
|
||||
len = BIO_get_mem_data(data.ds, &pp);
|
||||
printf("got DS bio %d: '", len);
|
||||
(void)fwrite(pp, (size_t)len, 1, stdout);
|
||||
if(!fwrite(pp, (size_t)len, 1, stdout))
|
||||
/* compilers do not allow us to ignore fwrite .. */
|
||||
fprintf(stderr, "error writing to stdout\n");
|
||||
printf("'\n");
|
||||
}
|
||||
BIO_free(data.czone);
|
||||
|
|
|
|||
|
|
@ -869,7 +869,9 @@ print_id(FILE* out, char* fname, struct module_env* env,
|
|||
uint8_t* nm, size_t nmlen, uint16_t dclass)
|
||||
{
|
||||
ldns_rdf rdf;
|
||||
#ifdef UNBOUND_DEBUG
|
||||
ldns_status s;
|
||||
#endif
|
||||
|
||||
memset(&rdf, 0, sizeof(rdf));
|
||||
ldns_rdf_set_data(&rdf, nm);
|
||||
|
|
@ -877,7 +879,10 @@ print_id(FILE* out, char* fname, struct module_env* env,
|
|||
ldns_rdf_set_type(&rdf, LDNS_RDF_TYPE_DNAME);
|
||||
|
||||
ldns_buffer_clear(env->scratch_buffer);
|
||||
s = ldns_rdf2buffer_str_dname(env->scratch_buffer, &rdf);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
s =
|
||||
#endif
|
||||
ldns_rdf2buffer_str_dname(env->scratch_buffer, &rdf);
|
||||
log_assert(s == LDNS_STATUS_OK);
|
||||
ldns_buffer_write_u8(env->scratch_buffer, 0);
|
||||
ldns_buffer_flip(env->scratch_buffer);
|
||||
|
|
|
|||
|
|
@ -195,7 +195,9 @@ static struct trust_anchor*
|
|||
anchor_new_ta(struct val_anchors* anchors, uint8_t* name, int namelabs,
|
||||
size_t namelen, uint16_t dclass)
|
||||
{
|
||||
#ifdef UNBOUND_DEBUG
|
||||
rbnode_t* r;
|
||||
#endif
|
||||
struct trust_anchor* ta = (struct trust_anchor*)regional_alloc(
|
||||
anchors->region, sizeof(struct trust_anchor));
|
||||
if(!ta)
|
||||
|
|
@ -210,7 +212,10 @@ anchor_new_ta(struct val_anchors* anchors, uint8_t* name, int namelabs,
|
|||
ta->dclass = dclass;
|
||||
lock_basic_init(&ta->lock);
|
||||
lock_basic_lock(&anchors->lock);
|
||||
r = rbtree_insert(anchors->tree, &ta->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
r =
|
||||
#endif
|
||||
rbtree_insert(anchors->tree, &ta->node);
|
||||
lock_basic_unlock(&anchors->lock);
|
||||
log_assert(r != NULL);
|
||||
return ta;
|
||||
|
|
|
|||
|
|
@ -643,7 +643,9 @@ nsec3_hash_name(rbtree_t* table, struct regional* region, ldns_buffer* buf,
|
|||
{
|
||||
struct nsec3_cached_hash* c;
|
||||
struct nsec3_cached_hash looki;
|
||||
#ifdef UNBOUND_DEBUG
|
||||
rbnode_t* n;
|
||||
#endif
|
||||
int r;
|
||||
looki.node.key = &looki;
|
||||
looki.nsec3 = nsec3;
|
||||
|
|
@ -670,7 +672,10 @@ nsec3_hash_name(rbtree_t* table, struct regional* region, ldns_buffer* buf,
|
|||
r = nsec3_calc_b32(region, buf, c);
|
||||
if(r != 1)
|
||||
return r;
|
||||
n = rbtree_insert(table, &c->node);
|
||||
#ifdef UNBOUND_DEBUG
|
||||
n =
|
||||
#endif
|
||||
rbtree_insert(table, &c->node);
|
||||
log_assert(n); /* cannot be duplicate, just did lookup */
|
||||
*hash = c;
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue