[Mesa-dev] [PATCH 11/12] glcpp: Create fast path hand-written scanner

Grazvydas Ignotas notasas at gmail.com
Sun Jan 8 14:11:25 UTC 2017


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.

GraÅžvydas


More information about the mesa-dev mailing list