|
Size: 912
Comment: add content from old wiki
|
Size: 1001
Comment: Rewritten
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 6: | 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 16: | Line 15: |
| ||'''area'''||^the SDL_RWops structure to be freed^ ???|| | ||'''area'''||the SDL_RWops structure to be freed|| |
| Line 19: | Line 18: |
| * | |
| Line 21: | Line 19: |
| #include "SDL_rwops.h" void dumb_example() { SDL_RWops *rw=SDL_AllocRW(); if(rw==NULL) return; SDL_FreeRW(rw); } |
/* this would be your RWops implementation's "close" method. */ void close_my_rwops(SDL_RWops *rw) { if(rw != NULL) { /* close any other resources. */ SDL_FreeRW(rw); } } |
| Line 31: | Line 28: |
| * | |
| Line 34: | Line 30: |
| *Only use [[SDL_FreeRW]]() on memory allocated by [[SDL_AllocRW]](). Any extra memory allocated during creation of the RWops is not freed by [[SDL_FreeRW]](); the programmer must be responsible for it. * | 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. |
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 RWops implementation's "close" method. */
void close_my_rwops(SDL_RWops *rw)
{
if(rw != NULL) {
/* close any other resources. */
SDL_FreeRW(rw);
}
}
Remarks
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.
