summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/node_api.cc4
-rw-r--r--src/util.h12
2 files changed, 11 insertions, 5 deletions
diff --git a/src/node_api.cc b/src/node_api.cc
index 22be3647ea..ef4ec29708 100644
--- a/src/node_api.cc
+++ b/src/node_api.cc
@@ -2173,11 +2173,11 @@ static napi_status set_error_code(napi_env env,
}
}
name_string = v8::String::Concat(
- isolate, name_string, FIXED_ONE_BYTE_STRING(isolate, " ["));
+ isolate, name_string, node::FIXED_ONE_BYTE_STRING(isolate, " ["));
name_string =
v8::String::Concat(isolate, name_string, code_value.As<v8::String>());
name_string = v8::String::Concat(
- isolate, name_string, FIXED_ONE_BYTE_STRING(isolate, "]"));
+ isolate, name_string, node::FIXED_ONE_BYTE_STRING(isolate, "]"));
set_maybe = err_object->Set(context, name_key, name_string);
RETURN_STATUS_IF_FALSE(env,
diff --git a/src/util.h b/src/util.h
index 057346a2d0..4036383dee 100644
--- a/src/util.h
+++ b/src/util.h
@@ -89,9 +89,6 @@ NO_RETURN void Abort();
NO_RETURN void Assert(const char* const (*args)[4]);
void DumpBacktrace(FILE* fp);
-#define FIXED_ONE_BYTE_STRING(isolate, string) \
- (node::OneByteString((isolate), (string), sizeof(string) - 1))
-
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
void operator=(const TypeName&) = delete; \
void operator=(TypeName&&) = delete; \
@@ -248,6 +245,15 @@ inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
const unsigned char* data,
int length = -1);
+// Used to be a macro, hence the uppercase name.
+template <int N>
+inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(
+ v8::Isolate* isolate,
+ const char(&data)[N]) {
+ return OneByteString(isolate, 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).
inline void SwapBytes16(char* data, size_t nbytes);