diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-05-30 21:12:33 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-05-30 21:12:33 +0000 |
commit | 09dafaeba101f0a52ce0f4c501ca885ede1105e6 (patch) | |
tree | ebd919a83d203b5a1e4eed99ee1094dad67cb65c /libavcodec/utils.c | |
parent | ceaaf78bb758396657a77811a3c38478843afad0 (diff) | |
download | ffmpeg-09dafaeba101f0a52ce0f4c501ca885ede1105e6.tar.gz |
Move *_static to bitstream.c which is the only file left which needs
them.
Originally committed as revision 13568 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 3fd5eb3319..a245b90fc8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -73,60 +73,6 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) return ptr; } -static unsigned int last_static = 0; -static unsigned int allocated_static = 0; -static void** array_static = NULL; - -void *av_mallocz_static(unsigned int size) -{ - void *ptr = av_mallocz(size); - - if(ptr){ - array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1)); - if(!array_static) - return NULL; - array_static[last_static++] = ptr; - } - - return ptr; -} - -void *ff_realloc_static(void *ptr, unsigned int size) -{ - int i; - if(!ptr) - return av_mallocz_static(size); - /* Look for the old ptr */ - for(i = 0; i < last_static; i++) { - if(array_static[i] == ptr) { - array_static[i] = av_realloc(array_static[i], size); - return array_static[i]; - } - } - return NULL; - -} - -void av_free_static(void) -{ - while(last_static){ - av_freep(&array_static[--last_static]); - } - av_freep(&array_static); -} - -/** - * Call av_free_static automatically before it's too late - */ - -static void do_free(void) __attribute__ ((destructor)); - -static void do_free(void) -{ - av_free_static(); -} - - /* encoder management */ AVCodec *first_avcodec = NULL; |