Git fork

sub-process: do not use strbuf_split*()

The code to read status from subprocess reads one packet line and
tries to find "status=<foo>". It is way overkill to split the line
into an array of two strbufs to extract <foo>.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

+6 -9
+6 -9
sub-process.c
··· 30 30 31 31 int subprocess_read_status(int fd, struct strbuf *status) 32 32 { 33 - struct strbuf **pair; 34 - char *line; 35 33 int len; 36 34 37 35 for (;;) { 36 + char *line; 37 + const char *value; 38 + 38 39 len = packet_read_line_gently(fd, NULL, &line); 39 40 if ((len < 0) || !line) 40 41 break; 41 - pair = strbuf_split_str(line, '=', 2); 42 - if (pair[0] && pair[0]->len && pair[1]) { 42 + if (skip_prefix(line, "status=", &value)) { 43 43 /* the last "status=<foo>" line wins */ 44 - if (!strcmp(pair[0]->buf, "status=")) { 45 - strbuf_reset(status); 46 - strbuf_addbuf(status, pair[1]); 47 - } 44 + strbuf_reset(status); 45 + strbuf_addstr(status, value); 48 46 } 49 - strbuf_list_free(pair); 50 47 } 51 48 52 49 return (len < 0) ? len : 0;