Derek Robert Price wrote:
+# define GETNDELIM_NO_LIMIT (ssize_t)-1
Totally confusing types: the limit is an upper bound for the size of an
array or count, so it should be 'size_t'. The getndelim2() argument called
limit is of type 'int'. And this macro is of type 'ssize_t'. Better let
the caller use 'size_t' everywhere.
No I'm not. Or at least I may not have been consistent about updating
my types, but it should be ssize_t everywhere, if the return type is to
be ssize_t. Don't forget that I wrote this to use limit as a maximum
number of characters. If the number of characters read is returned as
an ssize_t then the number of characters to read should be passed in as
an ssize_t as well.
The same argument could also be applied to the read() and write()
functions. These functions accept a 'size_t count' value in the
range 0 .. SSIZE_MAX. Still the argument type is not an ssize_t,
in order to discourage people from passing negative values.