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

fix cppcheck warnings regarding redundant size_dset_str checks

This commit is contained in:
q-posev 2021-09-21 16:08:04 +02:00
parent d1a9af4185
commit 389d265f7f

View File

@ -483,6 +483,7 @@ trexio_text_read_$group$ (trexio_text_t* const file)
// START REPEAT GROUP_DSET_STR
/* Allocate arrays */
if(size_$group_dset$ != 0) {
$group$->$group_dset$ = CALLOC(size_$group_dset$, $group_dset_dtype$);
assert (!($group$->$group_dset$ == NULL));
if ($group$->$group_dset$ == NULL) {
@ -507,7 +508,7 @@ trexio_text_read_$group$ (trexio_text_t* const file)
, BUT it's size has to be number_of_str*max_len_str where max_len_str is somewhat arbitrary, e.g. 32.
,*/
char* tmp_$group_dset$;
if(size_$group_dset$ != 0) tmp_$group_dset$ = CALLOC(size_$group_dset$*32, char);
tmp_$group_dset$ = CALLOC(size_$group_dset$*32, char);
for (uint64_t i=0 ; i<size_$group_dset$ ; ++i) {
$group$->$group_dset$[i] = tmp_$group_dset$;
@ -527,6 +528,7 @@ trexio_text_read_$group$ (trexio_text_t* const file)
size_t tmp_$group_dset$_len = strlen($group$->$group_dset$[i]);
tmp_$group_dset$ += tmp_$group_dset$_len + 1;
}
}
// END REPEAT GROUP_DSET_STR
FREE(buffer);