ECC-440: reduce number of open/close in tools

This commit is contained in:
Shahram Najm 2020-06-29 16:11:19 +01:00
parent 03feb61043
commit 5185171123
2 changed files with 9 additions and 0 deletions

View File

@ -255,6 +255,7 @@ grib_file* grib_file_open(const char* filename, const char* mode, int* err)
GRIB_MUTEX_UNLOCK(&mutex1);
return NULL;
}
if (file->mode) free(file->mode);
file->mode = strdup(mode);
if (file_pool.context->io_buffer_size) {
#ifdef POSIX_MEMALIGN

View File

@ -150,6 +150,14 @@ int grib_tool(int argc, char** argv)
grib_context* c = grib_context_get_default();
global_options.context = c;
/* This is a consequence of ECC-440.
* We want to keep the output file(s) opened as various
* messages are appended to them. Otherwise they will be opened/closed
* multiple times.
*/
if (c->file_pool_max_opened_files == 0)
c->file_pool_max_opened_files = 200;
#ifdef ENABLE_FLOATING_POINT_EXCEPTIONS
feenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT);
#endif