EarthScope / evalresp

Evaluates instrument responses in FDSN and derivative formats
GNU Lesser General Public License v3.0
11 stars 2 forks source link

get_int and get_double need to error out some how #25

Closed smellyfis closed 7 years ago

smellyfis commented 7 years ago

in string_fctns.c get_int and get_double used to use longjmp function error_return to exit in case of bad number but now that it will be removed these functions will always return a result.

andrewcooke-isti commented 7 years ago

i'm supposed to be writing a design tomorrow and one of the things i will propose is systematic use of error returns throughout the code.

dricki commented 7 years ago

Yes, absolutely....

he-hesce commented 7 years ago

Have functions return failure/success. Return the actual output in variables.

double output; if (!get_double(line, &output, log))

Perhaps standardize on passing the log object last.

he-hesce commented 7 years ago

Also all memory allocation functions exit() on error. I suggest returning NULL and logging what went wrong.

smellyfis commented 7 years ago

functions in spline.c are void and rely on exit(1) should return int that indicate status

In issue #3 I changed all the functions that call *alloc in alloc_fctns.c to return NULL on failure but I did not put checks on the return value. I think there is a warning flag in either gcc or clang that will warn on unchecked return values.

smellyfis commented 7 years ago

These functions are no longer used therefore this issue can be closed