Re: [PATCH 11/12] reftable/record: decode keys in place

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

 



On Wed, Feb 28, 2024 at 11:13:49AM +1100, James Liu wrote:
> On Wed Feb 14, 2024 at 6:46 PM AEDT, Patrick Steinhardt wrote:
> > -	strbuf_reset(key);
> > -	strbuf_add(key, last_key.buf, prefix_len);
> > -	strbuf_add(key, in.buf, suffix_len);
> > +	strbuf_setlen(last_key, prefix_len);
> > +	strbuf_add(last_key, in.buf, suffix_len);
> >  	string_view_consume(&in, suffix_len);
> >  
> >  	return start_len - in.len;
> 
> Since we're using `strbuf`, there's no need to worry about extra bytes
> for the null terminator here right?

Exactly, the `struct strbuf` interface handles this for us.

Patrick

Attachment: signature.asc
Description: PGP signature


[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