Skip to content

Commit ed24f16

Browse files
chore: fix C lint errors
PR-URL: #8446 Closes: #8443 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 99e8f14 commit ed24f16

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/node_modules/@stdlib/blas/base/dasum/benchmark/c/benchmark.length.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ static double rand_double( void ) {
9696
*/
9797
static double benchmark1( int iterations, int len ) {
9898
double elapsed;
99-
double x[ len ];
99+
double *x;
100100
double y;
101101
double t;
102102
int i;
103103

104+
x = (double *) malloc( len * sizeof( double ) );
104105
for ( i = 0; i < len; i++ ) {
105106
x[ i ] = ( rand_double()*20000.0 ) - 10000.0;
106107
}
@@ -117,6 +118,7 @@ static double benchmark1( int iterations, int len ) {
117118
if ( y != y ) {
118119
printf( "should not return NaN\n" );
119120
}
121+
free( x );
120122
return elapsed;
121123
}
122124

@@ -129,11 +131,12 @@ static double benchmark1( int iterations, int len ) {
129131
*/
130132
static double benchmark2( int iterations, int len ) {
131133
double elapsed;
132-
double x[ len ];
134+
double *x;
133135
double y;
134136
double t;
135137
int i;
136138

139+
x = (double *) malloc( len * sizeof( double ) );
137140
for ( i = 0; i < len; i++ ) {
138141
x[ i ] = ( rand_double()*20000.0 ) - 10000.0;
139142
}
@@ -150,6 +153,7 @@ static double benchmark2( int iterations, int len ) {
150153
if ( y != y ) {
151154
printf( "should not return NaN\n" );
152155
}
156+
free( x );
153157
return elapsed;
154158
}
155159

0 commit comments

Comments
 (0)