shithub: choc

Download patch

ref: 73a1d06182b142d412cee5099ad619174604e6e4
parent: f7f82be5007aa3f59409095c64c35c4cb1a10bd7
author: Simon Howard <fraggle@soulsphere.org>
date: Thu Sep 28 04:44:56 EDT 2017

net: Reduce scope of variables.

These are only needed inside the loop. Thanks @turol.

--- a/src/net_common.c
+++ b/src/net_common.c
@@ -537,9 +537,8 @@
 // no recognized protocols are read, NET_PROTOCOL_UNKNOWN is returned.
 net_protocol_t NET_ReadProtocolList(net_packet_t *packet)
 {
-    net_protocol_t result, p;
+    net_protocol_t result;
     unsigned int num_protocols;
-    char *name;
     int i;
 
     if (!NET_ReadInt8(packet, &num_protocols))
@@ -551,6 +550,9 @@
 
     for (i = 0; i < num_protocols; ++i)
     {
+        net_protocol_t p;
+        char *name;
+
         name = NET_ReadString(packet);
         if (name == NULL)
         {