summaryrefslogtreecommitdiff
path: root/src/err.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-02-22 16:23:36 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-02-22 16:23:36 +0100
commit43e8868875e1d5287979e5b9060a9b16be45cc79 (patch)
treed6df0587b107de28641b429048dff002e3c2387f /src/err.hpp
parent98ccff1a24a056aef15372b131eee1c1bf8f62ca (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.hpp20
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
+
+