On Tue, Nov 25, 2014 at 03:15:04PM +0300, Ilya Tocar wrote:
> As proposed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63853
> this patch replaces some function calls with pointer arithmetic.
> I didn't mention PR in Changelog, as they are not actually related.
> Ok for trunk?
> @@ -3408,8 +3408,7 @@ handle_foffload_option (const char *arg)
> if (n == NULL)
> n = strchr (c, '\0');
>
> - if (strlen (target) == (size_t) (n - c)
> - && strncmp (target, c, n - c) == 0)
> + if (next - cur == n - c && strncmp (target, c, n - c) == 0)
I suppose you could use memcmp here, you know the string lengths.
> @@ -3431,8 +3433,7 @@ handle_foffload_option (const char *arg)
> if (n == NULL)
> n = strchr (c, '\0');
>
> - if (strlen (target) == (size_t) (n - c)
> - && strncmp (c, target, n - c) == 0)
> + if (next - cur == n - c && strncmp (c, target, n - c) == 0)
> break;
And here too.
Ok with or without those changes.
Jakub