[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] getline & getline_safe
From: |
Bruno Haible |
Subject: |
Re: [Bug-gnulib] getline & getline_safe |
Date: |
Thu, 24 Jul 2003 17:29:11 +0200 |
User-agent: |
KMail/1.5 |
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.
Bruno
- Re: [Bug-gnulib] getline & getline_safe, (continued)
- Re: [Bug-gnulib] getline & getline_safe, Derek Robert Price, 2003/07/24
- Re: [Bug-gnulib] getline & getline_safe, Bruno Haible, 2003/07/24
- Re: [Bug-gnulib] getline & getline_safe, Derek Robert Price, 2003/07/25
- Re: [Bug-gnulib] getline & getline_safe, Bruno Haible, 2003/07/28
- Re: [Bug-gnulib] getline & getline_safe, Jim Meyering, 2003/07/28
- Re: [Bug-gnulib] getline & getline_safe, Derek Robert Price, 2003/07/31
- Re: [Bug-gnulib] getline & getline_safe, Bruno Haible, 2003/07/31
- Re: [Bug-gnulib] getline & getline_safe, Derek Robert Price, 2003/07/31
- Re: [Bug-gnulib] getline & getline_safe, Derek Robert Price, 2003/07/31
- Re: [Bug-gnulib] getline & getline_safe, Derek Robert Price, 2003/07/31
- Re: [Bug-gnulib] getline & getline_safe,
Bruno Haible <=
- Re: [Bug-gnulib] getline & getline_safe, Derek Robert Price, 2003/07/24