Re: [PATCH] unit-tests: convert t/helper/test-oid-array.c to unit-tests

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

 



On Mon, Feb 26, 2024 at 8:11 PM Ghanshyam Thakkar
<shyamthakkar001@xxxxxxxxx> wrote:
>
> On Mon Feb 26, 2024 at 8:41 PM IST, Christian Couder wrote:

> > So I think it would be better to work on other things instead, like
> > perhaps reviewing other people's work or working on other bug fixes or
> > features. Anyway now that this is on the mailing list, I might as well
> > review it as it could help with your application. But please consider
> > working on other things.
>
> I understand and will work on other things.

Thanks!

> > > In unit testing however, we do not
> > > need to initialize the repo. We can set the length of the hexadecimal
> > > strbuf according to the algorithm used directly.
> >
> > So is your patch doing that or not? It might be better to be explicit.
> > Also if 'strbuf's are used, then is it really worth it to set their
> > length in advance, instead of just letting them grow to the right
> > length as we add hex to them?
>
> I thought of it like this: If we were to just let them grow, then we
> would need separate logic for reusing that strbuf or use a different
> one everytime since it always grows. By separating allocation
> (hex_strbuf_init) and manipulation (fill_hex_strbuf), that same strbuf
> can be reused for different hex values.
>
> But, none of the test currently need to reuse the same strbuf, so I
> suppose it is better to just let it grow and even if the need arises we
> can use strbuf_splice().

It's not a problem to use a new strbuf for each different hex value.
Tests don't need a lot of performance as they are used mostly by
developers, not by everyone using Git. Also if you want to reuse a
strbuf, you can just use strbuf_reset() on it and then reuse it.





[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