-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In C, you can copy the contents of a struct to another with the = operator, but this can quickly backfire if the struct holds any pointers and you want to have two sets of data and not two pointers to the same data.
In case the user wants to make a copy of the entire contents of a struct, I think a good practice would be for the module to provide public copy functions for each struct available. While this is a little overkill since some structs don't contain pointer values, it would provide a standardized interface for the user and allow pointer values to be safely added to any existing struct.
So, for this issue, you must implement copy functions for all structs available in the module. These functions must be public and handle possible NULL pointer errors.
Some of these functions already exist as static functions, but they do not handle possible errors with NULL pointers.