aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/DYNBUF.md12
-rw-r--r--lib/dynbuf.c4
2 files changed, 8 insertions, 8 deletions
diff --git a/docs/DYNBUF.md b/docs/DYNBUF.md
index 3ab059bae..550477ee1 100644
--- a/docs/DYNBUF.md
+++ b/docs/DYNBUF.md
@@ -60,17 +60,17 @@ larger than the buffer length.
char *Curl_dyn_ptr(const struct dynbuf *s);
-Returns a `char *` to the buffer. Since the buffer may be reallocated, this
-pointer should not be trusted or used anymore after the next buffer
-manipulation call.
+Returns a `char *` to the buffer if it has a length, otherwise a NULL. Since
+the buffer may be reallocated, this pointer should not be trusted or used
+anymore after the next buffer manipulation call.
## uptr
unsigned char *Curl_dyn_uptr(const struct dynbuf *s);
-Returns an `unsigned char *` to the buffer. Since the buffer may be
-reallocated, this pointer should not be trusted or used anymore after the next
-buffer manipulation call.
+Returns an `unsigned char *` to the buffer if it has a length, otherwise a
+NULL. Since the buffer may be reallocated, this pointer should not be trusted
+or used anymore after the next buffer manipulation call.
## len
diff --git a/lib/dynbuf.c b/lib/dynbuf.c
index 64004952f..dfc1d05c6 100644
--- a/lib/dynbuf.c
+++ b/lib/dynbuf.c
@@ -201,7 +201,7 @@ char *Curl_dyn_ptr(const struct dynbuf *s)
DEBUGASSERT(s);
DEBUGASSERT(s->init == DYNINIT);
DEBUGASSERT(!s->leng || s->bufr);
- return s->leng ? s->bufr : (char *)"";
+ return s->bufr;
}
/*
@@ -212,7 +212,7 @@ unsigned char *Curl_dyn_uptr(const struct dynbuf *s)
DEBUGASSERT(s);
DEBUGASSERT(s->init == DYNINIT);
DEBUGASSERT(!s->leng || s->bufr);
- return s->leng ? (unsigned char *)s->bufr : (unsigned char *)"";
+ return (unsigned char *)s->bufr;
}
/*