Bug 1253 - unused variable in edns-subnet/addrtree.c:getbit()
unused variable in edns-subnet/addrtree.c:getbit()
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
unspecified
Other All
: P5 normal
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-04-14 00:29 CEST by JINMEI Tatuya
Modified: 2017-05-30 15:22 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JINMEI Tatuya 2017-04-14 00:29:37 CEST
getbit() is defined as follows:

static int 
getbit(const addrkey_t *addr, addrlen_t addrlen, addrlen_t n)
{
	log_assert(addrlen > n);
	return (int)(addr[n/KEYWIDTH]>>((KEYWIDTH-1)-(n%KEYWIDTH))) & 1;
}

'addrlen' is unused unless UNBOUND_DEBUG is defined, and it causes
build failure with -Werror.
Comment 1 Ralph Dolmans 2017-04-18 15:26:00 CEST
Hi Jinmei,

Thank you! Fixed:

Index: edns-subnet/addrtree.c
===================================================================
--- edns-subnet/addrtree.c	(revision 4124)
+++ edns-subnet/addrtree.c	(working copy)
@@ -302,6 +302,7 @@
 getbit(const addrkey_t *addr, addrlen_t addrlen, addrlen_t n)
 {
 	log_assert(addrlen > n);
+	(void)addrlen;
 	return (int)(addr[n/KEYWIDTH]>>((KEYWIDTH-1)-(n%KEYWIDTH))) & 1;
 }