Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-05-08 01:49:14 +0300
committerJames M Snell <jasnell@gmail.com>2020-06-16 19:23:34 +0300
commit55360443ced34515c775c5beb29f907de671dffe (patch)
tree77a533af0ace262f3d7b3adb6f198fdec4e5c946 /src/util.h
parentbccb514936ab5f225bb9fb7cda259490322321c1 (diff)
quic: initial QUIC implementation
Co-authored-by: Anna Henningsen <anna@addaleax.net> Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com> Co-authored-by: gengjiawen <technicalcute@gmail.com> Co-authored-by: James M Snell <jasnell@gmail.com> Co-authored-by: Lucas Pardue <lucaspardue.24.7@gmail.com> Co-authored-by: Ouyang Yadong <oyydoibh@gmail.com> Co-authored-by: Juan Jos<C3><A9> Arboleda <soyjuanarbol@gmail.com> Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com> Co-authored-by: Denys Otrishko <shishugi@gmail.com> PR-URL: https://github.com/nodejs/node/pull/32379 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 8bdeb35184e..8cec9a8aab9 100644
--- a/src/util.h
+++ b/src/util.h
@@ -331,6 +331,11 @@ constexpr size_t arraysize(const T (&)[N]) {
return N;
}
+template <typename T, size_t N>
+constexpr size_t strsize(const T (&)[N]) {
+ return N - 1;
+}
+
// Allocates an array of member type T. For up to kStackStorageSize items,
// the stack is used, otherwise malloc().
template <typename T, size_t kStackStorageSize = 1024>
@@ -564,6 +569,11 @@ struct MallocedBuffer {
size = new_size;
}
+ void Realloc(size_t new_size) {
+ Truncate(new_size);
+ data = UncheckedRealloc(data, new_size);
+ }
+
inline bool is_empty() const { return data == nullptr; }
MallocedBuffer() : data(nullptr), size(0) {}