Mercurial > SDL_sound_CoreAudio
changeset 491:8e9720b66e55
Patched to compile on more severe compilers.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 14 Sep 2005 20:01:50 +0000 |
parents | c7ab783f05d3 |
children | 355129c687b7 |
files | extra_rwops.c |
diffstat | 1 files changed, 34 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/extra_rwops.c Wed Sep 14 16:01:27 2005 +0000 +++ b/extra_rwops.c Wed Sep 14 20:01:50 2005 +0000 @@ -138,6 +138,40 @@ static SDL_RWops *rwops_pool = NULL; static SDL_mutex *rwops_pool_mutex = NULL; +SDL_RWops *RWops_pooled_alloc(void) +{ + SDL_RWops *rw; + if (rwops_pool_mutex == NULL) + return(NULL); /* never initialized. */ + + SDL_LockMutex(rwops_pool_mutex); + rw = rwops_pool; + if (rw) + rwops_pool = (SDL_RWops *) (rw->hidden.unknown.data1); + SDL_UnlockMutex(rwops_pool_mutex); + + if (!rw) + rw = (SDL_RWops *) malloc(sizeof (SDL_RWops)); + + return(rw); +} /* RWops_pooled_alloc */ + + +void RWops_pooled_free(SDL_RWops *rw) +{ + if (rwops_pool_mutex == NULL) + return; /* never initialized...why are we here? */ + + if (rw == NULL) + return; + + SDL_LockMutex(rwops_pool_mutex); + rw->hidden.unknown.data1 = rwops_pool; + rwops_pool = rw; + SDL_UnlockMutex(rwops_pool_mutex); +} /* RWops_pooled_free */ + + int RWops_pooled_init(void) { const int preallocate = 50; @@ -178,40 +212,6 @@ } /* while */ } /* RWops_pooled_deinit */ - -SDL_RWops *RWops_pooled_alloc(void) -{ - SDL_RWops *rw; - if (rwops_pool_mutex == NULL) - return(NULL); /* never initialized. */ - - SDL_LockMutex(rwops_pool_mutex); - rw = rwops_pool; - if (rw) - rwops_pool = (SDL_RWops *) (rw->hidden.unknown.data1); - SDL_UnlockMutex(rwops_pool_mutex); - - if (!rw) - rw = (SDL_RWops *) malloc(sizeof (SDL_RWops)); - - return(rw); -} /* RWops_pooled_alloc */ - - -void RWops_pooled_free(SDL_RWops *rw) -{ - if (rwops_pool_mutex == NULL) - return; /* never initialized...why are we here? */ - - if (rw == NULL) - return; - - SDL_LockMutex(rwops_pool_mutex); - rw->hidden.unknown.data1 = rwops_pool; - rwops_pool = rw; - SDL_UnlockMutex(rwops_pool_mutex); -} /* RWops_pooled_free */ - /* end of extra_rwops.c ... */