Use "unsigned long" to track expresison node evaluations.

This commit is contained in:
Dianne Skoll
2025-09-13 11:38:55 -04:00
parent f153acf7ce
commit 131e77fa18
3 changed files with 10 additions and 12 deletions

View File

@@ -88,10 +88,10 @@ EXTERN INIT( int DeltaOverride, 0);
EXTERN INIT( int RunDisabled, 0);
EXTERN INIT( int ExpressionEvaluationDisabled, 0);
EXTERN INIT( int ExpressionEvaluationTimeLimit, 0);
EXTERN INIT( int ExpressionNodesEvaluated, 0);
EXTERN INIT( int MaxExprNodesPerLine, 0);
EXTERN INIT( int ExpressionNodesEvaluatedThisLine, 0);
EXTERN INIT( int ExpressionNodeLimitPerLine, 10000000);
EXTERN INIT( unsigned long ExpressionNodesEvaluated, 0);
EXTERN INIT( unsigned long MaxExprNodesPerLine, 0);
EXTERN INIT( unsigned long ExpressionNodesEvaluatedThisLine, 0);
EXTERN INIT( unsigned long ExpressionNodeLimitPerLine, 10000000);
EXTERN INIT( volatile sig_atomic_t ExpressionTimeLimitExceeded, 0);
EXTERN INIT( int IgnoreOnce, 0);
EXTERN INIT( char const *OnceFile, NULL);

View File

@@ -1154,6 +1154,8 @@ static void
ProcessLongOption(char const *arg)
{
int t;
unsigned long tt;
if (!strcmp(arg, "test")) {
fprintf(stderr, "Enabling test mode: This is meant for the acceptance test.\nDo not use --test in production.\nIn test mode, the system time is fixed at 2025-01-06@19:00\n");
TestMode = 1;
@@ -1222,12 +1224,8 @@ ProcessLongOption(char const *arg)
print_sysvar_tokens();
exit(0);
}
if (sscanf(arg, "max-expr-complexity=%d", &t) == 1) {
if (t < 0) {
fprintf(ErrFp, "%s: --max-expr-complexity must be non-negative\n", ArgV[0]);
return;
}
ExpressionNodeLimitPerLine = t;
if (sscanf(arg, "max-expr-complexity=%lu", &tt) == 1) {
ExpressionNodeLimitPerLine = tt;
return;
}
if (sscanf(arg, "max-execution-time=%d", &t) == 1) {

View File

@@ -84,8 +84,8 @@ exitfunc(void)
UnsetAllUserFuncs();
print_expr_nodes_stats();
fprintf(ErrFp, "Max expr node evaluations per line: %d\n", MaxExprNodesPerLine);
fprintf(ErrFp, "Total expression node evaluations: %d\n", ExpressionNodesEvaluated);
fprintf(ErrFp, "Max expr node evaluations per line: %lu\n", MaxExprNodesPerLine);
fprintf(ErrFp, "Total expression node evaluations: %lu\n", ExpressionNodesEvaluated);
}
}