Nits for 1.5.10

Dag-Erling Smørgrav des at des.no
Thu Sep 29 18:36:13 UTC 2016


The following are changes I had to make to integrate 1.5.10 into FreeBSD
head, rebased to unbound trunk.

1) lz_type() must either have a prototype or be declared static.  Since
   it isn't used outside its compilation unit, I chose the latter.

Index: services/localzone.c
===================================================================
--- services/localzone.c	(revision 3874)
+++ services/localzone.c	(working copy)
@@ -1411,7 +1411,7 @@
 	log_nametypeclass(0, txt, qinfo->qname, qinfo->qtype, qinfo->qclass);
 }
 
-enum localzone_type
+static enum localzone_type
 lz_type(uint8_t *taglist, size_t taglen, uint8_t *taglist2, size_t taglen2,
 	uint8_t *tagactions, size_t tagactionssize, enum localzone_type lzt,
 	struct comm_reply* repinfo, struct rbtree_t* override_tree, int* tag,

2) Unnecessary casts, some of which discard qualifiers and therefore
   break the build at higher warning levels.  Note that needlessly
   discarding a const qualifier can prevent certain optimizations.

Index: smallapp/unbound-anchor.c
===================================================================
--- smallapp/unbound-anchor.c	(revision 3874)
+++ smallapp/unbound-anchor.c	(working copy)
@@ -420,7 +420,7 @@
 {
 	const char* builtin_cert = get_builtin_cert();
 	STACK_OF(X509)* sk;
-	BIO *bio = BIO_new_mem_buf((void*)builtin_cert,
+	BIO *bio = BIO_new_mem_buf(builtin_cert,
 		(int)strlen(builtin_cert));
 	if(!bio) {
 		if(verb) printf("out of memory\n");
Index: smallapp/worker_cb.c
===================================================================
--- smallapp/worker_cb.c	(revision 3874)
+++ smallapp/worker_cb.c	(working copy)
@@ -225,8 +225,8 @@
 
 int order_lock_cmp(const void* e1, const void* e2)
 {
-        struct order_id* o1 = (struct order_id*)e1;
-        struct order_id* o2 = (struct order_id*)e2;
+        const struct order_id* o1 = e1;
+        const struct order_id* o2 = e2;
         if(o1->thr < o2->thr) return -1;
         if(o1->thr > o2->thr) return 1;
         if(o1->instance < o2->instance) return -1;
@@ -237,7 +237,7 @@
 int
 codeline_cmp(const void* a, const void* b)
 {
-        return strcmp((const char*)a, (const char*)b);
+        return strcmp(a, b);
 }
 
 int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))

DES
-- 
Dag-Erling Smørgrav - des at des.no



More information about the Unbound-users mailing list