Slightly faster implementation of the deadman counter

Count down to zero instead of up to a constant...
This commit is contained in:
H. Peter Anvin 2007-11-19 13:14:59 -08:00
parent cb1cf59312
commit 2a15e69ebe

View File

@ -2994,7 +2994,7 @@ static Token *expand_smacro(Token * tline)
Token *org_tline = tline;
Context *ctx;
char *mname;
int deadman = 0;
int deadman = DEADMAN_LIMIT;
/*
* Trick: we should avoid changing the start token pointer since it can
@ -3016,7 +3016,7 @@ again:
thead = NULL;
while (tline) { /* main token loop */
if (++deadman > DEADMAN_LIMIT) {
if (!--deadman) {
error(ERR_NONFATAL, "interminable macro recursion");
break;
}