[DTrace-devel] [PATCH] Simplify code to match aggregation key
Kris Van Hees
kris.van.hees at oracle.com
Fri Aug 18 13:53:11 UTC 2023
On Mon, Aug 14, 2023 at 09:16:51PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
... with correction below
> ---
> libdtrace/dt_aggregate.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/libdtrace/dt_aggregate.c b/libdtrace/dt_aggregate.c
> index 7c09908d..05f41f5d 100644
> --- a/libdtrace/dt_aggregate.c
> +++ b/libdtrace/dt_aggregate.c
> @@ -522,14 +522,8 @@ dt_aggregate_snap_one(dtrace_hdl_t *dtp, int aggid, int cpu, const char *key,
> continue;
>
> /* Aggregation key needs to match. */
> - ptr = agd->dtada_key;
> - for (i = 0; i < agg->dtagd_nkrecs; i++) {
> - rec = &agg->dtagd_krecs[i];
> - off = rec->dtrd_offset;
> -
> - if (memcmp(&key[off], &ptr[off], rec->dtrd_size) != 0)
> - goto hashnext;
> - }
> + if (memcmp(key, agd->dtada_key, agg->dtagd_ksize))
> + goto hashnext;
With this change, variables i, off, and rec are no longer used and should be
removed.
> /*
> * Clear hash data (and update its gen) if the data gen is
> --
> 2.18.4
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list