[libav-devel] [PATCH] [RFC] avutil: headers cleanup

Vittorio Giovara vittorio.giovara at gmail.com
Mon Nov 18 18:07:03 CET 2013


---
It has returned! Now only one library at a time, starting from avutil.

I've added a stdint.h in every header file and correctly included libavutil/avconfig.h, remvoing most of the unused headers have been removed.

There could be some more simplification (eg including a single header instead of all avutil.h or common.h) but there are files from libraries like lavc that rely on having avutil.h in previous files. Also by looking at oracle there might be some more includes needed in non-avutil files, so I'm not sure which is the best way: fix other libraries in this patch or leave unused headers and removed them in a second iteration?

The only change from https://wiki.libav.org/HeaderOrdering is that ifdef'd includes look more readable when having some spaces in between; this patch addresses this too.

Cheers,
    Vittorio

 libavutil/adler32.c            |    1 +
 libavutil/adler32.h            |    1 +
 libavutil/aes.c                |    2 +-
 libavutil/atomic.h             |    8 +++++---
 libavutil/audio_fifo.c         |    1 -
 libavutil/audio_fifo.h         |    4 ++--
 libavutil/avassert.h           |    1 +
 libavutil/avstring.c           |    8 ++++----
 libavutil/avstring.h           |    2 ++
 libavutil/avutil.h             |    2 ++
 libavutil/blowfish.c           |    3 +--
 libavutil/bswap.h              |   10 ++++++----
 libavutil/channel_layout.c     |    1 -
 libavutil/colorspace.h         |    4 ++++
 libavutil/common.h             |    2 ++
 libavutil/cpu.c                |   26 +++++++++++++++-----------
 libavutil/cpu.h                |    2 ++
 libavutil/crc.c                |    3 ++-
 libavutil/crc.h                |    3 ++-
 libavutil/des.c                |    7 ++++---
 libavutil/dict.c               |    1 +
 libavutil/dict.h               |    2 ++
 libavutil/error.c              |    2 +-
 libavutil/error.h              |    3 ++-
 libavutil/eval.c               |    4 +---
 libavutil/eval.h               |    2 +-
 libavutil/fifo.c               |    1 +
 libavutil/fifo.h               |    2 +-
 libavutil/file.c               |   22 ++++++++++++++--------
 libavutil/file.h               |    2 --
 libavutil/file_open.c          |   12 +++++++-----
 libavutil/float_dsp.c          |    1 +
 libavutil/float_dsp.h          |    2 ++
 libavutil/frame.c              |    2 +-
 libavutil/frame.h              |    4 +---
 libavutil/imgutils.c           |    2 +-
 libavutil/imgutils.h           |    3 ++-
 libavutil/internal.h           |    6 ++++--
 libavutil/intfloat.h           |    1 +
 libavutil/intfloat_readwrite.c |    3 ++-
 libavutil/intfloat_readwrite.h |    1 +
 libavutil/intmath.h            |    3 ++-
 libavutil/intreadwrite.h       |    2 ++
 libavutil/lfg.c                |    7 ++++---
 libavutil/lfg.h                |    2 ++
 libavutil/libm.h               |    5 ++++-
 libavutil/lls.c                |    4 +++-
 libavutil/lls.h                |    2 ++
 libavutil/log.c                |   13 +++++++------
 libavutil/log.h                |    2 +-
 libavutil/lzo.c                |    1 -
 libavutil/mathematics.c        |    2 +-
 libavutil/mathematics.h        |    2 +-
 libavutil/md5.c                |    1 +
 libavutil/mem.c                |    5 +++--
 libavutil/mem.h                |    2 +-
 libavutil/opt.c                |    4 +---
 libavutil/opt.h                |    6 +++---
 libavutil/parseutils.c         |    3 +--
 libavutil/parseutils.h         |    1 +
 libavutil/pixdesc.c            |    5 ++---
 libavutil/pixdesc.h            |    2 +-
 libavutil/pixfmt.h             |    3 +++
 libavutil/random_seed.c        |   17 ++++++++++-------
 libavutil/random_seed.h        |    1 +
 libavutil/rational.c           |    2 +-
 libavutil/rational.h           |    3 ++-
 libavutil/rc4.c                |    2 +-
 libavutil/samplefmt.c          |    7 +++----
 libavutil/samplefmt.h          |    3 ---
 libavutil/sha.c                |    3 +--
 libavutil/time.c               |    9 ++++++---
 libavutil/timer.h              |   10 +++++-----
 libavutil/tree.c               |    5 +++--
 libavutil/tree.h               |    2 ++
 libavutil/utils.c              |    2 +-
 libavutil/x86/cpu.c            |    1 -
 libavutil/xtea.c               |    4 ++--
 78 files changed, 188 insertions(+), 129 deletions(-)

