fix some compiler warnings

Wouter Wijngaards wouter at nlnetlabs.nl
Thu Jan 24 16:15:05 UTC 2019


Hi Florian,

Thank you very much for the fixes, I have included them. I think it is
good to remove the warnings output by the automated code checker.

Best regards, Wouter

On 1/24/19 4:17 PM, Florian Obser via Unbound-users wrote:
> Thanks,
> Florian
> 
> commit 296dec9d464ca5ac2e79fb6a82fdb6c07c387ba0
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:27:54 2019 +0100
> 
>     include mini_event.h to have a prototype for mini_ev_cmp
> 
> diff --git util/mini_event.c util/mini_event.c
> index 14e9efe4790..ee517b263a0 100644
> --- util/mini_event.c
> +++ util/mini_event.c
> @@ -41,6 +41,7 @@
>   */
>  
>  #include "config.h"
> +#include "util/mini_event.h"
>  #ifdef HAVE_TIME_H
>  #include <time.h>
>  #endif
> 
> commit bd222ea92fb4ef6a6a73248ab264046f32f12548
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:25:06 2019 +0100
> 
>     include edns.h to have a prototype for apply_edns_options
> 
> diff --git util/edns.c util/edns.c
> index 2c4e4a1fd27..1fa6b2921c6 100644
> --- util/edns.c
> +++ util/edns.c
> @@ -42,6 +42,7 @@
>  #include "config.h"
>  
>  #include "util/config_file.h"
> +#include "util/edns.h"
>  #include "util/netevent.h"
>  #include "util/regional.h"
>  #include "util/data/msgparse.h"
> 
> commit 0b0babfd22863477cd6a678dc2b94c9a31928144
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:18:54 2019 +0100
> 
>     sldns_wire2str_edns_keepalive_print is only called in this module,
>     declare it static to get rid of compiler warning:
>     no previous prototype for function
> 
> diff --git sldns/wire2str.c sldns/wire2str.c
> index 832239f9b76..01ec84b3c50 100644
> --- sldns/wire2str.c
> +++ sldns/wire2str.c
> @@ -1908,8 +1908,8 @@ int sldns_wire2str_edns_subnet_print(char** s, size_t* sl, uint8_t* data,
>  	return w;
>  }
>  
> -int sldns_wire2str_edns_keepalive_print(char** s, size_t* sl, uint8_t* data,
> -	size_t len)
> +static int sldns_wire2str_edns_keepalive_print(char** s, size_t* sl,
> +	uint8_t* data, size_t len)
>  {
>  	int w = 0;
>  	uint16_t timeout;
> 
> commit 4b4b0877f2d4c06462ad4eada92f895f3b2dde04
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:16:49 2019 +0100
> 
>     infra_find_ip_ratedata() is only called in this module, declare it
>     static to get rid of compiler warning:
>     no previous prototype for function
> 
> diff --git services/cache/infra.c services/cache/infra.c
> index 489f939491d..07c41928d67 100644
> --- services/cache/infra.c
> +++ services/cache/infra.c
> @@ -808,7 +808,7 @@ static struct lruhash_entry* infra_find_ratedata(struct infra_cache* infra,
>  }
>  
>  /** find data item in array for ip addresses */
> -struct lruhash_entry* infra_find_ip_ratedata(struct infra_cache* infra,
> +static struct lruhash_entry* infra_find_ip_ratedata(struct infra_cache* infra,
>  	struct comm_reply* repinfo, int wr)
>  {
>  	struct ip_rate_key key;
> 
> commit 5edc4573a3f392b1ba398ffe149b308c29668919
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:15:23 2019 +0100
> 
>     do not shadow local variable buf
> 
> diff --git services/authzone.c services/authzone.c
> index edc88f520c4..0dc88e692a2 100644
> --- services/authzone.c
> +++ services/authzone.c
> @@ -4988,12 +4988,12 @@ xfr_transfer_lookup_host(struct auth_xfer* xfr, struct module_env* env)
>  		qinfo.qtype = LDNS_RR_TYPE_AAAA;
>  	qinfo.local_alias = NULL;
>  	if(verbosity >= VERB_ALGO) {
> -		char buf[512];
> +		char buf1[512];
>  		char buf2[LDNS_MAX_DOMAINLEN+1];
>  		dname_str(xfr->name, buf2);
> -		snprintf(buf, sizeof(buf), "auth zone %s: master lookup"
> +		snprintf(buf1, sizeof(buf1), "auth zone %s: master lookup"
>  			" for task_transfer", buf2);
> -		log_query_info(VERB_ALGO, buf, &qinfo);
> +		log_query_info(VERB_ALGO, buf1, &qinfo);
>  	}
>  	edns.edns_present = 1;
>  	edns.ext_rcode = 0;
> @@ -6010,12 +6010,12 @@ xfr_probe_lookup_host(struct auth_xfer* xfr, struct module_env* env)
>  		qinfo.qtype = LDNS_RR_TYPE_AAAA;
>  	qinfo.local_alias = NULL;
>  	if(verbosity >= VERB_ALGO) {
> -		char buf[512];
> +		char buf1[512];
>  		char buf2[LDNS_MAX_DOMAINLEN+1];
>  		dname_str(xfr->name, buf2);
> -		snprintf(buf, sizeof(buf), "auth zone %s: master lookup"
> +		snprintf(buf1, sizeof(buf1), "auth zone %s: master lookup"
>  			" for task_probe", buf2);
> -		log_query_info(VERB_ALGO, buf, &qinfo);
> +		log_query_info(VERB_ALGO, buf1, &qinfo);
>  	}
>  	edns.edns_present = 1;
>  	edns.ext_rcode = 0;
> 
> commit c72152c4401e88b63e089cd2906ef464b9692f9a
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:11:31 2019 +0100
> 
>     auth_chunks_delete and az_nsec3_findnode are only called in this module,
>     declare them static to get rid of compiler warning:
>     no previous prototype for function...
> 
> diff --git services/authzone.c services/authzone.c
> index e30858d435d..edc88f520c4 100644
> --- services/authzone.c
> +++ services/authzone.c
> @@ -1979,7 +1979,7 @@ int auth_zones_apply_cfg(struct auth_zones* az, struct config_file* cfg,
>   * @param at: transfer structure with chunks list.  The chunks and their
>   * 	data are freed.
>   */
> -void
> +static void
>  auth_chunks_delete(struct auth_transfer* at)
>  {
>  	if(at->chunks_first) {
> @@ -2618,7 +2618,7 @@ az_nsec3_hashname(struct auth_zone* z, uint8_t* hashname, size_t* hashnmlen,
>  }
>  
>  /** Find the datanode that covers the nsec3hash-name */
> -struct auth_data*
> +static struct auth_data*
>  az_nsec3_findnode(struct auth_zone* z, uint8_t* hashnm, size_t hashnmlen)
>  {
>  	struct query_info qinfo;
> 
> commit 426c827310adafe75c656060d0f3b96c1137e73d
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:07:58 2019 +0100
> 
>     copy_rrset() is only called in this module, declare it static to get
>     rid of compiler warning:
>     no previous prototype for function 'copy_rrset'
> 
> diff --git respip/respip.c respip/respip.c
> index aea528f1516..bcb31f89224 100644
> --- respip/respip.c
> +++ respip/respip.c
> @@ -451,7 +451,7 @@ respip_views_apply_cfg(struct views* vs, struct config_file* cfg,
>   * This function returns the copied rrset key on success, and NULL on memory
>   * allocation failure.
>   */
> -struct ub_packed_rrset_key*
> +static struct ub_packed_rrset_key*
>  copy_rrset(const struct ub_packed_rrset_key* key, struct regional* region)
>  {
>  	struct ub_packed_rrset_key* ck = regional_alloc(region,
> 
> commit 8419f0ebc059ab2a510214a0a329f79561a7d17f
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:05:33 2019 +0100
> 
>     no need for another variable "r"; gets rid of compiler warning:
>     declaration shadows a local variable
> 
> diff --git libunbound/libunbound.c libunbound/libunbound.c
> index 31adbd54dcd..0e59364d522 100644
> --- libunbound/libunbound.c
> +++ libunbound/libunbound.c
> @@ -724,7 +724,7 @@ ub_resolve_event(struct ub_ctx* ctx, const char* name, int rrtype,
>  		*async_id = 0;
>  	lock_basic_lock(&ctx->cfglock);
>  	if(!ctx->finalized) {
> -		int r = context_finalize(ctx);
> +		r = context_finalize(ctx);
>  		if(r) {
>  			lock_basic_unlock(&ctx->cfglock);
>  			return r;
> 
> commit 20d139a98172746facaa2d231c8fb3534b9a6369
> Author: Florian Obser <florian at narrans.de>
> Date:   Thu Jan 24 15:03:13 2019 +0100
> 
>     no need for another variable "ns"; gets rid of compiler warning:
>     declaration shadows a local variable
> 
> diff --git iterator/iterator.c iterator/iterator.c
> index f66381b401f..75fd23456d5 100644
> --- iterator/iterator.c
> +++ iterator/iterator.c
> @@ -1882,7 +1882,6 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
>  		struct delegpt* p = hints_lookup_root(qstate->env->hints,
>  			iq->qchase.qclass);
>  		if(p) {
> -			struct delegpt_ns* ns;
>  			struct delegpt_addr* a;
>  			iq->chase_flags &= ~BIT_RD; /* go to authorities */
>  			for(ns = p->nslist; ns; ns=ns->next) {
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.nlnetlabs.nl/pipermail/unbound-users/attachments/20190124/1672cc3e/attachment.bin>


More information about the Unbound-users mailing list