On 19 August 2014 18:14, <br...@apache.org> wrote: > Author: brane > Date: Tue Aug 19 14:14:18 2014 > New Revision: 1618869 > > URL: http://svn.apache.org/r1618869 > Log: > On the authzperf branch: Add a stringbuf helper function. > [..]
> --- subversion/branches/authzperf/subversion/libsvn_subr/string.c (original) > +++ subversion/branches/authzperf/subversion/libsvn_subr/string.c Tue Aug 19 > 14:14:18 2014 > @@ -496,6 +496,21 @@ svn_stringbuf_chop(svn_stringbuf_t *str, > str->data[str->len] = '\0'; > } > > +void > +svn_stringbuf_leftchop(svn_stringbuf_t *str, apr_size_t nbytes) > +{ > + if (nbytes > str->len) > + str->len = 0; As far I remember we have a API promise that svn_stringbuf_t->data is always valid nul-terminated string. While the function seems to be pretty simple, tests will be nice to have IMHO. > + else > + { > + /* Note: This will irretrievably waste nbytes of space in the > + stringbuf's pool, but unlike the alternative of memmoving the > + data, it's a constant-time operation. */ > + str->data += nbytes; > + str->len -= nbytes; > + str->blocksize -= nbytes; > + } > +} > -- Ivan Zhakov CTO | VisualSVN | http://www.visualsvn.com