Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. template<class T> static void safe_aligned_reallocz(T *&ptr, size_t old_size size_t new_size) {
  2.     void *newalloc = av_mallocz(size);
  3.     if (newalloc) {
  4.         memcpy(ptr, newalloc, min(old_size, new_size));
  5.     }
  6.     av_free(ptr);
  7.     ptr = static_cast<T*>(newalloc);
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement