Re: [PATCH] libbb/last_char_is: rewrite for smaller and faster code

2020-07-04 Thread Kang-Che Sung
On Saturday, July 4, 2020, Harald van Dijk wrote: > > This is really the same problem as with standard library functions such as strchr(). The function should have a return type of char* if its argument has type char*. The function should have a return type of const char* if its argument has type

Re: [PATCH] libbb/last_char_is: rewrite for smaller and faster code

2020-07-04 Thread Harald van Dijk
On 04/07/2020 09:56, Emmanuel Deloget wrote: On Fri, Jul 3, 2020 at 9:15 PM Tito wrote: On 7/3/20 6:13 PM, Xabier Oneca -- xOneca wrote: Also, there's a warning compiling this function: return discards ‘const’ qualifier from pointer target type Hi, cast it? char* FAST_FUNC

Re: [PATCH] libbb/last_char_is: rewrite for smaller and faster code

2020-07-04 Thread Emmanuel Deloget
Hello, On Fri, Jul 3, 2020 at 9:15 PM Tito wrote: > > > > On 7/3/20 6:13 PM, Xabier Oneca -- xOneca wrote: > > Hi all, > > > >>> On Fri, 2020-07-03 at 08:12 +0200, Tito wrote: > >>> [...] > Improved version: > > char* last_char_is(const char *s, int c) { > if (!s ||