On Sat, 6 Nov 2021 15:29:57 -0400 Jason Merrill <ja...@redhat.com> wrote:
> On 11/6/21 14:28, Marek Polacek wrote: > > On Sat, Nov 06, 2021 at 02:32:26AM +0100, Bernhard Reutner-Fischer wrote: > > No, I want q to point into the copy of the string, since I'm about > > to modify it. And I'd prefer a single call to xstrdup rather than > > two. > > It occurs to me that instead of calling xstrdup at all, since you're > already passing the strings to get_identifier you could use > get_identifier_with_length instead, and then refer to IDENTIFIER_POINTER > of the result. Right, i should have looked at the full diff. I can see the point in stripping __attr__ to attr but also stripping the vendors sounds a bit odd, doesn't it. IMHO it would have been way easier to just calculate the desired start and end and get_identifier_with_length for the vendor and attr as Jason said. Guess these local lambdas are a thing nowadays :) Sorry for the noise..