fread: change return types of all field parsers #2234
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously all field parsers returned
_Bool
status, withtrue
indicating a successful parse, andfalse
indicating a failure.This PR makes it so that all field parsers return an
int
, with0
indicating success and1
indicating failure. This is equivalent to applying logical not to all return values. The reason for such change is that it will allow us to have more than one type of failure in the future (i.e.1
indicating regular failure,2
indicating recoverable failure, etc.) These extend return types will be used in PR #2200Additionally, this PR modifies the type of the
target
parameter: each field parser will have the target variable suitable for that particular parser. This improves code readability and serves as additional documentation as to the purpose of each parser.In some places where
trash
variable were declared aschar[8]
those were replaced withdouble
orint64_t
or similar -- this is to ensure proper alignment of the variable (char[8]
may be byte-aligned, whereasdouble
is aligned to 8-byte boundary).