You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2020/06/09 17:07:31 UTC

[GitHub] [qpid-dispatch] jiridanek commented on a change in pull request #757: DISPATCH-1685: add heap allocation API that aborts on failure

jiridanek commented on a change in pull request #757:
URL: https://github.com/apache/qpid-dispatch/pull/757#discussion_r437586665



##########
File path: include/qpid/dispatch/ctools.h
##########
@@ -217,4 +218,41 @@ do {                                    \
 #define MIN(a,b) (((a)<(b))?(a):(b))
 #define MAX(a,b) (((a)>(b))?(a):(b))
 
+//
+// Heap allocation with abort() on failure
+//
+
+static inline void *qd_malloc(size_t size)
+{
+    void *ptr = malloc(size);
+    if (!ptr)
+        abort();

Review comment:
       maybe some error message for the abort? on the other hand, that abort will probably never be called in practice, so it does not matter for UX...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org