fetch-pack: use parse_oid_hex

Instead of hard-coding constants, use parse_oid_hex to compute a pointer and use it in further parsing operations. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Aug 18, 2019 at 20:04 UTC f6af19a9ad814de530bfac9b564126234434a9e3
1 file changed +6 -6
fetch-pack.c
+6 -6
@@ -168,16 +168,16 @@ static enum ack_type get_ack(struct packet_reader *reader,
168 if (!strcmp(reader->line, "NAK"))
169 return NAK;
170 if (skip_prefix(reader->line, "ACK ", &arg)) {
171 - if (!get_oid_hex(arg, result_oid)) {
172 - arg += 40;
173 - len -= arg - reader->line;
171 + const char *p;
172 + if (!parse_oid_hex(arg, result_oid, &p)) {
173 + len -= p - reader->line;
174 if (len < 1)
175 return ACK;
176 - if (strstr(arg, "continue"))
176 + if (strstr(p, "continue"))
177 return ACK_continue;
178 - if (strstr(arg, "common"))
178 + if (strstr(p, "common"))
179 return ACK_common;
180 - if (strstr(arg, "ready"))
180 + if (strstr(p, "ready"))
181 return ACK_ready;
182 return ACK;
183 }