diff --git a/libavutil/adler32.c b/libavutil/adler32.c
index 7f5afdb..9cd059b 100644
--- a/libavutil/adler32.c
+++ b/libavutil/adler32.c
@@ -22,6 +22,7 @@
  */
 
 #include "config.h"
+
 #include "adler32.h"
 
 #define BASE 65521L /* largest prime smaller than 65536 */
diff --git a/libavutil/adler32.h b/libavutil/adler32.h
index a8ff6f9..02babb3 100644
--- a/libavutil/adler32.h
+++ b/libavutil/adler32.h
@@ -22,6 +22,7 @@
 #define AVUTIL_ADLER32_H
 
 #include <stdint.h>
+
 #include "attributes.h"
 
 /**
diff --git a/libavutil/aes.c b/libavutil/aes.c
index 4656a48..4bb9c43 100644
--- a/libavutil/aes.c
+++ b/libavutil/aes.c
@@ -20,8 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "common.h"
 #include "aes.h"
+#include "common.h"
 #include "intreadwrite.h"
 
 typedef union {
diff --git a/libavutil/atomic.h b/libavutil/atomic.h
index a5c5fe8..14b025f 100644
--- a/libavutil/atomic.h
+++ b/libavutil/atomic.h
@@ -23,12 +23,14 @@
 
 #include "config.h"
 
+#include <stdint.h>
+
 #if HAVE_ATOMICS_GCC
-#include "atomic_gcc.h"
+#   include "atomic_gcc.h"
 #elif HAVE_ATOMICS_WIN32
-#include "atomic_win32.h"
+#   include "atomic_win32.h"
 #elif HAVE_ATOMICS_SUNCC
-#include "atomic_suncc.h"
+#   include "atomic_suncc.h"
 #else
 
 /**
diff --git a/libavutil/audio_fifo.c b/libavutil/audio_fifo.c
index b562537..c7e4577 100644
--- a/libavutil/audio_fifo.c
+++ b/libavutil/audio_fifo.c
@@ -24,7 +24,6 @@
  * Audio FIFO
  */
 
-#include "avutil.h"
 #include "audio_fifo.h"
 #include "common.h"
 #include "fifo.h"
diff --git a/libavutil/audio_fifo.h b/libavutil/audio_fifo.h
index 8c76388..720472c 100644
--- a/libavutil/audio_fifo.h
+++ b/libavutil/audio_fifo.h
@@ -27,8 +27,8 @@
 #ifndef AVUTIL_AUDIO_FIFO_H
 #define AVUTIL_AUDIO_FIFO_H
 
-#include "avutil.h"
-#include "fifo.h"
+#include <stdint.h>
+
 #include "samplefmt.h"
 
 /**
diff --git a/libavutil/avassert.h b/libavutil/avassert.h
index b223d26..2db15df 100644
--- a/libavutil/avassert.h
+++ b/libavutil/avassert.h
@@ -28,6 +28,7 @@
 #define AVUTIL_AVASSERT_H
 
 #include <stdlib.h>
+
 #include "avutil.h"
 #include "log.h"
 
diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 3ea7be0..291014e 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -19,15 +19,15 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
+
 #include <stdarg.h>
-#include <stdint.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <string.h>
 
-#include "config.h"
-#include "common.h"
-#include "mem.h"
 #include "avstring.h"
+#include "mem.h"
 
 int av_strstart(const char *str, const char *pfx, const char **ptr)
 {
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index b7d1098..4422d1a 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -21,7 +21,9 @@
 #ifndef AVUTIL_AVSTRING_H
 #define AVUTIL_AVSTRING_H
 
+#include <stdint.h>
 #include <stddef.h>
+
 #include "attributes.h"
 
 /**
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 6bb5510..b6b55f9 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -21,6 +21,8 @@
 #ifndef AVUTIL_AVUTIL_H
 #define AVUTIL_AVUTIL_H
 
+#include <stdint.h>
+
 /**
  * @file
  * external API header
diff --git a/libavutil/blowfish.c b/libavutil/blowfish.c
index 8437dd6..906f5f3 100644
--- a/libavutil/blowfish.c
+++ b/libavutil/blowfish.c
@@ -21,10 +21,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avutil.h"
+#include "blowfish.h"
 #include "common.h"
 #include "intreadwrite.h"
-#include "blowfish.h"
 
 static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {
     0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
diff --git a/libavutil/bswap.h b/libavutil/bswap.h
index 8a350e1..3e1a03a 100644
--- a/libavutil/bswap.h
+++ b/libavutil/bswap.h
@@ -26,14 +26,16 @@
 #ifndef AVUTIL_BSWAP_H
 #define AVUTIL_BSWAP_H
 
-#include <stdint.h>
-#include "libavutil/avconfig.h"
-#include "attributes.h"
-
 #ifdef HAVE_AV_CONFIG_H
 
 #include "config.h"
 
+#include <stdint.h>
+
+#include "libavutil/avconfig.h"
+
+#include "attributes.h"
+
 #if   ARCH_ARM
 #   include "arm/bswap.h"
 #elif ARCH_AVR32
diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index 79e398e..6fc78a0 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -24,7 +24,6 @@
  */
 
 #include "avstring.h"
