From b593ea30833ad5dcacb9076c988aec31b0cf26ec Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Mon, 23 Jan 2012 08:53:57 +0100 Subject: Imported Upstream version 2.1.7 --- src/err.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/err.hpp') diff --git a/src/err.hpp b/src/err.hpp index 3ffd99d..b540a5d 100644 --- a/src/err.hpp +++ b/src/err.hpp @@ -46,6 +46,7 @@ namespace zmq namespace zmq { const char *wsa_error (); + const char *wsa_error_no (int no_); void win_error (char *buffer_, size_t buffer_size_); void wsa_error_to_errno (); } @@ -63,6 +64,17 @@ namespace zmq }\ } while (false) +// Provides convenient way to assert on WSA-style errors on Windows. +#define wsa_assert_no(no) \ + do {\ + const char *errstr = zmq::wsa_error_no (no);\ + if (errstr != NULL) {\ + fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ + __FILE__, __LINE__);\ + abort ();\ + }\ + } while (false) + // Provides convenient way to check GetLastError-style errors on Windows. #define win_assert(x) \ do {\ -- cgit v1.2.3