Mercurial > libavcodec.hg
changeset 1901:bc5039adb9af libavcodec
1000l in av_mallocz_static()
less overallocation in av_fast_realloc() for small arrays
author | michael |
---|---|
date | Mon, 22 Mar 2004 11:00:51 +0000 |
parents | 5cde80c5d929 |
children | a5588762c4fa |
files | utils.c |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/utils.c Sun Mar 21 21:58:14 2004 +0000 +++ b/utils.c Mon Mar 22 11:00:51 2004 +0000 @@ -60,7 +60,7 @@ if(min_size < *size) return ptr; - *size= min_size + 10*1024; + *size= 17*min_size/16 + 32; return av_realloc(ptr, *size); } @@ -69,7 +69,6 @@ static unsigned int last_static = 0; static unsigned int allocated_static = 0; static void** array_static = NULL; -static const unsigned int grow_static = 64; // ^2 /** * allocation of static arrays - do not use for normal allocation. @@ -79,7 +78,7 @@ void *ptr = av_mallocz(size); if(ptr){ - array_static =av_fast_realloc(array_static, &allocated_static, last_static+1); + array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1)); array_static[last_static++] = ptr; }