Parcourir la source

[2155] remove meaningless NULL check

Yoshitaka Aharen il y a 12 ans
Parent
commit
c522619b6b
1 fichiers modifiés avec 15 ajouts et 18 suppressions
  1. 15 18
      src/bin/auth/statistics.cc

+ 15 - 18
src/bin/auth/statistics.cc

@@ -121,24 +121,21 @@ CountersImpl::inc(const QRAttributes& qrattrs, const Message& response) {
     unsigned int qtype_type = QR_QTYPE_OTHER;
     const QuestionIterator qiter = response.beginQuestion();
     if (qiter != response.endQuestion()) {
-        // get the first and only question section
-        const QuestionPtr qptr = *qiter;
-        if (qptr != NULL) {
-            // get the qtype code
-            const unsigned int qtype = qptr->getType().getCode();
-            if (qtype < 258) {
-                // qtype 0..257
-                qtype_type = QRQTypeToQRCounterType[qtype];
-            } else if (qtype < 32768) {
-                // qtype 258..32767
-                qtype_type = QR_QTYPE_OTHER;
-            } else if (qtype < 32770) {
-                // qtype 32768..32769
-                qtype_type = QR_QTYPE_TA + (qtype - 32768);
-            } else {
-                // qtype 32770..65535
-                qtype_type = QR_QTYPE_OTHER;
-            }
+        // get the first and only question section and
+        // get the qtype code
+        const unsigned int qtype = (*qiter)->getType().getCode();
+        if (qtype < 258) {
+            // qtype 0..257
+            qtype_type = QRQTypeToQRCounterType[qtype];
+        } else if (qtype < 32768) {
+            // qtype 258..32767
+            qtype_type = QR_QTYPE_OTHER;
+        } else if (qtype < 32770) {
+            // qtype 32768..32769
+            qtype_type = QR_QTYPE_TA + (qtype - 32768);
+        } else {
+            // qtype 32770..65535
+            qtype_type = QR_QTYPE_OTHER;
         }
     }
     server_qr_counter_.inc(qtype_type);