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


##########
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:
   Should this assert instead of null check?  _refcount and _decref do (_decref 
needs an explicit assert, I think).  Maybe the null check in pn_object_incref, 
not pni_object_incref?
   
   In general, I'd prefer all the refcounting methods required a non-null 
object, but that does require fixing up a number of places.



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