Skip to content

Commit

Permalink
src: wrap macros in do {...} while (0)
Browse files Browse the repository at this point in the history
Wrapped two macros in do {...} while (0) blocks and lined up
backslashes.  Uses up semicolon in contexts where a dangling semicolon
is erroneous.
  • Loading branch information
Nick Desaulniers authored and bnoordhuis committed Jun 4, 2013
1 parent 2900f07 commit 72b92e9
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@
# define OPENSSL_CONST
#endif

#define ASSERT_IS_STRING_OR_BUFFER(val) \
if (!Buffer::HasInstance(val) && !val->IsString()) { \
return ThrowException(Exception::TypeError(String::New( \
"Not a string or buffer"))); \
}

#define ASSERT_IS_BUFFER(val) \
if (!Buffer::HasInstance(val)) { \
return ThrowException(Exception::TypeError(String::New("Not a buffer"))); \
}
#define ASSERT_IS_STRING_OR_BUFFER(val) do { \
if (!Buffer::HasInstance(val) && !val->IsString()) { \
return ThrowException(Exception::TypeError(String::New( \
"Not a string or buffer"))); \
} \
} while (0)

#define ASSERT_IS_BUFFER(val) do { \
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 int PUBLIC_KEY_PFX_LEN = sizeof(PUBLIC_KEY_PFX) - 1;
Expand Down

0 comments on commit 72b92e9

Please sign in to comment.