[libav-devel] [PATCH v2 1/1] libavutil: move FFALIGN macro from common.h to macros.h

Janne Grunau janne-libav at jannau.net
Thu Dec 10 22:29:16 CET 2015


Hi,

without comment explaining the reason for the macros.h include in common.h

Janne
--->8---
Include macros.h explicitly in common.h so that external code using
FFALIGN does not break. It was already implicitly included through
version.h. Include macros.h in lls.h and internal.h for FFALIGN.
lls.h was including common.h only for FFALIGN and internal.h was
missing the include for FFALIGN. `make checkheaders` did not catch it
because it's an internal header.
---
 libavutil/common.h   | 2 +-
 libavutil/internal.h | 1 +
 libavutil/lls.h      | 2 +-
 libavutil/macros.h   | 2 ++
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index 56556e7..7a43ccf 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -36,6 +36,7 @@
 #include <string.h>
 
 #include "attributes.h"
+#include "macros.h"
 #include "version.h"
 #include "libavutil/avconfig.h"
 
@@ -59,7 +60,6 @@
 
 #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
 #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
-#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
 
 /* misc math functions */
 
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 4264c4e..b9be333 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -37,6 +37,7 @@
 #include "config.h"
 #include "attributes.h"
 #include "dict.h"
+#include "macros.h"
 #include "pixfmt.h"
 
 #if ARCH_X86
diff --git a/libavutil/lls.h b/libavutil/lls.h
index 9b2b3a4..3977e97 100644
--- a/libavutil/lls.h
+++ b/libavutil/lls.h
@@ -23,7 +23,7 @@
 #ifndef AVUTIL_LLS_H
 #define AVUTIL_LLS_H
 
-#include "common.h"
+#include "macros.h"
 #include "mem.h"
 #include "version.h"
 
diff --git a/libavutil/macros.h b/libavutil/macros.h
index bf3eb9b..3e7b005 100644
--- a/libavutil/macros.h
+++ b/libavutil/macros.h
@@ -45,4 +45,6 @@
 
 #define AV_PRAGMA(s) _Pragma(#s)
 
+#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
+
 #endif /* AVUTIL_MACROS_H */
-- 
2.6.4



More information about the libav-devel mailing list