diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-02-22 16:23:36 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-02-22 16:23:36 +0100 |
commit | 43e8868875e1d5287979e5b9060a9b16be45cc79 (patch) | |
tree | d6df0587b107de28641b429048dff002e3c2387f /src/err.hpp | |
parent | 98ccff1a24a056aef15372b131eee1c1bf8f62ca (diff) |
Added explicit error message in case of memory exhaustion
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/err.hpp')
-rw-r--r-- | src/err.hpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/err.hpp b/src/err.hpp index 9d8e153..fc8b7c1 100644 --- a/src/err.hpp +++ b/src/err.hpp @@ -98,7 +98,7 @@ namespace zmq }\ } while (false) -// Provides convenient way to check for POSIX errors. +// Provides convenient way to check for POSIX errors. #define posix_assert(x) \ do {\ if (unlikely (x)) {\ @@ -107,7 +107,7 @@ namespace zmq }\ } while (false) -// Provides convenient way to check for errors from getaddrinfo. +// Provides convenient way to check for errors from getaddrinfo. #define gai_assert(x) \ do {\ if (unlikely (x)) {\ @@ -117,10 +117,16 @@ namespace zmq }\ } while (false) -#endif - -#define zmq_not_implemented() \ +// Provides convenient way to check whether memory allocation have succeeded. +#define alloc_assert(x) \ do {\ - fprintf (stderr, "Hic sunt leones (%s:%d)\n", __FILE__, __LINE__);\ - abort ();\ + if (unlikely (!x)) {\ + fprintf (stderr, "FATAL ERROR: OUT OF MEMORY (%s:%d)\n",\ + __FILE__, __LINE__);\ + abort ();\ + }\ } while (false) + +#endif + + |