Browse Source

src: wrap macros in `do {...} while (0)`

Wrapped two macros in do {...} while (0) blocks and lined up
backslashes.  Uses up semicolon in contexts where a dangling semicolon
is erroneous.
v0.11.3-release
Nick Desaulniers 12 years ago
committed by Ben Noordhuis
parent
commit
72b92e92d3
  1. 23
      src/node_crypto.cc

23
src/node_crypto.cc

@ -43,16 +43,19 @@
# define OPENSSL_CONST # define OPENSSL_CONST
#endif #endif
#define ASSERT_IS_STRING_OR_BUFFER(val) \ #define ASSERT_IS_STRING_OR_BUFFER(val) do { \
if (!Buffer::HasInstance(val) && !val->IsString()) { \ if (!Buffer::HasInstance(val) && !val->IsString()) { \
return ThrowException(Exception::TypeError(String::New( \ return ThrowException(Exception::TypeError(String::New( \
"Not a string or buffer"))); \ "Not a string or buffer"))); \
} } \
} while (0)
#define ASSERT_IS_BUFFER(val) \
if (!Buffer::HasInstance(val)) { \ #define ASSERT_IS_BUFFER(val) do { \
return ThrowException(Exception::TypeError(String::New("Not a buffer"))); \ if (!Buffer::HasInstance(val)) { \
} return ThrowException(Exception::TypeError(String::New( \
"Not a buffer"))); \
} \
} while (0)
static const char PUBLIC_KEY_PFX[] = "-----BEGIN PUBLIC KEY-----"; static const char PUBLIC_KEY_PFX[] = "-----BEGIN PUBLIC KEY-----";
static const int PUBLIC_KEY_PFX_LEN = sizeof(PUBLIC_KEY_PFX) - 1; static const int PUBLIC_KEY_PFX_LEN = sizeof(PUBLIC_KEY_PFX) - 1;

Loading…
Cancel
Save