commit 73a1d06182b142d412cee5099ad619174604e6e4
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Thu Sep 28 08:44:56 2017 -0400
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Thu Sep 28 08:44:56 2017 -0400
net: Reduce scope of variables.
These are only needed inside the loop. Thanks @turol.
---
src/net_common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/net_common.c b/src/net_common.c
index 417917ed..fb7bca77 100644
--- a/src/net_common.c
+++ b/src/net_common.c
@@ -537,9 +537,8 @@ void NET_WriteProtocol(net_packet_t *packet, net_protocol_t protocol)
// 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 @@ net_protocol_t NET_ReadProtocolList(net_packet_t *packet)
for (i = 0; i < num_protocols; ++i)
{
+ net_protocol_t p;
+ char *name;
+
name = NET_ReadString(packet);
if (name == NULL)
{