From 4692b725deaf263aac79e8959ce4ca2a2285f3a0 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 7 Aug 2013 14:53:49 +0200 Subject: [PATCH] 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. --- src/node_wrap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_wrap.h b/src/node_wrap.h index c5fe0fccd7..8839a7a50b 100644 --- a/src/node_wrap.h +++ b/src/node_wrap.h @@ -39,13 +39,13 @@ extern v8::Persistent tcpConstructorTmpl; #define WITH_GENERIC_STREAM(obj, BODY) \ do { \ if (HasInstance(tcpConstructorTmpl, obj)) { \ - TCPWrap* wrap = TCPWrap::Unwrap(obj); \ + TCPWrap* const wrap = TCPWrap::Unwrap(obj); \ BODY \ } else if (HasInstance(ttyConstructorTmpl, obj)) { \ - TTYWrap* wrap = TTYWrap::Unwrap(obj); \ + TTYWrap* const wrap = TTYWrap::Unwrap(obj); \ BODY \ } else if (HasInstance(pipeConstructorTmpl, obj)) { \ - PipeWrap* wrap = PipeWrap::Unwrap(obj); \ + PipeWrap* const wrap = PipeWrap::Unwrap(obj); \ BODY \ } \ } while (0)