1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-22 20:35:44 +01:00

error handling for trexio_text_deinit function

This commit is contained in:
q-posev 2021-05-19 15:03:15 +02:00
parent f2c79827b5
commit 0cc24bd21e
2 changed files with 9 additions and 3 deletions

View File

@ -232,10 +232,11 @@ trexio_text_deinit (trexio_t* const file)
trexio_exit_code rc;
assert (trexio_text_free_$group$( (trexio_text_t*) file) == TREXIO_SUCCESS);
/* Error handling for this call is added by the generator */
rc = trexio_text_free_$group$( (trexio_text_t*) file);
rc = trexio_text_free_rdm( (trexio_text_t*) file);
assert (rc == TREXIO_SUCCESS);
if (rc != TREXIO_SUCCESS) return rc;
return TREXIO_SUCCESS;
@ -772,7 +773,6 @@ trexio_exit_code trexio_text_flush_rdm(trexio_text_t* const file) {
if (rdm->to_flush == 0) return TREXIO_SUCCESS;
FILE* f = fopen(rdm->file_name,"w");
assert (f != NULL);

View File

@ -386,6 +386,12 @@ for fname in ['def_hdf5.c', 'basic_hdf5.c', 'basic_text_group.c',
templine1 = line.replace('$GROUP_NUM$', num.upper())
templine2 = templine1.replace('$group_num$', num)
f_out.write(templine2)
# special case for proper error handling when deallocting text groups
elif 'rc = trexio_text_free_$group$' in line:
for grname in config.keys():
templine1 = line.replace('$group$', grname)
templine2 = templine1 + ' if (rc != TREXIO_SUCCESS) return rc;\n'
f_out.write(templine2)
elif '$group$' in line or '$GROUP$' in line :
for grname in config.keys():
templine1 = line.replace('$group$', grname)