star-line

Structure for accelerating line importance sampling
git clone git://git.meso-star.fr/star-line.git
Log | Files | Refs | README | LICENSE

commit 016ec5db21e9378a2de8275067e657ddc93dfdbc
parent c5134eb8f447fe28e60a40ec029ca565e26059ea
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  4 Feb 2026 17:54:20 +0100

Correction of error codes when loading the mixture

Several return codes were defined incorrectly.

Diffstat:
Msrc/sln_mixture.c | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/sln_mixture.c b/src/sln_mixture.c @@ -203,7 +203,8 @@ parse_molecule goto error; } if(molecule_already_defined(mixture, molecule->id)) { - LOG(ERROR, "duplicate molecule`%s'\n", tk); + LOG(ERROR, "duplicate molecule `%s'\n", tk); + res = RES_BAD_ARG; goto error; } if(!molecule_has_metadata(molecule->id, args->molparam)) { @@ -222,7 +223,7 @@ parse_molecule tk = strtok_r(NULL, " \t", &tk_ctx); res = cstr_to_double(tk, &molecule->param.cutoff); - if(res != RES_OK && molecule->param.cutoff <= 0) res = RES_BAD_ARG; + if(res == RES_OK && molecule->param.cutoff <= 0) res = RES_BAD_ARG; if(res != RES_OK) { LOG(ERROR, "invalid cutoff `%s'\n", tk); goto error; @@ -255,9 +256,8 @@ setup_molecule_isotope_ids /* The molecule must be defined in the isotope metadata */ res = shtr_isotope_metadata_find_molecule (molparam, molecule->id, &shtr_molecule); - if(res != RES_OK || SHTR_MOLECULE_IS_NULL(&shtr_molecule)) { - goto error; - } + if(res == RES_OK && SHTR_MOLECULE_IS_NULL(&shtr_molecule)) res = RES_BAD_ARG; + if(res != RES_OK) goto error; FOR_EACH(i, 0, shtr_molecule.nisotopes) { molecule->param.isotopes[i].id = shtr_molecule.isotopes[i].id; @@ -320,6 +320,7 @@ parse_isotope res = cstr_to_double(tk, &molecule->param.isotopes[iiso].abundance); if(res != RES_OK || molecule->param.isotopes[iiso].abundance < 0) { LOG(ERROR, "invalid isotope abundance `%s'\n", tk); + res = RES_BAD_ARG; goto error; }