-#include "avutil.h"
 #include "channel_layout.h"
 #include "common.h"
 
diff --git a/libavutil/colorspace.h b/libavutil/colorspace.h
index 8757566..4c6981e 100644
--- a/libavutil/colorspace.h
+++ b/libavutil/colorspace.h
@@ -27,6 +27,10 @@
 #ifndef AVUTIL_COLORSPACE_H
 #define AVUTIL_COLORSPACE_H
 
+#include <stdint.h>
+
+#include "attributes.h"
+
 #define SCALEBITS 10
 #define ONE_HALF  (1 << (SCALEBITS - 1))
 #define FIX(x)    ((int) ((x) * (1<<SCALEBITS) + 0.5))
diff --git a/libavutil/common.h b/libavutil/common.h
index caa6b19..24d498c 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -30,12 +30,14 @@
 #include <inttypes.h>
 #include <limits.h>
 #include <math.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "attributes.h"
 #include "version.h"
+
 #include "libavutil/avconfig.h"
 
 #if AV_HAVE_BIGENDIAN
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index c96dfa9..ba14057 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -16,30 +16,34 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "cpu.h"
-#include "cpu_internal.h"
 #include "config.h"
-#include "opt.h"
-#include "common.h"
 
 #if HAVE_SCHED_GETAFFINITY
-#define _GNU_SOURCE
-#include <sched.h>
+#   define _GNU_SOURCE
+#   include <sched.h>
 #endif
+
 #if HAVE_GETPROCESSAFFINITYMASK
-#include <windows.h>
+#   include <windows.h>
 #endif
+
 #if HAVE_SYSCTL
 #if HAVE_SYS_PARAM_H
-#include <sys/param.h>
+#   include <sys/param.h>
 #endif
-#include <sys/types.h>
-#include <sys/sysctl.h>
+#   include <sys/types.h>
+#   include <sys/sysctl.h>
 #endif
+
 #if HAVE_SYSCONF
-#include <unistd.h>
+#    include <unistd.h>
 #endif
 
+#include "common.h"
+#include "cpu.h"
+#include "cpu_internal.h"
+#include "opt.h"
+
 static int cpuflags_mask = -1, checked;
 
 int av_get_cpu_flags(void)
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 29036e3..0a618ea 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -21,6 +21,8 @@
 #ifndef AVUTIL_CPU_H
 #define AVUTIL_CPU_H
 
+#include <stdint.h>
+
 #include "version.h"
 
 #define AV_CPU_FLAG_FORCE    0x80000000 /* force usage of selected flags (OR) */
diff --git a/libavutil/crc.c b/libavutil/crc.c
index 2cdf588..376c6e4 100644
--- a/libavutil/crc.c
+++ b/libavutil/crc.c
@@ -19,8 +19,9 @@
  */
 
 #include "config.h"
-#include "common.h"
+
 #include "bswap.h"
+#include "common.h"
 #include "crc.h"
 
 #if CONFIG_HARDCODED_TABLES
diff --git a/libavutil/crc.h b/libavutil/crc.h
index 0540619..8242485 100644
--- a/libavutil/crc.h
+++ b/libavutil/crc.h
@@ -21,8 +21,9 @@
 #ifndef AVUTIL_CRC_H
 #define AVUTIL_CRC_H
 
-#include <stdint.h>
 #include <stddef.h>
+#include <stdint.h>
+
 #include "attributes.h"
 
 typedef uint32_t AVCRC;
diff --git a/libavutil/des.c b/libavutil/des.c
index ab0fc2f..f9d182b 100644
--- a/libavutil/des.c
+++ b/libavutil/des.c
@@ -18,11 +18,12 @@
  * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include <inttypes.h>
-#include "avutil.h"
+
+#include <stdint.h>
+
 #include "common.h"
-#include "intreadwrite.h"
 #include "des.h"
+#include "intreadwrite.h"
 
 typedef struct AVDES AVDES;
 
diff --git a/libavutil/dict.c b/libavutil/dict.c
index 9ac4831..743c101 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -22,6 +22,7 @@
 
 #include "avstring.h"
 #include "dict.h"
