diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2019-03-08 16:29:20 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2019-03-08 16:29:20 +0100 |
| commit | 5e4b1548315976918cd755eca72ec47a53096be4 (patch) | |
| tree | bce139cd2eb0bca847b87f48f3ebb5bd3cbb21a9 | |
| parent | 31693290ed717d700480774f4f6b49dbe9b9b704 (diff) | |
| download | cc4group-5e4b1548315976918cd755eca72ec47a53096be4.tar.gz cc4group-5e4b1548315976918cd755eca72ec47a53096be4.zip | |
Fix description of cc4group.setEntryData and remove wrong description of cc4group.createFile
| -rw-r--r-- | src/cc4group.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cc4group.h b/src/cc4group.h index 82eddf6..9c5625b 100644 --- a/src/cc4group.h +++ b/src/cc4group.h @@ -65,8 +65,8 @@ typedef struct { struct { int Take; // cc4group will free the data when its not needed anymore; e.g. in the destructor or when setting the file's data again - int Copy; // cc4group will copy the data to use it - int Reference; // cc4group will use the data as is (i.e. store the pointer and use it); the caller must guarantee it's validity throughout the groups lifetime (or until the file's data is set to a new pointer) + int Copy; // cc4group will copy the data to use it; the original data is untouched and needs to be freed by the caller whenever desired + int Reference; // cc4group will use the data as is (i.e. store the pointer and use it); the caller must guarantee it's validity throughout the groups lifetime (or until the file's data is set to a new pointer) and needs to take care of freeing it afterwards } const MemoryManagement; void (*setTmpMemoryStrategy)(const CC4Group_TmpMemoryStrategy strategy); @@ -85,10 +85,9 @@ typedef struct { bool (*renameEntry)(CC4Group* const this, const char* const oldPath, const char* const newPath); bool (*createDirectory)(CC4Group* const this, const char* const path); - // ownership of the data is taken by the group bool (*createFile)(CC4Group* const this, const char* const path); - // ownership of the data is taken by the group if freeData is true - // if freeData is false, the caller must guarantee that the pointer is valid as long as it is used in the group (i.e. until the pointer is changed through another call to setEntryData or the group is destructed) + + // see the description of MemoryManagement to know if and when data has to be freed by the caller bool (*setEntryData)(CC4Group* const this, const char* const entryPath, const void* const data, size_t const size, int const memoryManagementMode); } const CC4Group_API; |
