Re: [PATCH v2 07/18] branch-diff: indent the diffs just like tbdiff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Martin,

On Sun, 6 May 2018, Martin Ågren wrote:

> On 4 May 2018 at 17:34, Johannes Schindelin <johannes.schindelin@xxxxxx> wrote:
> > @@ -353,6 +358,7 @@ static void output(struct string_list *a, struct string_list *b,
> >  int cmd_branch_diff(int argc, const char **argv, const char *prefix)
> >  {
> >         struct diff_options diffopt = { NULL };
> > +       struct strbuf four_spaces = STRBUF_INIT;
> >         double creation_weight = 0.6;
> >         struct option options[] = {
> >                 OPT_SET_INT(0, "no-patches", &diffopt.output_format,
> > @@ -371,6 +377,9 @@ int cmd_branch_diff(int argc, const char **argv, const char *prefix)
> >
> >         diff_setup(&diffopt);
> >         diffopt.output_format = DIFF_FORMAT_PATCH;
> > +       diffopt.output_prefix = output_prefix_cb;
> > +       strbuf_addstr(&four_spaces, "    ");
> > +       diffopt.output_prefix_data = &four_spaces;
> >
> >         argc = parse_options(argc, argv, NULL, options,
> >                         builtin_branch_diff_usage, PARSE_OPT_KEEP_UNKNOWN);
> 
> You end up leaking the buffer of `four_spaces`. Granted, that's not a
> big memory leak, but still. ;-) This was the only leak that
> LeakSanitizer found in v2 when running the new test-script and playing
> around with this a bit. This looks really good!

Good point. Fixed.
Dscho

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux