src/types.c: Clarify addr_rrtypeflag loop (style)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Oct 2014 19:34:42 +0000 (20:34 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Oct 2014 20:16:23 +0000 (21:16 +0100)
This structure avoids repeating the loop termination condition.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/types.c

index 55a7709..5062c6a 100644 (file)
@@ -373,8 +373,10 @@ static unsigned addr_rrtypeflag(adns_rrtype type) {
   int i;
 
   type &= adns_rrt_typemask;
-  for (i=0; i<addr_nrrtypes && type!=addr_all_rrtypes[i]; i++);
-  return i < addr_nrrtypes ? 1 << i : 0;
+  for (i=0; i<addr_nrrtypes; i++)
+     if (type==addr_all_rrtypes[i])
+       return 1 << i;
+  return 0;
 }
 
 /* About CNAME handling in addr queries.