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 strbuf_chompstr(struct strbuf *sb, const char *str)
> > +{
> > +   strbuf_chompmem(sb, str, strlen(str));
> > +}
> > +
> It might be handy to have these functions return true/false based on
> whether the suffix was actually found.

Yeah, that sounds reasonable.

> 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 the exception rather than the rule in the git project :-(

Will do. I need to document the metapack functions, too, so I was thinking
about experimenting with some inline documentation systems.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to