From 01cf5902b9cabb5a3ce0f5cfc6d706c849a58674 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 30 Dec 2019 13:04:31 +0000 Subject: [PATCH] Compiler warnings: variable length array used --- tests/bufr_ecc-604.c | 3 ++- tests/grib_ecc-604-encode.c | 3 ++- tests/grib_ecc-604.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/bufr_ecc-604.c b/tests/bufr_ecc-604.c index cfc5951ec..f280595be 100644 --- a/tests/bufr_ecc-604.c +++ b/tests/bufr_ecc-604.c @@ -118,7 +118,7 @@ int main(int argc, char **argv) } { - pthread_t workers[NUM_THREADS]; + pthread_t* workers = malloc(NUM_THREADS * sizeof(pthread_t)); for (i = 0; i < NUM_THREADS; i++) { struct v *data = (struct v *) malloc(sizeof(struct v)); data->number = i; @@ -139,6 +139,7 @@ int main(int argc, char **argv) pthread_join(workers[i], NULL); } } + free (workers); } return 0; diff --git a/tests/grib_ecc-604-encode.c b/tests/grib_ecc-604-encode.c index ad6a4c33a..c5280ddd1 100644 --- a/tests/grib_ecc-604-encode.c +++ b/tests/grib_ecc-604-encode.c @@ -79,7 +79,7 @@ int main(int argc, char **argv) } { - pthread_t workers[NUM_THREADS]; + pthread_t* workers = malloc(NUM_THREADS * sizeof(pthread_t)); for (i = 0; i < NUM_THREADS; i++) { struct v *data = (struct v *) malloc(sizeof(struct v)); data->number = i; @@ -99,6 +99,7 @@ int main(int argc, char **argv) pthread_join(workers[i], NULL); } } + free (workers); } return 0; diff --git a/tests/grib_ecc-604.c b/tests/grib_ecc-604.c index 45dcc8d84..eb87441d2 100644 --- a/tests/grib_ecc-604.c +++ b/tests/grib_ecc-604.c @@ -127,7 +127,7 @@ int main(int argc, char **argv) } { - pthread_t workers[NUM_THREADS]; + pthread_t* workers = malloc(NUM_THREADS * sizeof(pthread_t)); for (i = 0; i < NUM_THREADS; i++) { struct v *data = (struct v *) malloc(sizeof(struct v)); data->number = i; @@ -148,6 +148,7 @@ int main(int argc, char **argv) pthread_join(workers[i], NULL); } } + free (workers); } return 0;