Skip to content

Create public functions that allow provided structs to be copied #24

@AndreLaranjeira

Description

@AndreLaranjeira

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions