mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +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) {
|
switch (sr->type) {
|
||||||
case str_static:
|
case str_static:
|
||||||
case str_temp:
|
case str_temp:
|
||||||
|
case str_return:
|
||||||
return;
|
return;
|
||||||
case str_mutable:
|
case str_mutable:
|
||||||
dstring_delete (sr->s.dstring);
|
dstring_delete (sr->s.dstring);
|
||||||
|
@ -609,14 +610,15 @@ PR_FreeString (progs_t *pr, string_t str)
|
||||||
case str_dynamic:
|
case str_dynamic:
|
||||||
pr_strfree (pr, sr->s.string);
|
pr_strfree (pr, sr->s.string);
|
||||||
break;
|
break;
|
||||||
case str_return:
|
|
||||||
default:
|
default:
|
||||||
PR_Error (pr, "internal string error: %d", __LINE__);
|
PR_Error (pr, "internal string error: %d", __LINE__);
|
||||||
}
|
}
|
||||||
free_string_ref (res, sr);
|
free_string_ref (res, sr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!PR_StringValid (pr, str)) {
|
||||||
PR_RunError (pr, "attempt to free invalid string %d", str);
|
PR_RunError (pr, "attempt to free invalid string %d", str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
|
|
Loading…
Reference in a new issue