Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added destructor for pnet_t members #390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asade89
Copy link

@asade89 asade89 commented Mar 29, 2021

This is a destructor for pnet_init_only(), meaning it does not free the
pnet_t structure itself. It will only free the dynamically allocated members of pnet_t.

Implementing a pnet_init() destructor in addition to this would be
trivial.

Seems like this has a use in tests' TearDown() function to release
dynamically allocated objects.


Hello,

I wrote this patch based on discussions in this repo.

This should resolve #260 and potentially #343 (unless pnet_t is dynamically allocated in which case it needs to be free'd too).

I was not sure about your standards in naming functions, but I guessed what you would have chosen based on similiar functionality in the code base.

I also noticed you intend to restructure pnet_t therefore I kept it simple by freeing the dynamic objects and clearing their pointers. I'm clearing the pointers because that seems to be the norm in the code base.

Introducing a pnet_init() destructor is trivial, but I didn't want to expose this to your API as I don't know what your intentions are.

If there are proposals you have in mind, please let me know and I will see can be done.

I have sent a signed CLA by physical mail which should arrive this week :)

Have a good day, cheers :D

This is a destructor for pnet_init_only(), meaning it does not free the
pnet_t structure itself. It will only free the dynamically allocated members of pnet_t.

Implementing a pnet_init() destructor in addition to this would be
trivial.

Seems like this has a use in tests' TearDown() function to release
dynamically allocated objects.
@pyhys
Copy link
Collaborator

pyhys commented Mar 29, 2021

Great, thanks for your contribution!
We will have a look.

@widavies
Copy link

widavies commented Jun 2, 2023

What's the status on this? Any way I can help? @pyhys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Destructor function
3 participants