grep: use return value of strbuf_detach()

Append the strbuf buffer only after detaching it. There is no practical difference here, as the strbuf is not empty and no strbuf_ function is called between storing the pointer to the still attached buffer and calling strbuf_detach(), so that pointer is valid, but make sure to follow the standard sequence anyway for consistency. Signed-off-by: René Scharfe <l.s.r@web.de> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Aug 25, 2019 at 15:26 UTC fd99c2dd9b0b24fe4bb36366a6b1ff9e29b29286
1 file changed +2 -2
builtin/grep.c
+2 -2
@@ -1110,8 +1110,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
1110 strbuf_addf(&buf, "+/%s%s",
1111 strcmp("less", pager) ? "" : "*",
1112 opt.pattern_list->pattern);
1113 - string_list_append(&path_list, buf.buf);
1114 - strbuf_detach(&buf, NULL);
1113 + string_list_append(&path_list,
1114 + strbuf_detach(&buf, NULL));
1115 }
1116 }
1117