我应该用它来代替吗?看起来只是更紧凑而已。
https://ffmpeg.org/doxygen/trunk/group__lavu__mem__funcs.html
发布于 2018-01-17 22:29:49
这是最新版本的整个函数,它实际上调用了av_realloc,但首先检查提供的缓冲区是否像文档中所说的足够大,如果足够大,则不执行av_realloc,实际上,除了在这种情况下返回相同的缓冲区之外,它不做任何其他事情。希望这能有所帮助。
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
if (min_size <= *size)
return ptr;
if (min_size > max_alloc_size - 32) {
*size = 0;
return NULL;
}
min_size = FFMIN(max_alloc_size - 32, FFMAX(min_size + min_size / 16 + 32, min_size));
ptr = av_realloc(ptr, min_size);
/* we could set this to the unmodified min_size but this is safer
* if the user lost the ptr and uses NULL now
*/
if (!ptr)
min_size = 0;
*size = min_size;
return ptr;
}https://stackoverflow.com/questions/48297132
复制相似问题