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

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 4 Mar 2024 11:39:21 +0100

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