Re: svn commit: r334275 - head/lib/libc/string

2018-05-28 Thread Mariusz Zaborski
Hello Marcelo, Thanks for working on that :) > > tofree = string = strdup("abc,def,ghi"); > -assert(string != NULL); > +if (string != NULL) > + while ((token = strsep(, ",")) != NULL) > + printf("%s\en", token); Please notice: ``` If *stringp is initially NULL, strsep()

Re: svn commit: r334275 - head/lib/libc/string

2018-05-28 Thread Poul-Henning Kamp
In message <20180528155019.w2...@besplex.bde.org>, Bruce Evans writes: >Note that assert() can't be used in signal handlers since it is required >to print to stderr due to C not having any output methods except stdio. That is precisly why I added abort2(2) more than 10 years ago. --

Re: svn commit: r334275 - head/lib/libc/string

2018-05-28 Thread Bruce Evans
On Mon, 28 May 2018, Marcelo Araujo wrote: Log: Update strsep(3) EXAMPLE section regards the usage of assert(3). As many people has pointed out, using assert(3) shall be not the best approach to verify if strdup(3) has allocated memory to string. Reviewed by: imp Modified:

svn commit: r334275 - head/lib/libc/string

2018-05-27 Thread Marcelo Araujo
Author: araujo Date: Mon May 28 05:01:42 2018 New Revision: 334275 URL: https://svnweb.freebsd.org/changeset/base/334275 Log: Update strsep(3) EXAMPLE section regards the usage of assert(3). As many people has pointed out, using assert(3) shall be not the best approach to verify if