On 7/10/2018 4:21 PM, Jeff King wrote:
On Tue, Jul 10, 2018 at 12:41:52PM -0700, Junio C Hamano wrote:
Jeff King writes:
- while (buf < cp && isspace(cp[-1]))
- cp--;
- *cp++ = '\n';
- return cp - buf;
+ strbuf_rtrim(sb);
Using rtrim is a nice reduc
On Tue, Jul 10, 2018 at 12:41:52PM -0700, Junio C Hamano wrote:
> Jeff King writes:
>
> >> - while (buf < cp && isspace(cp[-1]))
> >> - cp--;
> >> - *cp++ = '\n';
> >> - return cp - buf;
> >> + strbuf_rtrim(sb);
> >
> > Using rtrim is a nice reduction in complexity. A pure translati
Jeff King writes:
>> -while (buf < cp && isspace(cp[-1]))
>> -cp--;
>> -*cp++ = '\n';
>> -return cp - buf;
>> +strbuf_rtrim(sb);
>
> Using rtrim is a nice reduction in complexity. A pure translation would
> include a final strbuf_addch(sb, '\n'). It looks like you move
On Tue, Jul 10, 2018 at 06:20:22PM +, Ben Peart wrote:
> log_ref_write_fd() was written long before strbuf was fleshed out. Remove
> the old manual buffer management code and replace it with strbuf(). Also
> update copy_reflog_msg() which is called only by log_ref_write_fd() to use
> strbuf as
log_ref_write_fd() was written long before strbuf was fleshed out. Remove
the old manual buffer management code and replace it with strbuf(). Also
update copy_reflog_msg() which is called only by log_ref_write_fd() to use
strbuf as it keeps things consistent.
Signed-off-by: Ben Peart
---
Notes:
5 matches
Mail list logo