|
Size: 1364
Comment: Added space in example.
|
← Revision 9 as of 2015-06-20 20:07:06 ⇥
Size: 1392
Comment: Corrected names and added links to SDL_RWops.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 5: | Line 5: |
| Use this function to free an SDL_RWops structure allocated by [[SDL_AllocRW]](). | Use this function to free an [[SDL_RWops]] structure allocated by [[SDL_AllocRW]](). |
| Line 15: | Line 15: |
| ||'''area'''||the SDL_RWops structure to be freed|| | ||'''area'''||the [[SDL_RWops]] structure to be freed|| |
| Line 19: | Line 19: |
| /* this would be your RWops implementation's "close" method. */ | /* this would be your SDL_RWops implementation's "close" method. */ |
| Line 30: | Line 30: |
| Applications do not need to use this function unless they are providing their own RWops implementation. If you just need a RWops to read/write a common data source, you should use the built-in implementations in SDL, like [[SDL_RWFromFile]]() or [[SDL_RWFromMem]](), etc, and call the '''close''' method on those SDL_RWops pointers when you are done with them. | Applications do not need to use this function unless they are providing their own [[SDL_RWops]] implementation. If you just need a SDL_RWops to read/write a common data source, you should use the built-in implementations in SDL, like [[SDL_RWFromFile]]() or [[SDL_RWFromMem]](), etc, and call the '''close''' method on those SDL_RWops pointers when you are done with them. |
| Line 32: | Line 32: |
| Only use [[SDL_FreeRW]]() on pointers returned by [[SDL_AllocRW]](). The pointer is invalid as soon as this function returns. Any extra memory allocated during creation of the RWops is not freed by [[SDL_FreeRW]](); the programmer must be responsible for managing that memory in their '''close''' method. | Only use [[SDL_FreeRW]]() on pointers returned by [[SDL_AllocRW]](). The pointer is invalid as soon as this function returns. Any extra memory allocated during creation of the SDL_RWops is not freed by [[SDL_FreeRW]](); the programmer must be responsible for managing that memory in their '''close''' method. |
SDL_FreeRW
Use this function to free an SDL_RWops structure allocated by SDL_AllocRW().
Syntax
void SDL_FreeRW(SDL_RWops* area)
Function Parameters
area |
the SDL_RWops structure to be freed |
Code Examples
/* this would be your SDL_RWops implementation's "close" method. */
void close_my_rwops(SDL_RWops *rw)
{
if (rw != NULL) {
/* close any other resources. */
SDL_FreeRW(rw);
}
}
Remarks
Applications do not need to use this function unless they are providing their own SDL_RWops implementation. If you just need a SDL_RWops to read/write a common data source, you should use the built-in implementations in SDL, like SDL_RWFromFile() or SDL_RWFromMem(), etc, and call the close method on those SDL_RWops pointers when you are done with them.
Only use SDL_FreeRW() on pointers returned by SDL_AllocRW(). The pointer is invalid as soon as this function returns. Any extra memory allocated during creation of the SDL_RWops is not freed by SDL_FreeRW(); the programmer must be responsible for managing that memory in their close method.
