]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Teach scanbuild that two divisions are safe: one by adding an assert, one by using...
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 28 Mar 2022 08:50:52 +0000 (10:50 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 28 Mar 2022 08:59:58 +0000 (10:59 +0200)
pdns/pdns_recursor.cc
pdns/sillyrecords.cc

index c696a767031dec95e8da715cafdd5dcd1de26182..4dd6bcb73b0414058f0557acfd0febe7241e8066 100644 (file)
@@ -2406,6 +2406,7 @@ static unsigned int getWorkerLoad(size_t workerIdx)
 
 static unsigned int selectWorker(unsigned int hash)
 {
+  assert(RecThreadInfo::numWorkers() != 0);
   if (g_balancingFactor == 0) {
     return RecThreadInfo::numHandlers() + RecThreadInfo::numDistributors() + (hash % RecThreadInfo::numWorkers());
   }
index d1319a1a4227e88125de9a5b3301691864c85dc3..5e4623a007b8ef6ec8d7e1bd0fb385b3c613771c 100644 (file)
@@ -13,8 +13,8 @@
 #include <errno.h>
 #include "dnsrecords.hh"
 
-static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
-                                 1000000,10000000,100000000,1000000000};
+const static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
+  1000000,10000000,100000000,1000000000};
 
 /* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer.*/
 static uint8_t precsize_aton(const char **strptr)