msolve icon indicating copy to clipboard operation
msolve copied to clipboard

Handle input file line endings

Open vneiger opened this issue 1 year ago • 3 comments

This solves #182.

This also does minor cleaning in two functions of iofiles, the only difference in behaviour should be that get_nvars returns -1 on failure (it used to return 0).

Before merging: related to the FIXME's I put in get_data_from_file, shouldn't this function fail as soon as one of its "data retrieval" components fail?

Also, in this function, is it really necessary to allocate 1073741824 bytes (1GB) for line? I assume only a very small part of it will ever be used so it will sit mostly in virtual memory, but still... say we read line by line using getline (which is not exactly the case currently), we could simply let getline do the necessary reallocs.

vneiger avatar Sep 27 '24 18:09 vneiger

If we go for this, could you add some tests?

mohabsafey avatar Sep 29 '24 19:09 mohabsafey

Sure! I'll work on it and let you know.

On Sun, 2024-09-29 at 12:17 -0700, Mohab Safey El Din wrote:

If we go for this, could you add some tests? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

vneiger avatar Sep 30 '24 07:09 vneiger

Let's wait for CI to complete, but up to some minor fix, but this now should work with several tests added (3 files with DOS endings ; 1 file with DOS endings + no end of line in last line). In case this can be re-used: this contains a function that tests that two data_gens_ff_t contain the same data.

vneiger avatar Oct 03 '24 13:10 vneiger

but up to some minor fix,

@vneiger So is this ready to be merged or do we expect some fix?

ederc avatar Oct 11 '24 11:10 ederc

It is ready for review. (The "up to some minor fix" was in case CI had complained, I should have made that clear.)

vneiger avatar Oct 11 '24 11:10 vneiger