mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[gamecode] Make PR_FreeString a little more forgiving
It treats only strings that are actually invalid as invalid. That is, now it is safe to "free" a static string: it's just a no-op.
This commit is contained in:
parent
22e2695f80
commit
b4874f7d9b
1 changed files with 4 additions and 2 deletions
|
@ -602,6 +602,7 @@ PR_FreeString (progs_t *pr, string_t str)
|
|||
switch (sr->type) {
|
||||
case str_static:
|
||||
case str_temp:
|
||||
case str_return:
|
||||
return;
|
||||
case str_mutable:
|
||||
dstring_delete (sr->s.dstring);
|
||||
|
@ -609,14 +610,15 @@ PR_FreeString (progs_t *pr, string_t str)
|
|||
case str_dynamic:
|
||||
pr_strfree (pr, sr->s.string);
|
||||
break;
|
||||
case str_return:
|
||||
default:
|
||||
PR_Error (pr, "internal string error: %d", __LINE__);
|
||||
}
|
||||
free_string_ref (res, sr);
|
||||
return;
|
||||
}
|
||||
if (!PR_StringValid (pr, str)) {
|
||||
PR_RunError (pr, "attempt to free invalid string %d", str);
|
||||
}
|
||||
}
|
||||
|
||||
VISIBLE void
|
||||
|
|
Loading…
Reference in a new issue