From 829a12e7ac778a37ed09bdbfd699118903414b28 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sun, 7 Apr 2024 18:35:58 +0200 Subject: [PATCH] Fix SOC freeslotting including trailing spaces in constant names --- src/deh_soc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index d1643fd4e..dda3b2ef4 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -405,7 +405,6 @@ void readfreeslots(MYFILE *f) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); char *word,*type; - char *tmp; int i; do @@ -415,10 +414,13 @@ void readfreeslots(MYFILE *f) if (s[0] == '\n') break; - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - if (s == tmp) + char *hashtag = strchr(s, '#'); + char *space = strchr(s, ' '); + if (hashtag) + *hashtag = '\0'; + if (space) + *space = '\0'; + if (s == hashtag || s == space) continue; // Skip comment lines, but don't break. type = strtok(s, "_");