git-compat-util: add xstrdup_or_null helper
[gitweb.git] / builtin / remote-ext.c
index 155e609d68ae81a94128d8d6588dc54463c36ef2..d699d28e98c7e76e3c0a4943b58a8c88acede988 100644 (file)
@@ -30,16 +30,12 @@ static char *strip_escapes(const char *str, const char *service,
        size_t rpos = 0;
        int escape = 0;
        char special = 0;
-       size_t pslen = 0;
-       size_t pSlen = 0;
        size_t psoff = 0;
        struct strbuf ret = STRBUF_INIT;
 
        /* Calculate prefix length for \s and lengths for \s and \S */
        if (!strncmp(service, "git-", 4))
                psoff = 4;
-       pSlen = strlen(service);
-       pslen = pSlen - psoff;
 
        /* Pass the service to command. */
        setenv("GIT_EXT_SERVICE", service, 1);
@@ -183,9 +179,8 @@ static void send_git_request(int stdin_fd, const char *serv, const char *repo,
 static int run_child(const char *arg, const char *service)
 {
        int r;
-       struct child_process child;
+       struct child_process child = CHILD_PROCESS_INIT;
 
-       memset(&child, 0, sizeof(child));
        child.in = -1;
        child.out = -1;
        child.err = 0;