commit 83054901a0cecd3849f6184144ed82396c1b9401
parent 2a684b4d4394e01bf43b449624951c6d0300a383
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 24 Nov 2015 10:42:21 +0100
Minor update of the parsing of optical properties
Make more robust the parsing of empty lines.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/schiff_optical_properties.c b/src/schiff_optical_properties.c
@@ -140,11 +140,12 @@ schiff_optical_properties_load_stream
schiff_streamline_init(&streamline);
- iline = 1;
- while((res = schiff_streamline_read(&streamline, stream, &line)) != RES_EOF) {
+ for(iline=1;
+ (res = schiff_streamline_read(&streamline, stream, &line)) != RES_EOF;
+ ++iline) {
struct schiff_optical_properties tmp_props;
- if(*line == '\0' /*Empty line*/ || *line == '#' /* Comment */)
+ if(strcspn(line, "# \t") == 0) /* Empty line */
continue;
/* Read optical properties */
@@ -153,7 +154,6 @@ schiff_optical_properties_load_stream
if(res == RES_OK) { /* *NO* error */
sa_push(props, tmp_props);
}
- ++iline;
}
/* Sort the optical properties in ascending order with respect to the