From 881fe4917d43664c2400a1febdb3a345e6ceeb05 Mon Sep 17 00:00:00 2001 From: kaushal-kumar-it Date: Sat, 8 Nov 2025 13:12:35 +0530 Subject: [PATCH 1/8] chore: fix C lint errors (issue #8443) --- .../base/dasum/benchmark/c/benchmark.length.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 617865ed3f15..2bf609236627 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -74,7 +74,7 @@ static void print_results( int iterations, double elapsed ) { static double tic( void ) { struct timeval now; gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec/1.0e6; + return (double)now.tv_sec + (double)now.tv_usec / 1.0e6; } /** @@ -96,13 +96,13 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x = (double *)malloc( len * sizeof(double) ); double y; double t; int i; for ( i = 0; i < len; i++ ) { - x[ i ] = ( rand_double()*20000.0 ) - 10000.0; + x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } y = 0.0; t = tic(); @@ -117,6 +117,7 @@ static double benchmark1( int iterations, int len ) { if ( y != y ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -129,13 +130,13 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double x[ len ]; + double *x = (double *)malloc( len * sizeof(double) ); double y; double t; int i; for ( i = 0; i < len; i++ ) { - x[ i ] = ( rand_double()*20000.0 ) - 10000.0; + x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; } y = 0.0; t = tic(); @@ -150,6 +151,7 @@ static double benchmark2( int iterations, int len ) { if ( y != y ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; } @@ -171,7 +173,7 @@ int main( void ) { count = 0; for ( i = MIN; i <= MAX; i++ ) { len = pow( 10, i ); - iter = ITERATIONS / pow( 10, i-1 ); + iter = ITERATIONS / pow( 10, i - 1 ); for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:len=%d\n", NAME, len ); @@ -188,4 +190,5 @@ int main( void ) { } } print_summary( count, count ); + } From b967ef1f7dc11a650c83a1af78c867a798c655fc Mon Sep 17 00:00:00 2001 From: kaushal-kumar-it Date: Sat, 8 Nov 2025 13:21:27 +0530 Subject: [PATCH 2/8] chore: fix C lint errors (issue #8443) --- .../@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 2bf609236627..54749fd12e61 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -190,5 +190,5 @@ int main( void ) { } } print_summary( count, count ); - + } From 3a2003f5580cd1ac100556ad2cc4b93395f06680 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 8 Nov 2025 17:11:47 -0800 Subject: [PATCH 3/8] style: visually group operands Signed-off-by: Athan --- .../@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 54749fd12e61..03e0c9e6de8c 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -74,7 +74,7 @@ static void print_results( int iterations, double elapsed ) { static double tic( void ) { struct timeval now; gettimeofday( &now, NULL ); - return (double)now.tv_sec + (double)now.tv_usec / 1.0e6; + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; } /** From 963d41e48e181f9252dbb3867bb87136e9793816 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 8 Nov 2025 17:12:12 -0800 Subject: [PATCH 4/8] style: remove whitespace Signed-off-by: Athan --- .../@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 03e0c9e6de8c..6f9a1c86b49b 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -173,7 +173,7 @@ int main( void ) { count = 0; for ( i = MIN; i <= MAX; i++ ) { len = pow( 10, i ); - iter = ITERATIONS / pow( 10, i - 1 ); + iter = ITERATIONS / pow( 10, i-1 ); for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:len=%d\n", NAME, len ); From 6e69b5fe6193c6d107dd37e4400e54c5037f376a Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 8 Nov 2025 17:12:30 -0800 Subject: [PATCH 5/8] style: remove empty line Signed-off-by: Athan --- .../@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 6f9a1c86b49b..95d738c42a55 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -190,5 +190,4 @@ int main( void ) { } } print_summary( count, count ); - } From 4e59d09ca33444fa456c5c793f89943508abdd7e Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 8 Nov 2025 17:13:00 -0800 Subject: [PATCH 6/8] style: remove whitespace Signed-off-by: Athan --- .../@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 95d738c42a55..2b595959ac2c 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -136,7 +136,7 @@ static double benchmark2( int iterations, int len ) { int i; for ( i = 0; i < len; i++ ) { - x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; + x[ i ] = ( rand_double()*20000.0 ) - 10000.0; } y = 0.0; t = tic(); From 96d1123fd141aedcad8e1a201c3c9c07459e5bee Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 8 Nov 2025 17:13:20 -0800 Subject: [PATCH 7/8] style: remove whitespace Signed-off-by: Athan --- .../@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 2b595959ac2c..7b37a6ba445e 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -102,7 +102,7 @@ static double benchmark1( int iterations, int len ) { int i; for ( i = 0; i < len; i++ ) { - x[ i ] = ( rand_double() * 20000.0 ) - 10000.0; + x[ i ] = ( rand_double()*20000.0 ) - 10000.0; } y = 0.0; t = tic(); From e3e2fe1cc46ae256fe655227014cb9cde0e3b54a Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 8 Nov 2025 17:15:03 -0800 Subject: [PATCH 8/8] style: move allocation to separate line This ensures consistency with https://github.com/stdlib-js/stdlib/blob/99e8f1412d6a27eb27e5d0d02d9f81945d14fbd5/tools/snippets/benchmark/c/native/benchmark.length.c. Signed-off-by: Athan --- .../@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c index 7b37a6ba445e..671b6348af7c 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static double rand_double( void ) { */ static double benchmark1( int iterations, int len ) { double elapsed; - double *x = (double *)malloc( len * sizeof(double) ); + double *x; double y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*20000.0 ) - 10000.0; } @@ -130,11 +131,12 @@ static double benchmark1( int iterations, int len ) { */ static double benchmark2( int iterations, int len ) { double elapsed; - double *x = (double *)malloc( len * sizeof(double) ); + double *x; double y; double t; int i; + x = (double *) malloc( len * sizeof( double ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_double()*20000.0 ) - 10000.0; }