From cea8f6f323d661b5412d9cc3d1be6d3026f1b213 Mon Sep 17 00:00:00 2001
From: Luca Abeni <lucabe72@email.it>
Date: Wed, 19 Jul 2006 07:28:58 +0000
Subject: [PATCH] Move av_malloc(), av_realloc(), and av_free() from libavcodec
 to libavutil

Originally committed as revision 5784 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/Makefile             | 2 +-
 libavcodec/avcodec.h            | 3 ---
 libavutil/Makefile              | 3 ++-
 libavutil/common.h              | 5 +++++
 {libavcodec => libavutil}/mem.c | 6 +++---
 5 files changed, 11 insertions(+), 8 deletions(-)
 rename {libavcodec => libavutil}/mem.c (97%)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 4e2aea33c06..76d996d1618 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -8,7 +8,7 @@ include ../config.mak
 CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil \
        -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE $(AMR_CFLAGS)
 
-OBJS= bitstream.o utils.o mem.o allcodecs.o \
+OBJS= bitstream.o utils.o allcodecs.o \
       mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
       mjpeg.o resample.o resample2.o dsputil.o \
       motion_est.o imgconvert.o imgresample.o \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b37e31d5aae..1c0d1ea66b3 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2597,10 +2597,7 @@ extern AVBitStreamFilter noise_bsf;
 
 
 /* memory */
-void *av_malloc(unsigned int size);
 void *av_mallocz(unsigned int size);
-void *av_realloc(void *ptr, unsigned int size);
-void av_free(void *ptr);
 char *av_strdup(const char *s);
 void av_freep(void *ptr);
 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
diff --git a/libavutil/Makefile b/libavutil/Makefile
index dfcc6eab9fb..506a9e1809c 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -14,7 +14,8 @@ OBJS= mathematics.o \
       md5.o \
       lls.o \
       adler32.o \
-      log.o
+      log.o \
+      mem.o \
 
 HEADERS = avutil.h common.h mathematics.h integer.h rational.h \
           intfloat_readwrite.h md5.h adler32.h
diff --git a/libavutil/common.h b/libavutil/common.h
index fe7ff571b3b..4a92cd31cc1 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -355,4 +355,9 @@ tend= read_time();\
 #define STOP_TIMER(id) {}
 #endif
 
+/* memory */
+void *av_malloc(unsigned int size);
+void *av_realloc(void *ptr, unsigned int size);
+void av_free(void *ptr);
+
 #endif /* COMMON_H */
diff --git a/libavcodec/mem.c b/libavutil/mem.c
similarity index 97%
rename from libavcodec/mem.c
rename to libavutil/mem.c
index f9be906be70..440328b7f1d 100644
--- a/libavcodec/mem.c
+++ b/libavutil/mem.c
@@ -1,5 +1,5 @@
 /*
- * default memory allocator for libavcodec
+ * default memory allocator for libavutil
  * Copyright (c) 2002 Fabrice Bellard.
  *
  * This library is free software; you can redistribute it and/or
@@ -19,10 +19,10 @@
 
 /**
  * @file mem.c
- * default memory allocator for libavcodec.
+ * default memory allocator for libavutil.
  */
 
-#include "avcodec.h"
+#include "common.h"
 
 /* here we can use OS dependant allocation functions */
 #undef malloc
-- 
GitLab