I believe the first two should be ok, but I'm not sure what I myself think of the third one. Perhaps the saving is not worth the complexity, but it does annoy my optimization nerve to see all the unnecessary duplicated work being done. Rasmus Villemoes (3): grep: move grep_source_init outside critical section grep: simplify grep_oid and grep_file grep: avoid one strdup() per file builtin/grep.c | 25 ++++++++++++------------- grep.c | 8 ++++++-- 2 files changed, 18 insertions(+), 15 deletions(-) -- 2.15.1