optimization on memory

This commit is contained in:
biglyderv 2025-03-27 15:56:47 -04:00
parent 0e3dd1a83f
commit fe1de151ff
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
4 changed files with 14 additions and 5 deletions

View file

@ -32,12 +32,15 @@ int load_elements(hashmap *m, char *table, int use_inv) {
continue;
}
char *combo = strstr(str, ";");
combo[0] = '\0';
combo++;
char *combo_o = strstr(str, ";");
combo_o[0] = '\0';
combo_o++;
char *combo = calloc(strlen(combo_o)+1,sizeof(char));
strcpy(combo,combo_o);
if (use_inv == 2) {
hashmap_set(m, str, strlen(str) - 1, (uintptr_t)combo, 0);
hashmap_set(m, str, strlen(str) - 1, (uintptr_t)combo, 1);
continue;
}