mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 16:51:08 +00:00
progs.h:
add no_exec_limit field. Set to 1 to disable the runaway loop check for unlimited runs (eg, in qwaq) pr_exec.c: don't bother checking the profile counter if pr->no_exec_limit is set pr_strings.c: free unreferenced dynamic strings rather than referenced.
This commit is contained in:
parent
22f465dabe
commit
2bc94ea66f
3 changed files with 5 additions and 4 deletions
|
@ -168,6 +168,7 @@ eval_t *GetEdictFieldValue(progs_t *pr, edict_t *ed, char *field);
|
||||||
|
|
||||||
char *PR_GetString(progs_t *pr, int num);
|
char *PR_GetString(progs_t *pr, int num);
|
||||||
int PR_SetString(progs_t *pr, char *s);
|
int PR_SetString(progs_t *pr, char *s);
|
||||||
|
void PR_GarbageCollect (progs_t *pr);
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -228,6 +229,7 @@ struct progs_s {
|
||||||
int *reserved_edicts; //alloc will start at reserved_edicts+1
|
int *reserved_edicts; //alloc will start at reserved_edicts+1
|
||||||
double *time;
|
double *time;
|
||||||
int null_bad;
|
int null_bad;
|
||||||
|
int no_exec_limit;
|
||||||
|
|
||||||
unsigned short crc;
|
unsigned short crc;
|
||||||
|
|
||||||
|
|
|
@ -379,9 +379,8 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
st++;
|
st++;
|
||||||
if (++profile > 1000000) // LordHavoc: increased runaway loop
|
if (!pr->no_exec_limit
|
||||||
// limit 10x
|
&& ++profile > 1000000) {
|
||||||
{
|
|
||||||
pr->pr_xstatement = st - pr->pr_statements;
|
pr->pr_xstatement = st - pr->pr_statements;
|
||||||
PR_RunError (pr, "runaway loop error");
|
PR_RunError (pr, "runaway loop error");
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ PR_GarbageCollect (progs_t *pr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (sr = pr->dynamic_strings.next; sr; sr = sr->next) {
|
for (sr = pr->dynamic_strings.next; sr; sr = sr->next) {
|
||||||
if (sr->count) {
|
if (!sr->count) {
|
||||||
Hash_Del (pr->strref_hash, sr->string);
|
Hash_Del (pr->strref_hash, sr->string);
|
||||||
strref_free (sr, pr);
|
strref_free (sr, pr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue