Re: [PATCH 3/3] grep: avoid one strdup() per file

2018-02-15 Thread Jeff King
On Thu, Feb 15, 2018 at 10:56:15PM +0100, Rasmus Villemoes wrote: > There is only one instance of grep_source_init(GREP_SOURCE_FILE), and in > that case the path and identifier arguments are equal - not just as > strings, but the same pointer is passed. So we can save some time and > memory by

[PATCH 3/3] grep: avoid one strdup() per file

2018-02-15 Thread Rasmus Villemoes
There is only one instance of grep_source_init(GREP_SOURCE_FILE), and in that case the path and identifier arguments are equal - not just as strings, but the same pointer is passed. So we can save some time and memory by reusing the gs->path = xstrdup_or_null(path) we have already done as