Re: [PATCH 11/12] reftable/record: decode keys in place
On Wed, Feb 28, 2024 at 11:13:49AM +1100, James Liu wrote:
Show 12 quoted lines
> 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