]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/remote-ext.c
Fix sparse warnings
[thirdparty/git.git] / builtin / remote-ext.c
index 1f773171cbdde76cc105e37928cc5f2ecb2ed93f..155e609d68ae81a94128d8d6588dc54463c36ef2 100644 (file)
@@ -1,4 +1,4 @@
-#include "git-compat-util.h"
+#include "builtin.h"
 #include "transport.h"
 #include "run-command.h"
 
@@ -212,16 +212,16 @@ static int command_loop(const char *child)
        char buffer[MAXCOMMAND];
 
        while (1) {
-               size_t length;
+               size_t i;
                if (!fgets(buffer, MAXCOMMAND - 1, stdin)) {
                        if (ferror(stdin))
                                die("Comammand input error");
                        exit(0);
                }
                /* Strip end of line characters. */
-               length = strlen(buffer);
-               while (isspace((unsigned char)buffer[length - 1]))
-                       buffer[--length] = 0;
+               i = strlen(buffer);
+               while (i > 0 && isspace(buffer[i - 1]))
+                       buffer[--i] = 0;
 
                if (!strcmp(buffer, "capabilities")) {
                        printf("*connect\n\n");