Github user phrocker commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/417#discussion_r225978725
--- Diff: libminifi/include/capi/cstructs.h ---
@@ -86,11 +86,16 @@ typedef struct {
*/
typedef struct {
- char *key;
+ const char *key;
--- End diff --
I see that the function prototype has changed. We should make clear known
issue in comments. I'm concerned about the lifetime of these pointers and
ownership. The original idea was that key can and would change in attribute due
to dynamic properties, hence why key was sent in addition to attribute. i'll
have to give this more thought. I think there may be some diverging thoughts on
this. It's also making me wonder about the utility of get_all_attributes.
After more thought we should be making the internal API more C like, so in
general use of new on a returned object is probably not ideal anyway ( kind of
goes to an earlier comment ). Since we're crossing the boundary there aren't
guarantees that we would be safely freeing that -- same goes for the other
create_functions where new was already used -- so that can be done later,
though ( https://issues.apache.org/jira/browse/MINIFICPP-645).
---