diff options
author | leeight <leeight@gmail.com> | 2018-11-19 07:31:26 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-12-01 20:57:00 +0300 |
commit | adbf9477eb244b0f83a705b06269705967194f03 (patch) | |
tree | 1d69b9665e912f3a6b2925e4998589c4a8f1676b /src/util.h | |
parent | 82ceb5e4b1f0114361fca617799caa04725bee1b (diff) |
src: use arraysize instead of hardcode number
PR-URL: https://github.com/nodejs/node/pull/24473
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h index 086e33933e6..9dd39fe1860 100644 --- a/src/util.h +++ b/src/util.h @@ -37,6 +37,7 @@ #include <functional> // std::function #include <set> #include <string> +#include <array> #include <unordered_map> namespace node { @@ -223,6 +224,14 @@ inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING( return OneByteString(isolate, data, N - 1); } +template <std::size_t N> +inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING( + v8::Isolate* isolate, + const std::array<char, N>& arr) { + return OneByteString(isolate, arr.data(), N - 1); +} + + // Swaps bytes in place. nbytes is the number of bytes to swap and must be a // multiple of the word size (checked by function). |