if (prop_desc[i].type == GD_TYPE_LONGSTRING)
{
- GString *str = *(GString **)value;
- char *compressed;
+ char **str = (char **)value;
- compressed = getUnescapedString(param);
- g_string_assign(str, compressed);
- free(compressed);
+ checked_free(*str);
+ *str = getUnescapedString(param);
/* remember this to skip checking the number of parameters at the end of the function */
was_string = TRUE;
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. */
/* 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)
{
{
/* 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. */
/* 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));
}
}