Messages in this thread | | | Date | Thu, 29 Aug 2019 14:34:50 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH v4 6/8] sched: Replace strncmp with str_has_prefix |
| |
On Fri, Aug 09, 2019 at 03:10:51PM +0800, Chuhong Yuan wrote: > strncmp(str, const, len) is error-prone because len > is easy to have typo.
I'm thinking that is exactly the easy case for compilers/semantic checkers to verify. Now granted, GCC doesn't seem to do that by itself, but still.
I'd buy your argument if the prefix is variable, because in that case you can do prefix matching cheaper than strlen+strncmp, but as is, not really.
| |