Re: [PATCH 2/6] strbuf: add string-chomping functions

2013-01-29 Thread Michael Haggerty
On 01/29/2013 12:10 PM, Jeff King wrote: > On Tue, Jan 29, 2013 at 11:15:34AM +0100, Michael Haggerty wrote: >> Please document the new functions in >> Documentation/technical/api-strbuf.txt. Personally I would also >> advocate a "docstring" in the header file, but obviously that preference >> is

Re: [PATCH 2/6] strbuf: add string-chomping functions

2013-01-29 Thread Jeff King
On Tue, Jan 29, 2013 at 11:15:34AM +0100, Michael Haggerty wrote: > > +void strbuf_chompmem(struct strbuf *sb, const void *data, size_t len) > > +{ > > + if (sb->len >= len && !memcmp(data, sb->buf + sb->len - len, len)) > > + strbuf_setlen(sb, sb->len - len); > > +} > > + > > +void st

Re: [PATCH 2/6] strbuf: add string-chomping functions

2013-01-29 Thread Michael Haggerty
On 01/29/2013 10:15 AM, Jeff King wrote: > Sometimes it is handy to cut a trailing string off the end > of a strbuf (e.g., a file extension). These helper functions > make it a one-liner. > > Signed-off-by: Jeff King > --- > strbuf.c | 11 +++ > strbuf.h | 2 ++ > 2 files changed, 13 in