+#include "error.h"
 #include "internal.h"
 #include "mem.h"
 
diff --git a/libavutil/dict.h b/libavutil/dict.h
index ab23f26..c29fc2c 100644
--- a/libavutil/dict.h
+++ b/libavutil/dict.h
@@ -25,6 +25,8 @@
 #ifndef AVUTIL_DICT_H
 #define AVUTIL_DICT_H
 
+#include <stdint.h>
+
 /**
  * @addtogroup lavu_dict AVDictionary
  * @ingroup lavu_data
diff --git a/libavutil/error.c b/libavutil/error.c
index 6803d2d..644774f 100644
--- a/libavutil/error.c
+++ b/libavutil/error.c
@@ -16,9 +16,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avutil.h"
 #include "avstring.h"
 #include "common.h"
+#include "error.h"
 
 int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
 {
diff --git a/libavutil/error.h b/libavutil/error.h
index 3dfd880..6cf6b10 100644
--- a/libavutil/error.h
+++ b/libavutil/error.h
@@ -26,7 +26,8 @@
 
 #include <errno.h>
 #include <stddef.h>
-#include "avutil.h"
+#include <stdint.h>
+
 
 /**
  * @addtogroup lavu_error
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 48f8e66..c286422 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -27,12 +27,10 @@
  */
 
 #include "attributes.h"
-#include "avutil.h"
+#include "avstring.h"
 #include "common.h"
 #include "eval.h"
 #include "log.h"
