diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-01-16 12:07:47 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-01-16 12:07:47 -0800 |
| commit | eaebc89f8804a75461375e64fd727f124a929812 (patch) | |
| tree | bb989a67134003409056e5654f906b9fa0d9fb16 /builtin | |
| parent | Merge branch 'ar/dup-words-fixes' (diff) | |
| parent | convert trivial uses of strncmp() to skip_prefix() (diff) | |
| download | git-eaebc89f8804a75461375e64fd727f124a929812.tar.gz git-eaebc89f8804a75461375e64fd727f124a929812.zip | |
Merge branch 'jk/strncmp-to-api-funcs'
Code clean-up.
* jk/strncmp-to-api-funcs:
convert trivial uses of strncmp() to skip_prefix()
convert trivial uses of strncmp() to starts_with()
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/remote-ext.c | 6 | ||||
| -rw-r--r-- | builtin/remote-fd.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c index fd3538d4f0..ee338bf440 100644 --- a/builtin/remote-ext.c +++ b/builtin/remote-ext.c @@ -169,6 +169,8 @@ static int command_loop(const char *child) while (1) { size_t i; + const char *arg; + if (!fgets(buffer, MAXCOMMAND - 1, stdin)) { if (ferror(stdin)) die("Command input error"); @@ -182,10 +184,10 @@ static int command_loop(const char *child) if (!strcmp(buffer, "capabilities")) { printf("*connect\n\n"); fflush(stdout); - } else if (!strncmp(buffer, "connect ", 8)) { + } else if (skip_prefix(buffer, "connect ", &arg)) { printf("\n"); fflush(stdout); - return run_child(child, buffer + 8); + return run_child(child, arg); } else { fprintf(stderr, "Bad command"); return 1; diff --git a/builtin/remote-fd.c b/builtin/remote-fd.c index 91dfe07e06..b2a3980b1d 100644 --- a/builtin/remote-fd.c +++ b/builtin/remote-fd.c @@ -40,7 +40,7 @@ static void command_loop(int input_fd, int output_fd) if (!strcmp(buffer, "capabilities")) { printf("*connect\n\n"); fflush(stdout); - } else if (!strncmp(buffer, "connect ", 8)) { + } else if (starts_with(buffer, "connect ")) { printf("\n"); fflush(stdout); if (bidirectional_transfer_loop(input_fd, |
