Merge branch 'cc/starts-n-ends-with'
Remove a few duplicate implementations of prefix/suffix comparison functions, and rename them to starts_with and ends_with. * cc/starts-n-ends-with: replace {pre,suf}fixcmp() with {starts,ends}_with() strbuf: introduce starts_with() and ends_with() builtin/remote: remove postfixcmp() and use suffixcmp() instead environment: normalize use of prefixcmp() by removing " != 0"
This commit is contained in:
@ -109,7 +109,7 @@ static int receive_status(int in, struct ref *refs)
|
||||
struct ref *hint;
|
||||
int ret = 0;
|
||||
char *line = packet_read_line(in, NULL);
|
||||
if (prefixcmp(line, "unpack "))
|
||||
if (!starts_with(line, "unpack "))
|
||||
return error("did not receive remote status");
|
||||
if (strcmp(line, "unpack ok")) {
|
||||
error("unpack failed: %s", line + 7);
|
||||
@ -122,7 +122,7 @@ static int receive_status(int in, struct ref *refs)
|
||||
line = packet_read_line(in, NULL);
|
||||
if (!line)
|
||||
break;
|
||||
if (prefixcmp(line, "ok ") && prefixcmp(line, "ng ")) {
|
||||
if (!starts_with(line, "ok ") && !starts_with(line, "ng ")) {
|
||||
error("invalid ref status from remote: %s", line);
|
||||
ret = -1;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user