summaryrefslogtreecommitdiff
path: root/src/analysis/scan/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/context.c')
-rw-r--r--src/analysis/scan/context.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/analysis/scan/context.c b/src/analysis/scan/context.c
index 1f9c38e..f108e93 100644
--- a/src/analysis/scan/context.c
+++ b/src/analysis/scan/context.c
@@ -763,7 +763,9 @@ bool g_scan_context_has_match_for_rule(GScanContext *context, const char *name)
bool result; /* Bilan à retourner */
size_t i; /* Boucle de parcours */
rule_condition_t *cond; /* Condition à considérer */
+ GScanScope *scope; /* Définition de portées */
GScanExpression *new; /* Nouvelle expression réduite */
+ ScanReductionState state; /* Statut d'une réduction */
bool valid; /* Validité d'une récupération */
result = false;
@@ -786,20 +788,26 @@ bool g_scan_context_has_match_for_rule(GScanContext *context, const char *name)
if (!cond->final_reduced)
{
- valid = g_scan_expression_reduce(cond->expr, context, NULL, &new);
- if (!valid || new == NULL) goto exit;
+ scope = g_scan_scope_new(name);
+
+ state = g_scan_expression_reduce(cond->expr, context, scope, &new);
+ if (state == SRS_UNRESOLVABLE) goto exit_reduction;
g_object_unref(G_OBJECT(cond->expr));
cond->expr = new;
- valid = g_scan_expression_reduce_to_boolean(cond->expr, context, NULL, &new);
- if (!valid || new == NULL) goto exit;
+ valid = g_scan_expression_reduce_to_boolean(cond->expr, context, scope, &new);
+ if (!valid || new == NULL) goto exit_reduction;
g_object_unref(G_OBJECT(cond->expr));
cond->expr = new;
cond->final_reduced = true;
+ exit_reduction:
+
+ g_object_unref(G_OBJECT(scope));
+
}
/* Tentative de récupération d'un bilan final */