mirror of
https://github.com/curl/curl.git
synced 2026-06-02 04:24:15 +03:00
lib: add a Curl_bufref_uptr() function and use it
Function Curl_bufref_ptr() now returns a const char *. New function Curl_bufref_uptr() returns a const unsigned char *. Usage and doc updated. Closes #19827
This commit is contained in:
parent
39d1976b7f
commit
f39b8a1174
13 changed files with 40 additions and 23 deletions
14
lib/bufref.c
14
lib/bufref.c
|
|
@ -84,7 +84,7 @@ void Curl_bufref_set(struct bufref *br, const void *ptr, size_t len,
|
|||
/*
|
||||
* Get a pointer to the referenced buffer.
|
||||
*/
|
||||
const unsigned char *Curl_bufref_ptr(const struct bufref *br)
|
||||
const unsigned char *Curl_bufref_uptr(const struct bufref *br)
|
||||
{
|
||||
DEBUGASSERT(br);
|
||||
DEBUGASSERT(br->signature == SIGNATURE);
|
||||
|
|
@ -93,6 +93,18 @@ const unsigned char *Curl_bufref_ptr(const struct bufref *br)
|
|||
return br->ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a pointer to the referenced string.
|
||||
*/
|
||||
const char *Curl_bufref_ptr(const struct bufref *br)
|
||||
{
|
||||
DEBUGASSERT(br);
|
||||
DEBUGASSERT(br->signature == SIGNATURE);
|
||||
DEBUGASSERT(br->ptr || !br->len);
|
||||
|
||||
return (const char *) br->ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the length of the referenced buffer data.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue