home · contact · privacy
Removed unnecessary NULLings of pointers, explained kept ones.
[plomrogue] / src / client / io.c
index 095577d32e1d84fa0d68a89eb31d41a6ac5a76e1..4623b3d89bbe4e6aa1912c24b8acdec649637b34 100644 (file)
@@ -5,6 +5,7 @@
 #include <fcntl.h> /* open() */
 #include <limits.h> /* PIPE_BUF */
 #include <ncurses.h> /* halfdelay(), getch() */
+#include <stddef.h> /* NULL */
 #include <stdint.h> /* uint8_t, uint16_t, uint32_t */
 #include <stdio.h> /* FILE, sprintf(), fseek() */
 #include <string.h> /* strcmp(), strlen(), memcpy() */
@@ -78,7 +79,7 @@ static void read_inventory(char * read_buf, uint32_t linemax, FILE * file)
     char * f_name = "read_inventory()";
     char * delimiter = "%\n";
     free(world.player_inventory);
-    world.player_inventory = NULL;
+    world.player_inventory = NULL;          /* Avoids illegal strlen() below. */
     while (1)
     {
         try_fgets(read_buf, linemax + 1, file, f_name);