Skip to content

Commit 4692b72

Browse files
committed
src: constify WITH_GENERIC_STREAM macro
Make the pointer-to-wrap const (i.e. mutable but not assignable) to prevent accidental reassignment in the macro body.
1 parent c079f6e commit 4692b72

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/node_wrap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ extern v8::Persistent<v8::FunctionTemplate> tcpConstructorTmpl;
3939
#define WITH_GENERIC_STREAM(obj, BODY) \
4040
do { \
4141
if (HasInstance(tcpConstructorTmpl, obj)) { \
42-
TCPWrap* wrap = TCPWrap::Unwrap(obj); \
42+
TCPWrap* const wrap = TCPWrap::Unwrap(obj); \
4343
BODY \
4444
} else if (HasInstance(ttyConstructorTmpl, obj)) { \
45-
TTYWrap* wrap = TTYWrap::Unwrap(obj); \
45+
TTYWrap* const wrap = TTYWrap::Unwrap(obj); \
4646
BODY \
4747
} else if (HasInstance(pipeConstructorTmpl, obj)) { \
48-
PipeWrap* wrap = PipeWrap::Unwrap(obj); \
48+
PipeWrap* const wrap = PipeWrap::Unwrap(obj); \
4949
BODY \
5050
} \
5151
} while (0)

0 commit comments

Comments
 (0)