2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

allow undedication of the dedicated buffer

This commit is contained in:
Bob Halley
1999-07-28 02:20:22 +00:00
parent 996028142c
commit 5fc1b54cc6
2 changed files with 11 additions and 5 deletions

View File

@@ -254,12 +254,16 @@ dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer);
* The caller must not write to buffer until the name has been
* invalidated or is otherwise known not to be in use.
*
* If buffer is NULL and the name previously had a dedicated buffer,
* than that buffer is no longer dedicated to use with this name.
* The caller is responsible for ensuring that the storage used by
* the name remains valid.
*
* Requires:
* 'name' is a valid name.
*
* 'name' doesn't have a dedicated buffer already.
*
* 'buffer' is a valid binary buffer.
* 'buffer' is a valid binary buffer and 'name' doesn't have a
* dedicated buffer already, or 'buffer' is NULL.
*/
isc_boolean_t

View File

@@ -289,8 +289,10 @@ dns_name_setbuffer(dns_name_t *name, isc_buffer_t *buffer) {
*/
REQUIRE(VALID_NAME(name));
REQUIRE(name->buffer == NULL);
REQUIRE(isc_buffer_type(buffer) == ISC_BUFFERTYPE_BINARY);
REQUIRE((buffer != NULL &&
name->buffer == NULL &&
isc_buffer_type(buffer) == ISC_BUFFERTYPE_BINARY) ||
(buffer == NULL));
name->buffer = buffer;
}