Github user dskarbek commented on a diff in the pull request:
https://github.com/apache/qpid-dispatch/pull/108#discussion_r87629907
--- Diff: src/dispatch_private.h ---
@@ -141,4 +141,16 @@ void qd_dispatch_unregister_entity(qd_dispatch_t *qd,
void *impl);
/** Set the agent */
void qd_dispatch_set_agent(qd_dispatch_t *qd, void *agent);
+/**
--- End diff --
Yeah, I tried it that way also. The advantage of this is that I can pass
in NULL to cause the memory to be freed. But, the copy in may be the better
way. Only issue, is if you look at the two places this is being use, one is
passing strdup, so no problem there, the strdup could just happen inside the
method. The other one is passing the result of qd_entity_opt_string(). That
also returns newly allocated memory, right? So, I'd have to catch that return
separately, pass it in and then free it. And, we'd basically be doing a wasted
extra alloc/free. That didn't seem so nice. So, that's why I tended toward
having this internal method just manage the setting of the pointer and ensuring
that prior pointee's are freed. And, of course, that's why I commented the
method as taking ownership of the memory. Let me know if you prefer the other
approach.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]