tRequire exact matches of config names - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit b0756ad94e664d430149faa4c739f00346a5fdb3
(DIR) parent 6a57584d57e6e633b4224ba24fe4f1c955ef89be
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Fri, 13 Nov 2020 00:24:28 -0800
Require exact matches of config names
When looking up a configuration parameter by name,
require an exact match; don't match a parameter that
is shorter than the requested name (this erroneously
matches "Names.Bitch" when given "Names.Bitches").
Diffstat:
M src/dopewars.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/src/dopewars.c b/src/dopewars.c
t@@ -1964,13 +1964,13 @@ int GetGlobalIndex(gchar *ID1, gchar *ID2)
if (!ID1)
return -1;
for (i = 0; i < NumGlob; i++) {
- if (g_ascii_strncasecmp(ID1, Globals[i].Name, strlen(Globals[i].Name)) == 0
- && !Globals[i].NameStruct[0]) {
+ if (!ID2 && !Globals[i].NameStruct[0]
+ && g_ascii_strcasecmp(ID1, Globals[i].Name) == 0) {
/* Just a bog-standard ID1=value */
return i;
}
- if (g_ascii_strncasecmp(ID1, Globals[i].NameStruct, strlen(Globals[i].NameStruct)) == 0 && ID2
- && g_ascii_strncasecmp(ID2, Globals[i].Name, strlen(Globals[i].Name)) == 0
+ if (g_ascii_strcasecmp(ID1, Globals[i].NameStruct) == 0 && ID2
+ && g_ascii_strcasecmp(ID2, Globals[i].Name) == 0
&& Globals[i].StructStaticPt && Globals[i].StructListPt) {
/* ID1[index].ID2=value */
return i;