[FFmpeg-devel] [PATCH v2 6/11] avutil/mem: Don't include avutil.h

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Sep 4 17:17:28 EEST 2023


It is not necessary at all. So remove it.
This also breaks an inclusion cycle mem.h->avutil.h->common.h->mem.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/avfft.c                    | 7 ++++---
 libavcodec/avpacket.c                 | 1 +
 libavcodec/dirac_dwt.c                | 1 +
 libavcodec/ffjni.c                    | 1 +
 libavcodec/iirfilter.c                | 4 ++++
 libavcodec/jpegls.c                   | 1 +
 libavcodec/kbdwin.c                   | 2 ++
 libavcodec/mpc.c                      | 2 +-
 libavcodec/ppc/mpegaudiodsp_altivec.c | 2 ++
 libavcodec/tests/h264_levels.c        | 6 +++++-
 libavformat/protocols.c               | 2 ++
 libavutil/dict.c                      | 4 +++-
 libavutil/encryption_info.c           | 2 ++
 libavutil/fifo.c                      | 1 +
 libavutil/file.c                      | 1 +
 libavutil/hash.c                      | 2 ++
 libavutil/hmac.c                      | 1 +
 libavutil/md5.c                       | 2 ++
 libavutil/mem.h                       | 4 +---
 libavutil/murmur3.c                   | 1 +
 libavutil/tests/lzo.c                 | 2 ++
 libavutil/tests/murmur3.c             | 3 +++
 libavutil/tests/pixdesc.c             | 1 +
 libavutil/threadmessage.c             | 3 +++
 libavutil/timestamp.h                 | 2 +-
 libavutil/tx_priv.h                   | 1 +
 libavutil/wchar_filename.h            | 2 ++
 tools/ffeval.c                        | 4 ++++
 tools/zmqsend.c                       | 3 +++
 29 files changed, 58 insertions(+), 10 deletions(-)

diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c
index d07c495022..fb635abfff 100644
--- a/libavcodec/avfft.c
+++ b/libavcodec/avfft.c
@@ -16,13 +16,14 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <stddef.h>
+#include <string.h>
+
 #include "libavutil/attributes.h"
+#include "libavutil/macros.h"
 #include "libavutil/mem.h"
 #include "libavutil/tx.h"
 #include "avfft.h"
