svn_stringbuf_t * svn_stringbuf_createv(apr_pool_t *pool, const char *fmt, va_list ap) { char *data = apr_pvsprintf(pool, fmt, ap); /* wrap an svn_stringbuf_t around the new data */ return create_stringbuf(data, strlen(data), pool); }
svn_stringbuf_t * svn_stringbuf_create_ensure(apr_size_t blocksize, apr_pool_t *pool) { char *data = apr_palloc(pool, ++blocksize); /* + space for '\0' */ data[0] = '\0'; /* wrap an svn_stringbuf_t around the new data buffer. */ return create_stringbuf(data, 0, blocksize, pool); }
svn_stringbuf_t * svn_stringbuf_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool) { char *data; data = apr_palloc(pool, size + 1); memcpy(data, bytes, size); /* Null termination is the convention -- even if we suspect the data to be binary, it's not up to us to decide, it's the caller's call. Heck, that's why they call it the caller! */ data[size] = '\0'; /* wrap an svn_stringbuf_t around the new data */ return create_stringbuf(data, size, pool); }