diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2023-08-18 00:07:39 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2023-08-18 00:07:39 (GMT) |
commit | 2424c52c4f3bc44ce5f36348442cfa103e0989c2 (patch) | |
tree | f68aea488f403b234d4fcc6fd6e0f7b88a628ac8 /src/analysis/scan/exprs/counter.c | |
parent | 1c5a0e67186def152536d9c506e2e6c3a3a265c5 (diff) |
Create some modifiers and handle match properties inside ROST.
Diffstat (limited to 'src/analysis/scan/exprs/counter.c')
-rw-r--r-- | src/analysis/scan/exprs/counter.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/analysis/scan/exprs/counter.c b/src/analysis/scan/exprs/counter.c index 290fd02..bb4e523 100644 --- a/src/analysis/scan/exprs/counter.c +++ b/src/analysis/scan/exprs/counter.c @@ -50,7 +50,7 @@ static void g_scan_match_counter_finalize(GScanMatchCounter *); /* Réduit une expression à une forme plus simple. */ -static bool g_scan_match_counter_reduce(GScanMatchCounter *, GScanContext *, GScanScope *, GScanExpression **); +static ScanReductionState g_scan_match_counter_reduce(GScanMatchCounter *, GScanContext *, GScanScope *, GScanExpression **); @@ -226,22 +226,22 @@ bool g_scan_match_counter_create(GScanMatchCounter *counter, GSearchPattern *pat * * ******************************************************************************/ -static bool g_scan_match_counter_reduce(GScanMatchCounter *expr, GScanContext *ctx, GScanScope *scope, GScanExpression **out) +static ScanReductionState g_scan_match_counter_reduce(GScanMatchCounter *expr, GScanContext *ctx, GScanScope *scope, GScanExpression **out) { - bool result; /* Bilan à retourner */ + ScanReductionState result; /* Etat synthétisé à retourner */ size_t count; /* Quantité de correspondances */ - const GScanMatch **matches; /* Correspondances établies */ - - - matches = g_scan_context_get_full_matches(ctx, expr->pattern, &count); + if (g_scan_context_is_scan_done(ctx)) + { + g_scan_context_get_full_matches(ctx, expr->pattern, &count); - printf("matches: %zu\n", count); + *out = g_scan_literal_expression_new(LVT_UNSIGNED_INTEGER, (unsigned long long []){ count }); + result = SRS_REDUCED; - *out = g_scan_literal_expression_new(LVT_UNSIGNED_INTEGER, (unsigned long long []){ count }); - result = true; - + } + else + result = SRS_WAIT_FOR_SCAN; return result; |