Re: New implementation and interface for strlcpy and strlcat

2019-05-25 Thread Marc Espie
On Fri, May 24, 2019 at 07:22:07PM +0700, Oleg Chumanov wrote: > First of all, I really want to thank you for your files. > > However, Can you show me an example of these: > > > makes it easier to perform error > > recovery in the caller. For example, the caller may wish to > > reallocate the buf

Re: New implementation and interface for strlcpy and strlcat

2019-05-25 Thread Oleg Chumanov
Can you tell me, What do you think about this implementation? I think, it is more readable than the current implementation: size_t strlcpy(char *dst, const char *src, size_t dsize) { const char *sbeg = src; if (dsize != 0) for (dst[--dsize] = '\0'; dsize-- != 0; ++src)

Re: New implementation and interface for strlcpy and strlcat

2019-05-25 Thread Oleg Chumanov
First of all, I really want to thank you for your files. However, Can you show me an example of these: > makes it easier to perform error > recovery in the caller. For example, the caller may wish to > reallocate the buffer and retry. > > That would make it a bit harder to do error recovery since

Re: New implementation and interface for strlcpy and strlcat

2019-05-23 Thread Todd C . Miller
On Thu, 23 May 2019 17:21:19 +0700, Oleg Chumanov wrote: > First of all, > I do not understand why the interface (the return value of these functions) i > s so different. They both do almost the same thing. > > I do not understand, why the return value is the length of source or the sum > of leng

Re: New implementation and interface for strlcpy and strlcat

2019-05-23 Thread Otto Moerbeek
On Thu, May 23, 2019 at 05:21:19PM +0700, Oleg Chumanov wrote: > Hi, there > > First of all, > I do not understand why the interface (the return value of these functions) > is so different. They both do almost the same thing. > > I do not understand, why the return value is the length of source

New implementation and interface for strlcpy and strlcat

2019-05-23 Thread Oleg Chumanov
Hi, there First of all, I do not understand why the interface (the return value of these functions) is so different. They both do almost the same thing. I do not understand, why the return value is the length of source or the sum of lengths. I think, it is useless. if we will return the number