Re: [PATCH] RFC: come up with startswith function.

2021-03-18 Thread Martin Sebor via Gcc-patches
On 3/18/21 4:46 AM, Martin Liška wrote: Hey. Recently, I noticed a cumbersome construct we use for string startswith function (most notably in a situation when the prefix is a string literal). Commonly used patterns are: 1) strncmp (arg, "--sysroot=", 10) == 0 2) strncmp (name, "not found", s

[PATCH] RFC: come up with startswith function.

2021-03-18 Thread Martin Liška
Hey. Recently, I noticed a cumbersome construct we use for string startswith function (most notably in a situation when the prefix is a string literal). Commonly used patterns are: 1) strncmp (arg, "--sysroot=", 10) == 0 2) strncmp (name, "not found", sizeof ("not found") - 1) == 0 3) strncmp (v