From 54066bd10709958efa6ff599d8b139bb8f3d6ed5 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Tue, 18 Jan 2022 10:41:59 -0500 Subject: [PATCH 1/2] perf_hooks: remove useless calls in Histogram Coverity reported some calls that had no effect, remove them Signed-off-by: Michael Dawson --- src/histogram.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/histogram.cc b/src/histogram.cc index 87641a4a3691c7..b36530527264df 100644 --- a/src/histogram.cc +++ b/src/histogram.cc @@ -162,7 +162,7 @@ void HistogramBase::GetPercentiles(const FunctionCallbackInfo& args) { map->Set( env->context(), Number::New(env->isolate(), key), - Number::New(env->isolate(), static_cast(value))).IsEmpty(); + Number::New(env->isolate(), static_cast(value))); }); } @@ -177,7 +177,7 @@ void HistogramBase::GetPercentilesBigInt( map->Set( env->context(), Number::New(env->isolate(), key), - BigInt::New(env->isolate(), value)).IsEmpty(); + BigInt::New(env->isolate(), value)); }); } @@ -592,7 +592,7 @@ void IntervalHistogram::GetPercentiles( map->Set( env->context(), Number::New(env->isolate(), key), - Number::New(env->isolate(), static_cast(value))).IsEmpty(); + Number::New(env->isolate(), static_cast(value))); }); } @@ -607,7 +607,7 @@ void IntervalHistogram::GetPercentilesBigInt( map->Set( env->context(), Number::New(env->isolate(), key), - BigInt::New(env->isolate(), value)).IsEmpty(); + BigInt::New(env->isolate(), value)); }); } From 1b095d38fa3e308aea423d91e66e444bab840546 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 26 Jan 2022 16:36:03 -0500 Subject: [PATCH 2/2] squash: address comments Signed-off-by: Michael Dawson --- src/histogram.cc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/histogram.cc b/src/histogram.cc index b36530527264df..63fa52a57df157 100644 --- a/src/histogram.cc +++ b/src/histogram.cc @@ -159,10 +159,10 @@ void HistogramBase::GetPercentiles(const FunctionCallbackInfo& args) { CHECK(args[0]->IsMap()); Local map = args[0].As(); (*histogram)->Percentiles([map, env](double key, int64_t value) { - map->Set( - env->context(), - Number::New(env->isolate(), key), - Number::New(env->isolate(), static_cast(value))); + USE(map->Set( + env->context(), + Number::New(env->isolate(), key), + Number::New(env->isolate(), static_cast(value)))); }); } @@ -174,10 +174,10 @@ void HistogramBase::GetPercentilesBigInt( CHECK(args[0]->IsMap()); Local map = args[0].As(); (*histogram)->Percentiles([map, env](double key, int64_t value) { - map->Set( - env->context(), - Number::New(env->isolate(), key), - BigInt::New(env->isolate(), value)); + USE(map->Set( + env->context(), + Number::New(env->isolate(), key), + BigInt::New(env->isolate(), value))); }); } @@ -589,10 +589,10 @@ void IntervalHistogram::GetPercentiles( CHECK(args[0]->IsMap()); Local map = args[0].As(); (*histogram)->Percentiles([map, env](double key, int64_t value) { - map->Set( - env->context(), - Number::New(env->isolate(), key), - Number::New(env->isolate(), static_cast(value))); + USE(map->Set( + env->context(), + Number::New(env->isolate(), key), + Number::New(env->isolate(), static_cast(value)))); }); } @@ -604,10 +604,10 @@ void IntervalHistogram::GetPercentilesBigInt( CHECK(args[0]->IsMap()); Local map = args[0].As(); (*histogram)->Percentiles([map, env](double key, int64_t value) { - map->Set( - env->context(), - Number::New(env->isolate(), key), - BigInt::New(env->isolate(), value)); + USE(map->Set( + env->context(), + Number::New(env->isolate(), key), + BigInt::New(env->isolate(), value))); }); }