From: Nguyen Thai Ngoc Duy Date: Wed, 02 May 2012 11:14:36 GMT Subject: Re: [PATCH 2/2] cmd_fetch_pack(): fix constness problem and memory leak Message-ID: In-Reply-To: <1335955259-15309-3-git-send-email-mhagger@alum.mit.edu> On Wed, May 2, 2012 at 5:40 PM, wrote: >                const char *arg = argv[i]; > > -               if (*arg == '-') { > -                       if (!prefixcmp(arg, "--upload-pack=")) { > -                               args.uploadpack = arg + 14; > -                               continue; > -                       } > -                       if (!prefixcmp(arg, "--exec=")) { > -                               args.uploadpack = arg + 7; > -                               continue; > -                       } > -                       if (!strcmp("--quiet", arg) || !strcmp("-q", arg)) { > -                               args.quiet = 1; > -                               continue; > -                       } > -                       if (!strcmp("--keep", arg) || !strcmp("-k", arg)) { > -                               args.lock_pack = args.keep_pack; > -                               args.keep_pack = 1; > -                               continue; > -                       } > -                       if (!strcmp("--thin", arg)) { > -                               args.use_thin_pack = 1; > -                               continue; > -                       } > -                       if (!strcmp("--include-tag", arg)) { > -                               args.include_tag = 1; > -                               continue; > -                       } > -                       if (!strcmp("--all", arg)) { > -                               args.fetch_all = 1; > -                               continue; > -                       } > -                       if (!strcmp("--stdin", arg)) { > -                               args.stdin_refs = 1; > -                               continue; > -                       } > -                       if (!strcmp("-v", arg)) { > -                               args.verbose = 1; > -                               continue; > -                       } > -                       if (!prefixcmp(arg, "--depth=")) { > -                               args.depth = strtol(arg + 8, NULL, 0); > -                               continue; > -                       } > -                       if (!strcmp("--no-progress", arg)) { > -                               args.no_progress = 1; > -                               continue; > -                       } > -                       if (!strcmp("--stateless-rpc", arg)) { > -                               args.stateless_rpc = 1; > -                               continue; > -                       } > -                       if (!strcmp("--lock-pack", arg)) { > -                               args.lock_pack = 1; > -                               pack_lockfile_ptr = &pack_lockfile; > -                               continue; > -                       } > -                       usage(fetch_pack_usage); > +               if (!prefixcmp(arg, "--upload-pack=")) { > +                       args.uploadpack = arg + 14; > +                       continue; > +               } > +               if (!prefixcmp(arg, "--exec=")) { > +                       args.uploadpack = arg + 7; > +                       continue; > +               } > +               if (!strcmp("--quiet", arg) || !strcmp("-q", arg)) { > +                       args.quiet = 1; > +                       continue; > +               } > +               if (!strcmp("--keep", arg) || !strcmp("-k", arg)) { > +                       args.lock_pack = args.keep_pack; > +                       args.keep_pack = 1; > +                       continue; > +               } > +               if (!strcmp("--thin", arg)) { > +                       args.use_thin_pack = 1; > +                       continue; > +               } > +               if (!strcmp("--include-tag", arg)) { > +                       args.include_tag = 1; > +                       continue; > +               } > +               if (!strcmp("--all", arg)) { > +                       args.fetch_all = 1; > +                       continue; > +               } > +               if (!strcmp("--stdin", arg)) { > +                       args.stdin_refs = 1; > +                       continue; > +               } > +               if (!strcmp("-v", arg)) { > +                       args.verbose = 1; > +                       continue; > +               } > +               if (!prefixcmp(arg, "--depth=")) { > +                       args.depth = strtol(arg + 8, NULL, 0); > +                       continue; >                } > -               dest = arg; > -               heads = (char **)(argv + i + 1); > -               nr_heads = argc - i - 1; > -               break; > +               if (!strcmp("--no-progress", arg)) { > +                       args.no_progress = 1; > +                       continue; > +               } > +               if (!strcmp("--stateless-rpc", arg)) { > +                       args.stateless_rpc = 1; > +                       continue; > +               } > +               if (!strcmp("--lock-pack", arg)) { > +                       args.lock_pack = 1; > +                       pack_lockfile_ptr = &pack_lockfile; > +                       continue; > +               } > +               usage(fetch_pack_usage); Ugh, perhaps you can convert the above to parse_options() too while you're making changes in this part? You can say no, I'll do it (my itch anyway). -- Duy