return (result);
}
isc_buffer_allocate(zone->catzs->mctx, &aclb, 16);
- isc_buffer_setautorealloc(aclb, true);
for (result = dns_rdata_apl_first(&rdata_apl); result == ISC_R_SUCCESS;
result = dns_rdata_apl_next(&rdata_apl))
{
*/
isc_buffer_allocate(zone->catzs->mctx, &buffer, ISC_BUFFER_INCR);
- isc_buffer_setautorealloc(buffer, true);
isc_buffer_putstr(buffer, "zone \"");
dns_name_totext(&entry->name, true, buffer);
isc_buffer_putstr(buffer, "\" { type secondary; primaries");
*/
REQUIRE(b->length <= length);
REQUIRE(base != NULL);
- REQUIRE(!b->autore);
+ REQUIRE(b->mctx == NULL);
if (b->length > 0U) {
(void)memmove(base, b->base, b->length);
b->length = length;
}
-void
-isc_buffer_setautorealloc(isc_buffer_t *b, bool enable) {
- REQUIRE(ISC_BUFFER_VALID(b));
- REQUIRE(b->mctx != NULL);
- b->autore = enable;
-}
-
void
isc_buffer_compact(isc_buffer_t *b) {
unsigned int length;
REQUIRE(ISC_BUFFER_VALID(b));
REQUIRE(r != NULL);
- if (b->autore) {
+ if (b->mctx) {
result = isc_buffer_reserve(b, r->length);
if (result != ISC_R_SUCCESS) {
return (result);
isc_buffer_init(dbuf, bdata, length);
- ENSURE(ISC_BUFFER_VALID(dbuf));
-
dbuf->mctx = mctx;
*dynbuffer = dbuf;
return (ISC_R_FAILURE);
}
- if (b->autore) {
+ if (b->mctx) {
result = isc_buffer_reserve(b, n + 1);
if (result != ISC_R_SUCCESS) {
return (result);
*/
isc_buffer_allocate(req->mctx, &req->sendbuffer, HTTP_SENDLEN);
isc_buffer_clear(req->sendbuffer);
- isc_buffer_setautorealloc(req->sendbuffer, true);
isc_buffer_initnull(&req->bodybuffer);
ISC_LINK(isc_buffer_t) link;
/*! private internal elements */
isc_mem_t *mctx;
- /* automatically realloc buffer at put* */
- bool autore;
};
/***
*
*/
-void
-isc_buffer_setautorealloc(isc_buffer_t *b, bool enable);
-/*!<
- * \brief Enable or disable autoreallocation on 'b'.
- *
- * Requires:
- *\li 'b' is a valid dynamic buffer (b->mctx != NULL).
- *
- */
-
void
isc_buffer_compact(isc_buffer_t *b);
/*!<
{ \
REQUIRE(ISC_BUFFER_VALID(b)); \
\
- if (b->autore) { \
+ if (b->mctx) { \
isc_result_t result = isc_buffer_reserve(b, \
sizeof(val)); \
ENSURE(result == ISC_R_SUCCESS); \
unsigned int length) {
ISC_REQUIRE(ISC_BUFFER_VALID(b));
- if (b->autore) {
+ if (b->mctx) {
isc_result_t result = isc_buffer_reserve(b, length);
ISC_REQUIRE(result == ISC_R_SUCCESS);
}
ISC_REQUIRE(source != NULL);
length = (unsigned int)strlen(source);
- if (b->autore) {
+ if (b->mctx) {
isc_result_t result = isc_buffer_reserve(b, length);
ISC_ENSURE(result == ISC_R_SUCCESS);
}
isc_buffer_allocate(mctx, &stream->rbuf,
INITIAL_DNS_MESSAGE_BUFFER_SIZE);
- isc_buffer_setautorealloc(stream->rbuf, true);
ISC_LIST_PREPEND(sock->h2.session->cstreams, stream, link);
*streamp = stream;
if (session->buf == NULL) {
isc_buffer_allocate(session->mctx, &session->buf,
unread_size);
- isc_buffer_setautorealloc(session->buf, true);
}
isc_buffer_putmem(session->buf, region->base + readlen,
unread_size);
isc_buffer_allocate(session->mctx,
&session->pending_write_data,
INITIAL_DNS_MESSAGE_BUFFER_SIZE);
- isc_buffer_setautorealloc(session->pending_write_data,
- true);
}
isc_buffer_putmem(session->pending_write_data, data, pending);
total = new_total;
if (nghttp2_session_want_read(session->ngsession) != 0) {
if (!session->reading) {
- /* We have not yet started reading from this handle */
+ /* We have not yet started
+ * reading from this handle */
isc_nm_read(session->handle, http_readcb, session);
session->reading = true;
} else if (session->buf != NULL) {
size_t remaining =
isc_buffer_remaininglength(session->buf);
- /* Leftover data in the buffer, use it */
+ /* Leftover data in the
+ * buffer, use it */
size_t readlen = nghttp2_session_mem_recv(
session->ngsession,
isc_buffer_current(session->buf), remaining);
send_cbarg);
return;
} else {
- /* Resume reading, it's idempotent, wait for more */
+ /* Resume reading, it's
+ * idempotent, wait for more
+ */
isc_nm_read(session->handle, http_readcb, session);
}
} else {
NGHTTP2_PROTO_VERSION_ID_LEN) != 0)
{
/*
- * HTTP/2 negotiation error. Any sensible DoH
- * client will fail if HTTP/2 cannot be
- * negotiated via ALPN.
+ * HTTP/2 negotiation error.
+ * Any sensible DoH client
+ * will fail if HTTP/2 cannot
+ * be negotiated via ALPN.
*/
result = ISC_R_HTTP2ALPNERROR;
goto error;
ngsession, frame->hd.stream_id);
/*
- * For DATA and HEADERS frame, this callback may be
- * called after on_stream_close_callback. Check that
- * the stream is still alive.
+ * For DATA and HEADERS frame,
+ * this callback may be called
+ * after
+ * on_stream_close_callback.
+ * Check that the stream is
+ * still alive.
*/
if (socket == NULL) {
return (0);
break;
default:
/*
- * All other characters from the alphabet are the same
- * for both base64 and base64url, so we can reuse the
- * validation table for the rest of the characters.
+ * All other characters from
+ * the alphabet are the same
+ * for both base64 and
+ * base64url, so we can reuse
+ * the validation table for
+ * the rest of the characters.
*/
if (base64[i] != '-' && base64[i] != '_' &&
base64url_validation_table[(size_t)base64[i]])
assert_non_null(b);
assert_int_equal(b->length, last_length);
- isc_buffer_setautorealloc(b, true);
-
isc_buffer_putuint8(b, 1);
for (i = 0; i < 1000; i++) {
assert_int_equal(result, ISC_R_SUCCESS);
/*
- * Appending more data to the buffer should fail.
- */
- result = isc_buffer_copyregion(b, &r);
- assert_int_equal(result, ISC_R_NOSPACE);
-
- /*
- * Enable auto reallocation and retry. Appending should now succeed.
+ * Appending should succeed.
*/
- isc_buffer_setautorealloc(b, true);
result = isc_buffer_copyregion(b, &r);
assert_int_equal(result, ISC_R_SUCCESS);
*/
b = NULL;
isc_buffer_allocate(mctx, &b, 0);
- isc_buffer_setautorealloc(b, true);
/*
* Sanity check.