Advertisement
Guest User

Untitled

a guest
Aug 4th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #if FF_API_FAST_MALLOC && CONFIG_SHARED && HAVE_SYMVER
  2. FF_SYMVER(void*, av_fast_realloc, (void *ptr, unsigned int *size, size_t min_size), LIBNAME)
  3. {
  4. return av_fast_realloc(ptr, size, min_size);
  5. }
  6.  
  7. FF_SYMVER(void, av_fast_malloc, (void *ptr, unsigned int *size, size_t min_size), LIBNAME)
  8. {
  9. av_fast_malloc(ptr, size, min_size);
  10. }
  11. #endif
  12.  
  13. static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc)
  14. {
  15. void **p = ptr;
  16. if (min_size < *size)
  17. return 0;
  18. min_size = FFMAX(17 * min_size / 16 + 32, min_size);
  19. av_free(*p);
  20. *p = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size);
  21. if (!*p)
  22. min_size = 0;
  23. *size = min_size;
  24. return 1;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement