This is an automated email from the ASF dual-hosted git repository.

scw00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b0d979  cppcheck: minimize variable scopes
4b0d979 is described below

commit 4b0d979aeb442b0a124e07cb9dfc1b6adb560cf3
Author: Masakazu Kitajo <mas...@apache.org>
AuthorDate: Wed Apr 24 13:58:36 2019 +0800

    cppcheck: minimize variable scopes
---
 iocore/net/P_UDPNet.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index 99ca615..e54ba6c 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -167,12 +167,12 @@ public:
   void
   FreeCancelledPackets(int numSlots)
   {
-    UDPPacketInternal *p;
     Queue<UDPPacketInternal> tempQ;
-    int i, s;
+    int i;
 
     for (i = 0; i < numSlots; i++) {
-      s = (now_slot + i) % N_SLOTS;
+      int s = (now_slot + i) % N_SLOTS;
+      UDPPacketInternal *p;
       while (nullptr != (p = bucket[s].dequeue())) {
         if (IsCancelledPacket(p)) {
           p->free();
@@ -191,7 +191,6 @@ public:
   advanceNow(ink_hrtime t)
   {
     int s = now_slot;
-    int prev;
 
     if (ink_hrtime_to_msec(t - lastPullLongTermQ) >= SLOT_TIME_MSEC * 
((N_SLOTS - 1) / 2)) {
       Queue<UDPPacketInternal> tempQ;
@@ -208,6 +207,8 @@ public:
     }
 
     while (!bucket[s].head && (t > delivery_time[s] + SLOT_TIME)) {
+      int prev;
+
       prev             = (s + N_SLOTS - 1) % N_SLOTS;
       delivery_time[s] = delivery_time[prev] + SLOT_TIME;
       s                = (s + 1) % N_SLOTS;

Reply via email to