astitcher commented on code in PR #369:
URL: https://github.com/apache/qpid-proton/pull/369#discussion_r864414072


##########
c/src/core/object/object.c:
##########
@@ -58,50 +67,130 @@ pn_cid_t pn_class_id(const pn_class_t *clazz)
   return clazz->cid;
 }
 
+static inline void *pni_object_new(const pn_class_t *clazz, size_t size)
+{
+  void *object = NULL;
+  pni_head_t *head = (pni_head_t *) pni_mem_zallocate(clazz, 
sizeof(pni_head_t) + size);
+  if (head != NULL) {
+    object = head + 1;
+    head->clazz = clazz;
+    head->refcount = 1;
+  }
+  return object;
+}
+
+static inline void pni_object_incref(void *object) {
+  if (object) {

Review Comment:
   pn_class_incref/decref are actually allowed to be called with a NULL object 
so they really do need to check for null and do nothing if they get that - the 
other inlined functions may not need the check.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to