[glib/vs2012-2-68: 2/4] gsocket.c: Declare variables at the top-of-block




commit ce660066f2c8ebc54c037a8bbea0c65769271e10
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Mar 31 16:53:23 2021 +0800

    gsocket.c: Declare variables at the top-of-block
    
    This will allow the code to build on C89 compilers, since they do not
    allow declaring a variable within a for loop initializer.

 gio/gsocket.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gio/gsocket.c b/gio/gsocket.c
index a7ba27d0c..f39a568b3 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -4795,7 +4795,9 @@ g_socket_send_message (GSocket                *socket,
 
   if (num_vectors != -1)
     {
-      for (gint i = 0; i < num_vectors; i++)
+      gint i;
+
+      for (i = 0; i < num_vectors; i++)
         {
           /* No wrap-around for vectors_size */
           if (vectors_size > vectors_size + vectors[i].size)
@@ -4811,7 +4813,9 @@ g_socket_send_message (GSocket                *socket,
     }
   else
     {
-      for (gsize i = 0; vectors[i].buffer != NULL; i++)
+      gsize i;
+
+      for (i = 0; vectors[i].buffer != NULL; i++)
         {
           /* No wrap-around for vectors_size */
           if (vectors_size > vectors_size + vectors[i].size)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]