Closed
Conversation
For some reason, the libretro fork has this, but upstream does not!
This new one avoids the need for memory allocation, streamlines some
library internals, and provides a simpler interface for the user:
Old API:
```c
core_file* const file_callbacks = (core_file*)malloc(sizeof(core_file));
if (file_callbacks == NULL)
{
return NULL;
}
else
{
chd_file *file;
file_callbacks->argp = &disc->file;
file_callbacks->fsize = ClownCD_Disc_CHDFileSize;
file_callbacks->fread = ClownCD_Disc_CHDFileRead;
file_callbacks->fclose = ClownCD_Disc_CHDFileClose;
file_callbacks->fseek = ClownCD_Disc_CHDFileSeek;
chd_open_core_file(file_callbacks, CHD_OPEN_READ, NULL, &file);
return file;
}
```
New API:
```c
static const core_file_callbacks file_callbacks = {
ClownCD_Disc_CHDFileSize,
ClownCD_Disc_CHDFileRead,
ClownCD_Disc_CHDFileClose,
ClownCD_Disc_CHDFileSeek,
};
chd_file *file;
chd_open_core_file_callbacks(&file_callbacks, &disc->file, CHD_OPEN_READ, NULL, &file);
return file;
```
The old API has been preserved for backwards-compatibility; since
libchdr is packaged by Debian, I figured that API-breaking changes
would be undesirable.
1741e78 to
52c9816
Compare
Contributor
Author
|
Closing since #143 makes this redundant. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This new one avoids the need for memory allocation, streamlines some library internals, and provides a simpler interface for the user:
Old API:
New API:
The old API has been preserved for backwards-compatibility; since libchdr is packaged by Debian, I figured that API-breaking changes would be undesirable.
I also threw-in some miscellaneous changes that I had lying around; they can be removed if you want them submitting separately.