Re: [dev] [st] Two small patches for string handling.

2013-02-27 Thread Christoph Lohmann
Greetings. On Wed, 27 Feb 2013 20:17:04 +0100 "Roberto E. Vargas Caballero" wrote: > > Since a long‐time goal of suckless is to have its own better libc, is > > this a selection which is done to find the best functions. Strsep seems > > to be superior to strtok[_r], so I’m using it now. > > Ok,

Re: [dev] [st] Two small patches for string handling.

2013-02-26 Thread Roberto E. Vargas Caballero
> Since a long‐time goal of suckless is to have its own better libc, is > this a selection which is done to find the best functions. Strsep seems > to be superior to strtok[_r], so I’m using it now. Ok, I only hope that users of systems without strsep (for example solaris https://bugs.launchpad.ne

Re: [dev] [st] Two small patches for string handling.

2013-02-26 Thread Christoph Lohmann
Greetings. On Wed, 27 Feb 2013 06:40:56 +0100 "Roberto E. Vargas Caballero" wrote: > On Wed, Feb 27, 2013 at 12:47:57AM +0400, Alexander Sedov wrote: > >It still conforms to C89/C99, which is the chosen standard for compiling > >st according to default config.mk. > > > Taken from C99 s

Re: [dev] [st] Two small patches for string handling.

2013-02-26 Thread Roberto E. Vargas Caballero
On Wed, Feb 27, 2013 at 12:47:57AM +0400, Alexander Sedov wrote: >It still conforms to C89/C99, which is the chosen standard for compiling >st according to default config.mk. Taken from C99 standard: The strsep function was proposed as an enhanced replacement of strtok functi

Re: [dev] [st] Two small patches for string handling.

2013-02-26 Thread Alexander Sedov
It still conforms to C89/C99, which is the chosen standard for compiling st according to default config.mk. Also, good thing about separate patches is that you don't need to apply all of them. It looks like zero field handling was already casted upon strtok_r, although in slightly more complicated

Re: [dev] [st] Two small patches for string handling.

2013-02-26 Thread Roberto E. Vargas Caballero
> 1. Replaced strtok_r with strsep in strparse, because strsep can handle > zero-width fields (manpage says so) and because resulting code is > clearer. As far as I know strsep is a BSD extension and it is not a POSIX function, so I think we should look for other solution. Best re

Re: [dev] [st] Two small patches for string handling.

2013-02-26 Thread Alexander Sedov
Same things, with style error fixed. 2013/2/27 Alexander Sedov > 1. Replaced strtok_r with strsep in strparse, because strsep can handle > zero-width fields (manpage says so) and because resulting code is clearer. > 2. Fixed potential problem with calling strtol on non-null-terminated > buffer.

[dev] [st] Two small patches for string handling.

2013-02-26 Thread Alexander Sedov
1. Replaced strtok_r with strsep in strparse, because strsep can handle zero-width fields (manpage says so) and because resulting code is clearer. 2. Fixed potential problem with calling strtol on non-null-terminated buffer. 0001-Replaced-strtok_r-with-strsep-for-correct-empty-fiel.patch Descript