-#include "fft.h"
-#include "rdft.h"
-#include "dct.h"
 
 typedef struct AVTXWrapper {
     AVTXContext *ctx;
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 5fef65e97a..9ec1feb068 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -22,6 +22,7 @@
 #include <string.h>
 
 #include "libavutil/avassert.h"
+#include "libavutil/avutil.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/mem.h"
diff --git a/libavcodec/dirac_dwt.c b/libavcodec/dirac_dwt.c
index 4039899cf0..d473f64daa 100644
--- a/libavcodec/dirac_dwt.c
+++ b/libavcodec/dirac_dwt.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
+#include "libavutil/log.h"
 #include "dirac_dwt.h"
 
 #define TEMPLATE_8bit
diff --git a/libavcodec/ffjni.c b/libavcodec/ffjni.c
index 154be9ae99..e3cf24d3e2 100644
--- a/libavcodec/ffjni.c
+++ b/libavcodec/ffjni.c
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 
 #include "libavutil/bprint.h"
+#include "libavutil/error.h"
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
 
diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
index 903d64e8d4..727a370444 100644
--- a/libavcodec/iirfilter.c
+++ b/libavcodec/iirfilter.c
@@ -26,8 +26,12 @@
 
 #include <math.h>
 
+#include "config.h"
+
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
 
 #include "iirfilter.h"
 
diff --git a/libavcodec/jpegls.c b/libavcodec/jpegls.c
index cc598f3c17..7b4bc30e46 100644
--- a/libavcodec/jpegls.c
+++ b/libavcodec/jpegls.c
@@ -28,6 +28,7 @@
 #include <stddef.h>
 #include "libavutil/internal.h"
 #include "libavutil/intmath.h"
+#include "libavutil/log.h"
 #include "jpegls.h"
 
 void ff_jpegls_init_state(JLSState *state)
diff --git a/libavcodec/kbdwin.c b/libavcodec/kbdwin.c
index eacdb46774..ff7a7d614e 100644
--- a/libavcodec/kbdwin.c
+++ b/libavcodec/kbdwin.c
@@ -17,6 +17,8 @@
  */
 
 #include "libavutil/avassert.h"
+#include "libavutil/error.h"
+#include "libavutil/libm.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/attributes.h"
 #include "libavutil/mem.h"
diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c
index 6aa3e80927..46cb967cf1 100644
--- a/libavcodec/mpc.c
+++ b/libavcodec/mpc.c
@@ -27,7 +27,7 @@
  */
 
 #include <string.h>
-#include "libavutil/intmath.h"
+#include "libavutil/common.h"
 #include "mpegaudiodsp.h"
 
 #include "mpc.h"
diff --git a/libavcodec/ppc/mpegaudiodsp_altivec.c b/libavcodec/ppc/mpegaudiodsp_altivec.c
index 6794ed0928..b065203c4e 100644
--- a/libavcodec/ppc/mpegaudiodsp_altivec.c
+++ b/libavcodec/ppc/mpegaudiodsp_altivec.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
diff --git a/libavcodec/tests/h264_levels.c b/libavcodec/tests/h264_levels.c
index 98febcc41b..af3bfe01a6 100644
--- a/libavcodec/tests/h264_levels.c
+++ b/libavcodec/tests/h264_levels.c
@@ -16,7 +16,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/common.h"
+#include <inttypes.h>
+#include <stddef.h>
+
+#include "libavutil/log.h"
+#include "libavutil/macros.h"
 #include "libavcodec/h264_levels.h"
 
 static const struct {
diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index 9491dc7d00..360018b17c 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -16,6 +16,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "libavutil/avstring.h"
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
diff --git a/libavutil/dict.c b/libavutil/dict.c
index f673977a98..7f23d5336a 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -18,13 +18,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+#include <stdio.h>
 #include <string.h>
 
 #include "avassert.h"
 #include "avstring.h"
 #include "dict.h"
 #include "dict_internal.h"
-#include "internal.h"
+#include "error.h"
 #include "mem.h"
 #include "time_internal.h"
 #include "bprint.h"
diff --git a/libavutil/encryption_info.c b/libavutil/encryption_info.c
index 09486c4c85..e4ff015b37 100644
--- a/libavutil/encryption_info.c
+++ b/libavutil/encryption_info.c
@@ -16,6 +16,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <string.h>
+
 #include "encryption_info.h"
 #include "mem.h"
 #include "intreadwrite.h"
diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index 51a5af6f39..9b32f708fc 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -293,6 +293,7 @@ void av_fifo_freep2(AVFifo **f)
 
 
 #if FF_API_FIFO_OLD_API
+#include "internal.h"
 FF_DISABLE_DEPRECATION_WARNINGS
 #define OLD_FIFO_SIZE_MAX (size_t)FFMIN3(INT_MAX, UINT32_MAX, SIZE_MAX)
 
diff --git a/libavutil/file.c b/libavutil/file.c
index 6a2f3aa91c..cc17885bcc 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -17,6 +17,7 @@
  */
 
 #include "config.h"
+#include "error.h"
 #include "file.h"
 #include "file_open.h"
 #include "internal.h"
diff --git a/libavutil/hash.c b/libavutil/hash.c
index 9a49748189..12333982fb 100644
--- a/libavutil/hash.c
+++ b/libavutil/hash.c
@@ -20,6 +20,8 @@
 
 #include <stddef.h>
 #include <stdint.h>
+#include <stdio.h>
+#include <string.h>
 #include "hash.h"
 
 #include "adler32.h"
diff --git a/libavutil/hmac.c b/libavutil/hmac.c
index 7d241fc73e..302d7b04cf 100644
--- a/libavutil/hmac.c
+++ b/libavutil/hmac.c
@@ -23,6 +23,7 @@
 #include <string.h>
 
 #include "attributes.h"
+#include "error.h"
 #include "hmac.h"
 #include "md5.h"
 #include "sha.h"
diff --git a/libavutil/md5.c b/libavutil/md5.c
index 0170d8dd3f..c01820da2d 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -31,9 +31,11 @@
  */
 
 #include <stdint.h>
+#include <string.h>
 
 #include "bswap.h"
 #include "intreadwrite.h"
+#include "macros.h"
 #include "mem.h"
 #include "md5.h"
 
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 62b4ca6e50..ab7648ac57 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -27,12 +27,10 @@
 #ifndef AVUTIL_MEM_H
 #define AVUTIL_MEM_H
 
-#include <limits.h>
+#include <stddef.h>
 #include <stdint.h>
 
 #include "attributes.h"
-#include "avutil.h"
-#include "version.h"
 
 /**
  * @addtogroup lavu_mem
diff --git a/libavutil/murmur3.c b/libavutil/murmur3.c
index f2e2a9ea6c..c88a236a0c 100644
--- a/libavutil/murmur3.c
+++ b/libavutil/murmur3.c
@@ -20,6 +20,7 @@
 
 #include <stddef.h>
 #include <stdint.h>
+#include <string.h>
 #include "mem.h"
 #include "intreadwrite.h"
 #include "murmur3.h"
diff --git a/libavutil/tests/lzo.c b/libavutil/tests/lzo.c
index a5655dbfc5..d7a78a1696 100644
--- a/libavutil/tests/lzo.c
+++ b/libavutil/tests/lzo.c
@@ -19,6 +19,8 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <lzo/lzo1x.h>
 
 #include "libavutil/log.h"
diff --git a/libavutil/tests/murmur3.c b/libavutil/tests/murmur3.c
index b8d6b1feee..7a793dac47 100644
--- a/libavutil/tests/murmur3.c
+++ b/libavutil/tests/murmur3.c
@@ -18,6 +18,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <inttypes.h>
+#include <stdio.h>
+
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem.h"
 #include "libavutil/murmur3.h"
diff --git a/libavutil/tests/pixdesc.c b/libavutil/tests/pixdesc.c
index 34e2bea932..b13aba598b 100644
--- a/libavutil/tests/pixdesc.c
+++ b/libavutil/tests/pixdesc.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/log.h"
 #include "libavutil/pixdesc.c"
 
 int main(void){
diff --git a/libavutil/threadmessage.c b/libavutil/threadmessage.c
index f0e23f28fc..20b3882033 100644
--- a/libavutil/threadmessage.c
+++ b/libavutil/threadmessage.c
@@ -19,6 +19,9 @@
  */
 
 #include <limits.h>
+#include <stddef.h>
+
+#include "error.h"
 #include "fifo.h"
 #include "mem.h"
 #include "threadmessage.h"
diff --git a/libavutil/timestamp.h b/libavutil/timestamp.h
index e082f01b40..9ae64da8a1 100644
--- a/libavutil/timestamp.h
+++ b/libavutil/timestamp.h
@@ -24,7 +24,7 @@
 #ifndef AVUTIL_TIMESTAMP_H
 #define AVUTIL_TIMESTAMP_H
 
-#include "common.h"
+#include "avutil.h"
 
 #if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64)
 #error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS
diff --git a/libavutil/tx_priv.h b/libavutil/tx_priv.h
index d5ff8e1421..d3fcdbf563 100644
--- a/libavutil/tx_priv.h
+++ b/libavutil/tx_priv.h
@@ -22,6 +22,7 @@
 #include "tx.h"
 #include "thread.h"
 #include "mem_internal.h"
+#include "common.h"
 #include "attributes.h"
 
 #ifdef TX_FLOAT
diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
index 4f87e6f88b..868a30b532 100644
--- a/libavutil/wchar_filename.h
+++ b/libavutil/wchar_filename.h
@@ -21,6 +21,8 @@
 
 #ifdef _WIN32
 
+#include <errno.h>
+#include <stddef.h>
 #include <windows.h>
 #include "mem.h"
 
diff --git a/tools/ffeval.c b/tools/ffeval.c
index 944f374727..0a925b390a 100644
--- a/tools/ffeval.c
+++ b/tools/ffeval.c
@@ -19,11 +19,15 @@
  */
 
 #include "config.h"
+#include <stdio.h>
+#include <string.h>
 #if HAVE_UNISTD_H
 #include <unistd.h>             /* getopt */
 #endif
 
+#include "libavutil/error.h"
 #include "libavutil/eval.h"
+#include "libavutil/log.h"
 #include "libavutil/mem.h"
 
 #if !HAVE_GETOPT
diff --git a/tools/zmqsend.c b/tools/zmqsend.c
index f26fa9c1c2..dc5d426cc8 100644
--- a/tools/zmqsend.c
+++ b/tools/zmqsend.c
@@ -20,8 +20,11 @@
 
 #include "config.h"
 
+#include <stdio.h>
+#include <string.h>
 #include <zmq.h>
 
+#include "libavutil/log.h"
 #include "libavutil/mem.h"
 #include "libavutil/bprint.h"
 
-- 
2.34.1



More information about the ffmpeg-devel mailing list