Re: [PATCH 1/4] string: try to find const-laundering bugs

2018-08-22 Thread Rasmus Villemoes
On 2018-08-22 13:07, Joe Perches wrote: > On Wed, 2018-08-22 at 13:00 +0200, Rasmus Villemoes wrote: >> This wraps strchr and friends in macros that ensure the return value has >> type const char* if the passed-in string (which the return value points >> into) also has type const char*. The (s)+0 t

Re: [PATCH 1/4] string: try to find const-laundering bugs

2018-08-22 Thread Joe Perches
On Wed, 2018-08-22 at 13:00 +0200, Rasmus Villemoes wrote: > This wraps strchr and friends in macros that ensure the return value has > type const char* if the passed-in string (which the return value points > into) also has type const char*. The (s)+0 thing is to force a const > char[] (e.g. a str

[PATCH 1/4] string: try to find const-laundering bugs

2018-08-22 Thread Rasmus Villemoes
This wraps strchr and friends in macros that ensure the return value has type const char* if the passed-in string (which the return value points into) also has type const char*. The (s)+0 thing is to force a const char[] (e.g. a string literal) to decay to a const char* for the __same_type comparis