-#include "mathematics.h"
-#include "avstring.h"
 
 typedef struct Parser {
     const AVClass *class;
diff --git a/libavutil/eval.h b/libavutil/eval.h
index ccb29e7..8ab9c57 100644
--- a/libavutil/eval.h
+++ b/libavutil/eval.h
@@ -26,7 +26,7 @@
 #ifndef AVUTIL_EVAL_H
 #define AVUTIL_EVAL_H
 
-#include "avutil.h"
+#include <stdint.h>
 
 typedef struct AVExpr AVExpr;
 
diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index dffaf54..d540155 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -19,6 +19,7 @@
  * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
 #include "common.h"
 #include "fifo.h"
 
diff --git a/libavutil/fifo.h b/libavutil/fifo.h
index ea30f5d..765f881 100644
--- a/libavutil/fifo.h
+++ b/libavutil/fifo.h
@@ -25,7 +25,7 @@
 #define AVUTIL_FIFO_H
 
 #include <stdint.h>
-#include "avutil.h"
+
 #include "attributes.h"
 
 typedef struct AVFifoBuffer {
diff --git a/libavutil/file.c b/libavutil/file.c
index d2765b8..96cc5c0 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -17,24 +17,30 @@
  */
 
 #include "config.h"
-#include "file.h"
-#include "internal.h"
-#include "log.h"
-#include "mem.h"
+
 #include <fcntl.h>
 #include <sys/stat.h>
+
 #if HAVE_UNISTD_H
-#include <unistd.h>
+#   include <unistd.h>
 #endif
+
 #if HAVE_IO_H
-#include <io.h>
+#   include <io.h>
 #endif
+
 #if HAVE_MMAP
-#include <sys/mman.h>
+#   include <sys/mman.h>
 #elif HAVE_MAPVIEWOFFILE
-#include <windows.h>
+#   include <windows.h>
 #endif
 
+#include "error.h"
+#include "file.h"
+#include "internal.h"
+#include "log.h"
+#include "version.h"
+
 typedef struct {
     const AVClass *class;
     int   log_offset;
diff --git a/libavutil/file.h b/libavutil/file.h
index e3f02a8..c7dffad 100644
--- a/libavutil/file.h
+++ b/libavutil/file.h
@@ -21,8 +21,6 @@
 
 #include <stdint.h>
 
-#include "avutil.h"
-
 /**
  * @file
  * Misc file utilities.
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 765eb60..fc493ac 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -17,18 +17,20 @@
  */
 
 #include "config.h"
-#include "internal.h"
-#include "mem.h"
+
 #include <stdarg.h>
 #include <fcntl.h>
-#include <sys/stat.h>
+
 #if HAVE_UNISTD_H
-#include <unistd.h>
+#   include <unistd.h>
 #endif
+
 #if HAVE_IO_H
-#include <io.h>
+#   include <io.h>
 #endif
 
+#include "internal.h"
+
 #if defined(_WIN32) && !defined(__MINGW32CE__)
 #undef open
 #undef lseek
diff --git a/libavutil/float_dsp.c b/libavutil/float_dsp.c
index 3707e06..7d15d18 100644
--- a/libavutil/float_dsp.c
+++ b/libavutil/float_dsp.c
@@ -17,6 +17,7 @@
  */
 
 #include "config.h"
+
 #include "attributes.h"
 #include "float_dsp.h"
 
diff --git a/libavutil/float_dsp.h b/libavutil/float_dsp.h
index b215dad..d2694bd 100644
--- a/libavutil/float_dsp.h
+++ b/libavutil/float_dsp.h
@@ -21,6 +21,8 @@
 
 #include "config.h"
 
+#include <stdint.h>
+
 typedef struct AVFloatDSPContext {
     /**
      * Calculate the product of two vectors of floats and store the result in
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 99bdd8a..907d93a 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -17,8 +17,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "channel_layout.h"
 #include "buffer.h"
+#include "channel_layout.h"
 #include "common.h"
 #include "dict.h"
 #include "frame.h"
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 449a6b7..4f977f9 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -22,13 +22,11 @@
 
 #include <stdint.h>
 
-#include "libavcodec/version.h"
-
 #include "avutil.h"
 #include "buffer.h"
 #include "dict.h"
 #include "rational.h"
-#include "samplefmt.h"
+#include "version.h"
 
 enum AVFrameSideDataType {
     /**
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index a8b4d2a..ab9cc68 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -23,9 +23,9 @@
 
 #include "common.h"
 #include "imgutils.h"
-#include "internal.h"
 #include "log.h"
 #include "pixdesc.h"
+#include "pixfmt.h"
 
 void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
                                 const AVPixFmtDescriptor *pixdesc)
diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
index 7151013..6be4e6f 100644
--- a/libavutil/imgutils.h
+++ b/libavutil/imgutils.h
@@ -27,7 +27,8 @@
  * @{
  */
 
-#include "avutil.h"
+#include <stdint.h>
+
 #include "pixdesc.h"
 
 /**
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 7b178c2..e049497 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -26,15 +26,17 @@
 #ifndef AVUTIL_INTERNAL_H
 #define AVUTIL_INTERNAL_H
 
+#include "config.h"
+
 #if !defined(DEBUG) && !defined(NDEBUG)
 #    define NDEBUG
 #endif
 
+#include <assert.h>
 #include <limits.h>
 #include <stdint.h>
 #include <stddef.h>
-#include <assert.h>
-#include "config.h"
+
 #include "attributes.h"
 #include "timer.h"
 #include "dict.h"
diff --git a/libavutil/intfloat.h b/libavutil/intfloat.h
index 38d26ad..cce8699 100644
--- a/libavutil/intfloat.h
+++ b/libavutil/intfloat.h
@@ -22,6 +22,7 @@
 #define AVUTIL_INTFLOAT_H
 
 #include <stdint.h>
+
 #include "attributes.h"
 
 union av_intfloat32 {
diff --git a/libavutil/intfloat_readwrite.c b/libavutil/intfloat_readwrite.c
index 6838563..0d48b9e 100644
--- a/libavutil/intfloat_readwrite.c
+++ b/libavutil/intfloat_readwrite.c
@@ -26,8 +26,9 @@
  */
 
 #include <stdint.h>
-#include "mathematics.h"
+
 #include "intfloat_readwrite.h"
+#include "mathematics.h"
 
 double av_int2dbl(int64_t v){
     if((uint64_t)v+v > 0xFFEULL<<52)
diff --git a/libavutil/intfloat_readwrite.h b/libavutil/intfloat_readwrite.h
index f093b92..965d0e8 100644
--- a/libavutil/intfloat_readwrite.h
+++ b/libavutil/intfloat_readwrite.h
@@ -22,6 +22,7 @@
 #define AVUTIL_INTFLOAT_READWRITE_H
 
 #include <stdint.h>
+
 #include "attributes.h"
 
 /* IEEE 80 bits extended float */
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
index a5ee652..e872882 100644
--- a/libavutil/intmath.h
+++ b/libavutil/intmath.h
@@ -21,9 +21,10 @@
 #ifndef AVUTIL_INTMATH_H
 #define AVUTIL_INTMATH_H
 
+#include "config.h"
+
 #include <stdint.h>
 
-#include "config.h"
 #include "attributes.h"
 
 #if ARCH_ARM
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index f77fd60..947e699 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -20,7 +20,9 @@
 #define AVUTIL_INTREADWRITE_H
 
 #include <stdint.h>
+
 #include "libavutil/avconfig.h"
+
 #include "attributes.h"
 #include "bswap.h"
 
diff --git a/libavutil/lfg.c b/libavutil/lfg.c
index 4221e62..465d198 100644
--- a/libavutil/lfg.c
+++ b/libavutil/lfg.c
@@ -19,13 +19,14 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <inttypes.h>
 #include <limits.h>
 #include <math.h>
+#include <stdint.h>
+
+#include "attributes.h"
+#include "intreadwrite.h"
 #include "lfg.h"
 #include "md5.h"
-#include "intreadwrite.h"
-#include "attributes.h"
 
 av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
 {
diff --git a/libavutil/lfg.h b/libavutil/lfg.h
index 5e526c1..56ee66e 100644
--- a/libavutil/lfg.h
+++ b/libavutil/lfg.h
@@ -22,6 +22,8 @@
 #ifndef AVUTIL_LFG_H
 #define AVUTIL_LFG_H
 
+#include <stdint.h>
+
 typedef struct AVLFG {
     unsigned int state[64];
     int index;
diff --git a/libavutil/libm.h b/libavutil/libm.h
index d6c2cf8..26e936c 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -24,8 +24,11 @@
 #ifndef AVUTIL_LIBM_H
 #define AVUTIL_LIBM_H
 
-#include <math.h>
 #include "config.h"
+
+#include <stdint.h>
+#include <math.h>
+
 #include "attributes.h"
 #include "intfloat.h"
 
diff --git a/libavutil/lls.c b/libavutil/lls.c
index f87c2cd..ba2655a 100644
--- a/libavutil/lls.c
+++ b/libavutil/lls.c
@@ -25,12 +25,14 @@
  * linear least squares model
  */
 
+#include "config.h"
+
 #include <math.h>
 #include <string.h>
 
 #include "attributes.h"
-#include "version.h"
 #include "lls.h"
+#include "version.h"
 
 static void update_lls(LLSModel *m, double *var)
 {
diff --git a/libavutil/lls.h b/libavutil/lls.h
index 27c0d5e..1c6239c 100644
--- a/libavutil/lls.h
+++ b/libavutil/lls.h
@@ -23,6 +23,8 @@
 #ifndef AVUTIL_LLS_H
 #define AVUTIL_LLS_H
 
+#include <stdint.h>
+
 #include "common.h"
 #include "mem.h"
 #include "version.h"
diff --git a/libavutil/log.c b/libavutil/log.c
index 7d574f6..75b1aa4 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -26,18 +26,19 @@
 
 #include "config.h"
 
+#include <stdarg.h>
+#include <stdlib.h>
+
 #if HAVE_UNISTD_H
-#include <unistd.h>
+#   include <unistd.h>
 #endif
+
 #if HAVE_IO_H
-#include <io.h>
+#   include <io.h>
 #endif
-#include <stdarg.h>
-#include <stdlib.h>
+
 #include "avstring.h"
-#include "avutil.h"
 #include "common.h"
-#include "internal.h"
 #include "log.h"
 
 static int av_log_level = AV_LOG_INFO;
diff --git a/libavutil/log.h b/libavutil/log.h
index 05d2826..3a0f466 100644
--- a/libavutil/log.h
+++ b/libavutil/log.h
@@ -22,7 +22,7 @@
 #define AVUTIL_LOG_H
 
 #include <stdarg.h>
-#include "avutil.h"
+
 #include "attributes.h"
 
 /**
diff --git a/libavutil/lzo.c b/libavutil/lzo.c
index 5c5ebc8..44357a5 100644
--- a/libavutil/lzo.c
+++ b/libavutil/lzo.c
@@ -21,7 +21,6 @@
 
 #include <string.h>
 
-#include "avutil.h"
 #include "common.h"
 #include "intreadwrite.h"
 #include "lzo.h"
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 137683e..18143bb 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -24,8 +24,8 @@
  */
 
 #include <assert.h>
-#include <stdint.h>
 #include <limits.h>
+#include <stdint.h>
 
 #include "mathematics.h"
 #include "version.h"
diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h
index 043dd0f..2829c19 100644
--- a/libavutil/mathematics.h
+++ b/libavutil/mathematics.h
@@ -23,9 +23,9 @@
 
 #include <stdint.h>
 #include <math.h>
+
 #include "attributes.h"
 #include "rational.h"
-#include "intfloat.h"
 
 #ifndef M_LOG2_10
 #define M_LOG2_10      3.32192809488736234787  /* log_2 10 */
diff --git a/libavutil/md5.c b/libavutil/md5.c
index efb993e..488646b 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -31,6 +31,7 @@
  */
 
 #include <stdint.h>
+
 #include "bswap.h"
 #include "intreadwrite.h"
 #include "md5.h"
diff --git a/libavutil/mem.c b/libavutil/mem.c
index be42342..068c360 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -30,12 +30,13 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
+
 #if HAVE_MALLOC_H
-#include <malloc.h>
+#   include <malloc.h>
 #endif
 
-#include "avutil.h"
 #include "common.h"
+#include "error.h"
 #include "intreadwrite.h"
 #include "mem.h"
 
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 4a5e362..d1233fe 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -28,9 +28,9 @@
 
 #include <limits.h>
 #include <stdint.h>
+#include <stdlib.h>
 
 #include "attributes.h"
-#include "avutil.h"
 
 /**
  * @addtogroup lavu_mem
diff --git a/libavutil/opt.c b/libavutil/opt.c
index ede4a49..bc08b81 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -25,14 +25,12 @@
  * @author Michael Niedermayer <michaelni at gmx.at>
  */
 
-#include "avutil.h"
 #include "avstring.h"
 #include "common.h"
-#include "opt.h"
 #include "eval.h"
 #include "dict.h"
 #include "log.h"
-#include "mathematics.h"
+#include "opt.h"
 
 const AVOption *av_opt_next(void *obj, const AVOption *last)
 {
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 0181379..809ea68 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -27,10 +27,10 @@
  * AVOptions
  */
 
-#include "rational.h"
-#include "avutil.h"
-#include "dict.h"
+#include <stdint.h>
+
 #include "log.h"
+#include "rational.h"
 
 /**
  * @defgroup avoptions AVOptions
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 0e3fd9e..0c519cf 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -24,12 +24,11 @@
 #include <time.h>
 
 #include "avstring.h"
-#include "avutil.h"
 #include "common.h"
 #include "eval.h"
 #include "log.h"
-#include "random_seed.h"
 #include "parseutils.h"
+#include "random_seed.h"
 
 typedef struct {
     const char *abbr;
diff --git a/libavutil/parseutils.h b/libavutil/parseutils.h
index 0844abb..59aa6ae 100644
--- a/libavutil/parseutils.h
+++ b/libavutil/parseutils.h
@@ -19,6 +19,7 @@
 #ifndef AVUTIL_PARSEUTILS_H
 #define AVUTIL_PARSEUTILS_H
 
+#include <stdint.h>
 #include <time.h>
 
 #include "rational.h"
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 37ce173..e5e0314 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -23,11 +23,10 @@
 #include <string.h>
 
 #include "common.h"
-#include "pixfmt.h"
-#include "pixdesc.h"
 #include "internal.h"
 #include "intreadwrite.h"
-#include "version.h"
+#include "pixdesc.h"
+#include "pixfmt.h"
 
 void av_read_image_line(uint16_t *dst,
                         const uint8_t *data[4], const int linesize[4],
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index e5a16f4..48d1c51 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -22,7 +22,7 @@
 #ifndef AVUTIL_PIXDESC_H
 #define AVUTIL_PIXDESC_H
 
-#include <inttypes.h>
+#include <stdint.h>
 
 #include "attributes.h"
 #include "pixfmt.h"
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 0d6e0a3..b99b020 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -27,7 +27,10 @@
  *
  */
 
+#include <stdint.h>
+
 #include "libavutil/avconfig.h"
+
 #include "version.h"
 
 /**
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 4680081..b147404 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -20,19 +20,22 @@
 
 #include "config.h"
 
+#include <fcntl.h>
+#include <math.h>
+#include <time.h>
+
 #if HAVE_UNISTD_H
-#include <unistd.h>
+#   include <unistd.h>
 #endif
+
 #if HAVE_CRYPTGENRANDOM
-#include <windows.h>
-#include <wincrypt.h>
+#   include <windows.h>
+#   include <wincrypt.h>
 #endif
-#include <fcntl.h>
-#include <math.h>
-#include <time.h>
+
 #include "internal.h"
-#include "timer.h"
 #include "random_seed.h"
+#include "timer.h"
 
 static int read_random(uint32_t *dst, const char *file)
 {
diff --git a/libavutil/random_seed.h b/libavutil/random_seed.h
index b1fad13..ec8be73 100644
--- a/libavutil/random_seed.h
+++ b/libavutil/random_seed.h
@@ -22,6 +22,7 @@
 #define AVUTIL_RANDOM_SEED_H
 
 #include <stdint.h>
+
 /**
  * @addtogroup lavu_crypto
  * @{
diff --git a/libavutil/rational.c b/libavutil/rational.c
index 4053936..9d480e3 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -25,9 +25,9 @@
  * @author Michael Niedermayer <michaelni at gmx.at>
  */
 
-#include "avassert.h"
 #include <limits.h>
 
+#include "avassert.h"
 #include "common.h"
 #include "mathematics.h"
 #include "rational.h"
diff --git a/libavutil/rational.h b/libavutil/rational.h
index 5d7dab7..403f1fb 100644
--- a/libavutil/rational.h
+++ b/libavutil/rational.h
@@ -28,8 +28,9 @@
 #ifndef AVUTIL_RATIONAL_H
 #define AVUTIL_RATIONAL_H
 
-#include <stdint.h>
 #include <limits.h>
+#include <stdint.h>
+
 #include "attributes.h"
 
 /**
diff --git a/libavutil/rc4.c b/libavutil/rc4.c
index 3bf710f..1d74856 100644
--- a/libavutil/rc4.c
+++ b/libavutil/rc4.c
@@ -20,7 +20,7 @@
  * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include "avutil.h"
+
 #include "common.h"
 #include "rc4.h"
 
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index 389f726..5a9c673 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -16,13 +16,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "common.h"
-#include "samplefmt.h"
-
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
+#include "common.h"
+#include "samplefmt.h"
+
 typedef struct SampleFmtInfo {
     const char *name;
     int bits;
diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h
index 33cbded..c90b776 100644
--- a/libavutil/samplefmt.h
+++ b/libavutil/samplefmt.h
@@ -21,9 +21,6 @@
 
 #include <stdint.h>
 
-#include "avutil.h"
-#include "attributes.h"
-
 /**
  * Audio Sample Formats
  *
diff --git a/libavutil/sha.c b/libavutil/sha.c
index 2d9b58c..ade20c5 100644
--- a/libavutil/sha.c
+++ b/libavutil/sha.c
@@ -24,11 +24,10 @@
 #include <string.h>
 
 #include "attributes.h"
-#include "avutil.h"
 #include "bswap.h"
-#include "sha.h"
 #include "intreadwrite.h"
 #include "mem.h"
+#include "sha.h"
 
 /** hash context */
 typedef struct AVSHA {
diff --git a/libavutil/time.c b/libavutil/time.c
index 62cd445..8788704 100644
--- a/libavutil/time.c
+++ b/libavutil/time.c
@@ -21,14 +21,17 @@
 #include <stddef.h>
 #include <stdint.h>
 #include <time.h>
+
 #if HAVE_GETTIMEOFDAY
-#include <sys/time.h>
+#   include <sys/time.h>
 #endif
+
 #if HAVE_UNISTD_H
-#include <unistd.h>
+#   include <unistd.h>
 #endif
+
 #if HAVE_WINDOWS_H
-#include <windows.h>
+#   include <windows.h>
 #endif
 
 #include "time.h"
diff --git a/libavutil/timer.h b/libavutil/timer.h
index ea5c891..c721357 100644
--- a/libavutil/timer.h
+++ b/libavutil/timer.h
@@ -18,20 +18,20 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#ifndef AVUTIL_TIMER_H
+#define AVUTIL_TIMER_H
+
 /**
  * @file
  * high precision timer, useful to profile code
  */
 
-#ifndef AVUTIL_TIMER_H
-#define AVUTIL_TIMER_H
+#include "config.h"
 
-#include <stdlib.h>
 #include <stdint.h>
+#include <stdlib.h>
 #include <inttypes.h>
 
-#include "config.h"
-
 #if   ARCH_ARM
 #   include "arm/timer.h"
 #elif ARCH_BFIN
diff --git a/libavutil/tree.c b/libavutil/tree.c
index d48d01a..9c8d534 100644
--- a/libavutil/tree.c
+++ b/libavutil/tree.c
@@ -18,10 +18,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "error.h"
-#include "log.h"
+#include <stdint.h>
+
 #include "mem.h"
 #include "tree.h"
+#include "version.h"
 
 typedef struct AVTreeNode {
     struct AVTreeNode *child[2];
diff --git a/libavutil/tree.h b/libavutil/tree.h
index 424656e..6049794 100644
--- a/libavutil/tree.h
+++ b/libavutil/tree.h
@@ -27,6 +27,8 @@
 #ifndef AVUTIL_TREE_H
 #define AVUTIL_TREE_H
 
+#include <stdint.h>
+
 #include "attributes.h"
 #include "version.h"
 
diff --git a/libavutil/utils.c b/libavutil/utils.c
index 9b18c97..2bb27de 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -17,7 +17,7 @@
  */
 
 #include "config.h"
-#include "avutil.h"
+#include "version.h"
 
 /**
  * @file
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 0e06d5d..6062b69 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -20,7 +20,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include <stdlib.h>
 #include <string.h>
 
 #include "libavutil/x86/asm.h"
diff --git a/libavutil/xtea.c b/libavutil/xtea.c
index d1efebf..fa1aeb8 100644
--- a/libavutil/xtea.c
+++ b/libavutil/xtea.c
@@ -21,8 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "avutil.h"
-#include "common.h"
+#include <string.h>
+
 #include "intreadwrite.h"
 #include "xtea.h"
 
-- 
1.7.9.5



More information about the libav-devel mailing list