Re: [PATCH 02/10] reftable: stop using `strbuf_addf()`

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

 



On Fri, Oct 11, 2024 at 02:51:57AM -0700, karthik nayak wrote:
> Patrick Steinhardt <ps@xxxxxx> writes:
> > @@ -1077,8 +1078,10 @@ static void t_reftable_stack_auto_compaction_with_locked_tables(void)
> >  	 * size, we expect that auto-compaction will want to compact all of the
> >  	 * tables. Locking any of the tables will keep it from doing so.
> >  	 */
> > -	strbuf_reset(&buf);
> 
> However here it is different, since we still use the strbuf. I guess it
> should be okay, since 'buf' is initialized using 'STRBUF_INIT' and that
> still keeps the buf.len to 0.
> 
> > -	strbuf_addf(&buf, "%s/%s.lock", dir, st->readers[2]->name);
> > +	strbuf_addstr(&buf, dir);
> > +	strbuf_addstr(&buf, "/");
> > +	strbuf_addstr(&buf, st->readers[2]->name);
> > +	strbuf_addstr(&buf, ".lock");
> >  	write_file_buf(buf.buf, "", 0);
> >
> 
> So when we do 'strbuf_addstr(&buf, ...)' it should allocate the required
> memory. But the reset removal did catch my eye.

Yeah, I removed it while at it as it is completely unnecessary. I've
updated the commit message to point this out.

Patrick




[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