Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
cae6ddd3
Commit
cae6ddd3
authored
Sep 22, 1999
by
Bob Halley
Browse files
add isc_buffer_copyregion
parent
cdf3c727
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/isc/buffer.c
View file @
cae6ddd3
...
@@ -384,6 +384,24 @@ isc_buffer_putuint32(isc_buffer_t *b, isc_uint32_t val)
...
@@ -384,6 +384,24 @@ isc_buffer_putuint32(isc_buffer_t *b, isc_uint32_t val)
cp
[
3
]
=
(
val
&
0x000000ff
);
cp
[
3
]
=
(
val
&
0x000000ff
);
}
}
isc_result_t
isc_buffer_copyregion
(
isc_buffer_t
*
b
,
isc_region_t
*
r
)
{
unsigned
char
*
base
;
unsigned
int
available
;
REQUIRE
(
ISC_BUFFER_VALID
(
b
));
REQUIRE
(
r
!=
NULL
);
base
=
(
unsigned
char
*
)
b
->
base
+
b
->
used
;
available
=
b
->
length
-
b
->
used
;
if
(
r
->
length
>
available
)
return
(
ISC_R_NOSPACE
);
memcpy
(
base
,
r
->
base
,
r
->
length
);
b
->
used
+=
r
->
length
;
return
(
ISC_R_SUCCESS
);
}
isc_result_t
isc_result_t
isc_buffer_allocate
(
isc_mem_t
*
mctx
,
isc_buffer_t
**
dynbuffer
,
isc_buffer_allocate
(
isc_mem_t
*
mctx
,
isc_buffer_t
**
dynbuffer
,
unsigned
int
length
,
unsigned
int
type
)
unsigned
int
length
,
unsigned
int
type
)
...
...
lib/isc/include/isc/buffer.h
View file @
cae6ddd3
...
@@ -539,6 +539,23 @@ isc_buffer_putuint32(isc_buffer_t *b, isc_uint32_t val);
...
@@ -539,6 +539,23 @@ isc_buffer_putuint32(isc_buffer_t *b, isc_uint32_t val);
* The used pointer in 'b' is advanced by 4.
* The used pointer in 'b' is advanced by 4.
*/
*/
isc_result_t
isc_buffer_copyregion
(
isc_buffer_t
*
b
,
isc_region_t
*
r
);
/*
* Copy the contents of 'r' into 'b'.
*
* Requires:
* 'b' is a valid buffer.
*
* 'r' is a valid region.
*
* Returns:
*
* ISC_R_SUCCESS
* ISC_R_NOSPACE The available region of 'b' is not
* big enough.
*/
ISC_LANG_ENDDECLS
ISC_LANG_ENDDECLS
#endif
/* ISC_BUFFER_H */
#endif
/* ISC_BUFFER_H */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment