[PATCH 3 of 3 V2] chg: pass sensitive command line flags to server

Yuya Nishihara yuya at tcha.org
Fri Feb 19 09:40:20 EST 2016


On Fri, 19 Feb 2016 14:14:48 +0000, Jun Wu wrote:
> > Hmm, it will actually reallocate 'args' buffer incrementally. Though
> > glibc malloc() seems to reuse old 'args' location as there are no
> > other malloc/free, I don't think it is a good design.
>
> I was aware of this issue and the glibc behavior. Considered there are
> not many flags in most cases, I think it's okay to not have an
> additional pass calculating the length.

Yep, it's okay and simple. FWIW, avoiding unnecessary realloc() won't be
that hard.

     cap = 128
     if (req > cap) {
         cap *= 2
         realloc(args, cap)
     }


More information about the Mercurial-devel mailing list