@@ -88,7 +88,10 @@ constexpr char kPathSeparator = '/';
88
88
const char * const kPathSeparator = " \\ /" ;
89
89
#endif
90
90
91
- #define GET_OFFSET (a ) ((a)->IsNumber () ? (a).As<Integer>()->Value() : -1)
91
+ inline int64_t GetOffset (Local<Value> value) {
92
+ return value->IsNumber () ? value.As <Integer>()->Value () : -1 ;
93
+ }
94
+
92
95
#define TRACE_NAME (name ) " fs.sync." #name
93
96
#define GET_TRACE_ENABLED \
94
97
(*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED \
@@ -1679,7 +1682,7 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
1679
1682
CHECK_LE (len, buffer_length);
1680
1683
CHECK_GE (off + len, off);
1681
1684
1682
- const int64_t pos = GET_OFFSET (args[4 ]);
1685
+ const int64_t pos = GetOffset (args[4 ]);
1683
1686
1684
1687
char * buf = buffer_data + off;
1685
1688
uv_buf_t uvbuf = uv_buf_init (buf, len);
@@ -1719,7 +1722,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {
1719
1722
CHECK (args[1 ]->IsArray ());
1720
1723
Local<Array> chunks = args[1 ].As <Array>();
1721
1724
1722
- int64_t pos = GET_OFFSET (args[2 ]);
1725
+ int64_t pos = GetOffset (args[2 ]);
1723
1726
1724
1727
MaybeStackBuffer<uv_buf_t > iovs (chunks->Length ());
1725
1728
@@ -1763,7 +1766,7 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
1763
1766
CHECK (args[0 ]->IsInt32 ());
1764
1767
const int fd = args[0 ].As <Int32>()->Value ();
1765
1768
1766
- const int64_t pos = GET_OFFSET (args[2 ]);
1769
+ const int64_t pos = GetOffset (args[2 ]);
1767
1770
1768
1771
const auto enc = ParseEncoding (isolate, args[3 ], UTF8);
1769
1772
0 commit comments