Re: [RFC PATCH 1/3] Make read_gitfile and resolve_gitfile thread safe

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

 



On Mon, Mar 4, 2024 at 8:29 PM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:

> Style: Declare `resolved_gitdir_buf` along with `ret` and `gitdir`,
> then have a blank line before the actual code.

Thanks for the detailed style feedback.

>
> >         } else if (err == READ_GITFILE_ERR_NOT_A_REPO) {
> > -               if (!(backlink = infer_backlink(realdotgit.buf))) {
> > +               if (!(backlink.buf = infer_backlink(realdotgit.buf))) {
>
> Don't do this. Never modify the internal state of strbuf directly;
> consider the state read-only. Modifications should only be made via
> the API. You'll need to rewrite this code a bit to make it work
> correctly with the changes proposed by this patch.

Good catch, I should've paid more attention in the refactoring.

Fixed all of the discussed notes in v2.





[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