[vlc-commits] httpd: reduce variable scope

Rémi Denis-Courmont git at videolan.org
Mon Jun 8 16:04:06 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  6 20:09:57 2020 +0300| [8af01b05092ff66ee82ec398fcde2b781b3d2c15] | committer: Rémi Denis-Courmont

httpd: reduce variable scope

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8af01b05092ff66ee82ec398fcde2b781b3d2c15
---

 src/network/httpd.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index 2eece86430..6504bf55bc 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1720,8 +1720,6 @@ static void httpdLoop(httpd_host_t *host)
 
     int canc = vlc_savecancel();
     vlc_list_foreach(cl, &host->clients, node) {
-        int64_t i_offset;
-
         if (cl->i_state == HTTPD_CLIENT_DEAD
          || (cl->i_activity_timeout > 0
           && cl->i_activity_date + cl->i_activity_timeout < now)) {
@@ -1921,7 +1919,7 @@ static void httpdLoop(httpd_host_t *host)
                         cl->i_state = HTTPD_CLIENT_DEAD;
                     httpd_MsgClean(&cl->answer);
                 } else {
-                    i_offset = cl->answer.i_body_offset;
+                    int64_t i_offset = cl->answer.i_body_offset;
                     httpd_MsgClean(&cl->answer);
 
                     cl->answer.i_body_offset = i_offset;
@@ -1934,8 +1932,8 @@ static void httpdLoop(httpd_host_t *host)
                 }
                 break;
 
-            case HTTPD_CLIENT_WAITING:
-                i_offset = cl->answer.i_body_offset;
+            case HTTPD_CLIENT_WAITING: {
+                int64_t i_offset = cl->answer.i_body_offset;
                 int i_msg = cl->query.i_type;
 
                 httpd_MsgInit(&cl->answer);
@@ -1952,6 +1950,7 @@ static void httpdLoop(httpd_host_t *host)
                     cl->answer.i_body = 0;
                     cl->i_state = HTTPD_CLIENT_SENDING;
                 }
+            }
         }
 
         pufd->fd = vlc_tls_GetPollFD(cl->sock, &pufd->events);



More information about the vlc-commits mailing list