diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-08-12 17:34:30 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-08-17 22:54:28 +0200 |
commit | 0d9afa0288ccff50edf66a210f2e77d710a0ddca (patch) | |
tree | 6622da499adb0a519d30d5609e8ff31a13dcf0a7 /deps/nghttp2 | |
parent | 9ecc4406421dcc89a010000b1253d3ad0efae64a (diff) | |
download | android-node-v8-0d9afa0288ccff50edf66a210f2e77d710a0ddca.tar.gz android-node-v8-0d9afa0288ccff50edf66a210f2e77d710a0ddca.tar.bz2 android-node-v8-0d9afa0288ccff50edf66a210f2e77d710a0ddca.zip |
deps: cherry-pick eb306f463e from nghttp2 upstream
Original commit message:
lib: add nghttp2_rcbuf_is_static()
Add a `nghttp2_rcbuf_is_static()` method to tell whether a rcbuf
is statically allocated.
This can be useful for language bindings that wish to avoid
creating duplicate strings for these buffers; concretely, I am
planning to use this in the Node HTTP/2 module that is being
introduced.
Ref: https://github.com/nghttp2/nghttp2/commit/eb306f463efea645de611de2bff0a8f823deb048
PR-URL: https://github.com/nodejs/node/pull/14808
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'deps/nghttp2')
-rw-r--r-- | deps/nghttp2/lib/includes/nghttp2/nghttp2.h | 9 | ||||
-rw-r--r-- | deps/nghttp2/lib/nghttp2_rcbuf.c | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/deps/nghttp2/lib/includes/nghttp2/nghttp2.h b/deps/nghttp2/lib/includes/nghttp2/nghttp2.h index 159010040c..848ef066be 100644 --- a/deps/nghttp2/lib/includes/nghttp2/nghttp2.h +++ b/deps/nghttp2/lib/includes/nghttp2/nghttp2.h @@ -470,6 +470,15 @@ NGHTTP2_EXTERN void nghttp2_rcbuf_decref(nghttp2_rcbuf *rcbuf); NGHTTP2_EXTERN nghttp2_vec nghttp2_rcbuf_get_buf(nghttp2_rcbuf *rcbuf); /** + * @function + * + * Returns 1 if the underlying buffer is statically allocated, + * and 0 otherwise. This can be useful for language bindings that wish to avoid + * creating duplicate strings for these buffers. + */ +NGHTTP2_EXTERN int nghttp2_rcbuf_is_static(const nghttp2_rcbuf *rcbuf); + +/** * @enum * * The flags for header field name/value pair. diff --git a/deps/nghttp2/lib/nghttp2_rcbuf.c b/deps/nghttp2/lib/nghttp2_rcbuf.c index 24f561af97..7e7814d2d3 100644 --- a/deps/nghttp2/lib/nghttp2_rcbuf.c +++ b/deps/nghttp2/lib/nghttp2_rcbuf.c @@ -96,3 +96,7 @@ nghttp2_vec nghttp2_rcbuf_get_buf(nghttp2_rcbuf *rcbuf) { nghttp2_vec res = {rcbuf->base, rcbuf->len}; return res; } + +int nghttp2_rcbuf_is_static(const nghttp2_rcbuf *rcbuf) { + return rcbuf->ref == -1; +} |