strdup to save original
This commit is contained in:
parent
a3b48fcf6f
commit
14d7363e79
|
@ -44,21 +44,24 @@ static bool mods_incompatible_match(struct Mod* a, struct Mod* b) {
|
|||
return false;
|
||||
}
|
||||
|
||||
char* ai = a->incompatible;
|
||||
char* bi = b->incompatible;
|
||||
char* ai = strdup(a->incompatible);
|
||||
char* bi = strdup(b->incompatible);
|
||||
char* atoken = NULL;
|
||||
char* btoken = NULL;
|
||||
char* arest = NULL;
|
||||
char* brest = NULL;
|
||||
|
||||
for (atoken = strtok_r(ai, " ", &arest); atoken != NULL; atoken = strtok_r(NULL, " ", &arest)) {
|
||||
for (btoken = strtok_r(bi, " ", &brest); btoken != NULL; btoken = strtok_r(NULL, " ", &brest)) {
|
||||
for (btoken = strtok_r(bi, " ", &brest); btoken != NULL; btoken = strtok_r(NULL, " ", &brest)) {z
|
||||
if (!strcmp(atoken, btoken)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(ai);
|
||||
free(bi);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -330,4 +333,4 @@ bool directory_sanity_check(struct dirent* dir, char* dirPath, char* outPath) {
|
|||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue