From: Ben Noordhuis Date: Wed, 7 Aug 2013 12:53:49 +0000 (+0200) Subject: src: constify WITH_GENERIC_STREAM macro X-Git-Tag: v0.11.6~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4692b725deaf263aac79e8959ce4ca2a2285f3a0;p=platform%2Fupstream%2Fnodejs.git 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. --- diff --git a/src/node_wrap.h b/src/node_wrap.h index c5fe0fc..8839a7a 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)