[Mesa-dev] [PATCH 11/12] glcpp: Create fast path hand-written scanner
Grazvydas Ignotas
notasas at gmail.com
Sun Jan 8 14:15:48 UTC 2017
On Sun, Jan 8, 2017 at 4:11 PM, Grazvydas Ignotas <notasas at gmail.com> wrote:
> On Sat, Jan 7, 2017 at 9:02 PM, Vladislav Egorov <vegorov180 at gmail.com> wrote:
>> @@ -582,6 +609,333 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
>>
>> %%
>>
>> +static void
>> +glcpp_fast_skip_singleline_comment (glcpp_parser_t *parser, char **input)
>> +{
>> + /* Skip // */
>> + char *buf = *input + 2;
>> +
>> + while (true) {
>> + char ch = *buf;
>> + if (ch == '\r' || ch == '\n' || ch == '\0')
>> + break;
>> + buf++;
>> + }
>
> Looks like strpbrk() could be used here too?
> Also null char handling looks suspicious.
Ignore the null char comment, I've misread the code :(
More information about the mesa-dev
mailing list