From: Holger Schemel Date: Thu, 22 Feb 2024 22:15:07 +0000 (+0100) Subject: replaced glib function calls to g_strdup() X-Git-Tag: 4.4.0.0-test-1~314 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f862367c9f40dedf6addad15adf5032c258ab9e2;p=rocksndiamonds.git replaced glib function calls to g_strdup() --- diff --git a/src/game_bd/bd_bdcff.c b/src/game_bd/bd_bdcff.c index 06e5e06b..a620fbc5 100644 --- a/src/game_bd/bd_bdcff.c +++ b/src/game_bd/bd_bdcff.c @@ -493,7 +493,7 @@ static void cave_report_and_copy_unknown_tags_func(char *attrib, char *param, gp Warn("unknown tag '%s'", attrib); - g_hash_table_insert(cave->tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(cave->tags, getStringCopy(attrib), getStringCopy(param)); } /* having read all strings belonging to the cave, process it. */ @@ -956,7 +956,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) /* own tag: not too much thinking :P */ if (reading_replay) { - g_hash_table_insert(replay_tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(replay_tags, getStringCopy(attrib), getStringCopy(param)); } else if (reading_mapcodes) { @@ -1111,7 +1111,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) { /* it must be a default setting for all caves. is it a valid identifier? */ /* yes, it is. add to the hash table, which will be copied for all caves. */ - g_hash_table_insert(tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(tags, getStringCopy(attrib), getStringCopy(param)); } else /* unknown setting - report. */ @@ -1122,7 +1122,7 @@ boolean gd_caveset_load_from_bdcff(const char *contents) /* we are reading a [cave] */ /* cave settings are immediately added to cave hash table. */ /* if it is unknown, we have to remember it, and save it again. */ - g_hash_table_insert(tags, g_strdup(attrib), g_strdup(param)); + g_hash_table_insert(tags, getStringCopy(attrib), getStringCopy(param)); } } diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 1b014ccd..cf7bc8af 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -275,7 +275,7 @@ void gd_cave_init(void) /* put names to a hash table */ /* this is a helper for file read operations */ - /* maps g_strdupped strings to elemenets (integers) */ + /* maps copied strings to elements (integers) */ name_to_element = create_hashtable(str_case_hash, str_case_equal, NULL, NULL); for (i = 0; i < O_MAX; i++) @@ -290,7 +290,7 @@ void gd_cave_init(void) hashtable_insert(name_to_element, key, INT_TO_PTR(i)); /* ^^^ do not free "key", as hash table needs it during the whole time! */ - key = g_strdup_printf("SCANNED_%s", key); /* new string */ + key = getStringCat2("SCANNED_", key); /* new string */ hashtable_insert(name_to_element, key, INT_TO_PTR(i)); /* once again, do not free "key" ^^^ */ @@ -586,7 +586,7 @@ void gd_cave_free(GdCave *cave) static void hash_copy_foreach(const char *key, const char *value, GHashTable *dest) { - g_hash_table_insert(dest, g_strdup(key), g_strdup(value)); + g_hash_table_insert(dest, getStringCopy(key), getStringCopy(value)); } /* copy cave from src to destination, with duplicating dynamically allocated data */