parse_int(), parse_ul(): improvements
parse_int():
(1) do not truncate the result from long to int (for example, on 64-bit
platform it will cause 4294967299 to be treated like 3, instead check
for the value to be between INT_MIN and INT_MAX and return the error.
(2) Since we check for INT_MIN/INT_MAX, there's no need to check for
errno == ERANGE (and initialize errno).
(3) no need to cast &tail to char**
(4) do not change *val if there was an error
parse_ul():
Similar to 1-4 above, plus:
(5) Since we are not longer truncating to INT, make it possible to specify
values higher than INT_MAX (but lower than LONG_MAX).
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed