From 72b92e92d39fa8c513d4166c1f0feed48241aac7 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Tue, 4 Jun 2013 00:09:00 -0700 Subject: [PATCH] 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. --- src/node_crypto.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 2cc684490bb..e63df25d74d 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -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_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) \ - if (!Buffer::HasInstance(val)) { \ - return ThrowException(Exception::TypeError(String::New("Not a buffer"))); \ - } +#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;