to_alloc += vec[n].iov_len;
}
- if (evbuffer_expand(buf, to_alloc) < 0) {
+ if (_evbuffer_expand_fast(buf, to_alloc, 2) < 0) {
goto done;
}
for (n = 0; n < n_vec; n++) {
+ /* XXX each 'add' call here does a bunch of setup that's
+ * obviated by _evbuffer_expand_fast, and some cleanup that we
+ * would like to do only once. Instead we should just extract
+ * the part of the code that's needed. */
+
if (evbuffer_add(buf, vec[n].iov_base, vec[n].iov_len) < 0) {
goto done;
}
"On the one hand, it cuts for Justice, imposing practical morality upon those who fear it.",
"Conscience does not always adhere to rational judgment.",
"Guilt is always a self-imposed burden, but it is not always rightly imposed."
+ /* -- R.A. Salvatore, _Sojurn_ */
};
size_t expected_length = 0;
size_t returned_length = 0;
for (i = 0; i < 4; i++) {
vec[i].iov_len = strlen(data[i]);
- vec[i].iov_base = data[i];
+ vec[i].iov_base = (char*) data[i];
expected_length += vec[i].iov_len;
}