[v2,2/7] move platform depended include into system.h of libelf
Commit Message
All of these files either #include <system.h> directly or #include "libelfP.h"
And now "libelfP.h also #include <system.h>, so the platform depended include
can be moved to system.h safely
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
lib/system.h | 11 +++++++----
libelf/common.h | 3 ---
libelf/elf32_checksum.c | 1 -
libelf/elf32_getphdr.c | 2 --
libelf/elf32_getshdr.c | 2 --
libelf/elf32_updatefile.c | 3 ---
libelf/elf32_updatenull.c | 2 --
libelf/elf32_xlatetof.c | 1 -
libelf/elf32_xlatetom.c | 1 -
libelf/elf_begin.c | 3 ---
libelf/elf_cntl.c | 2 --
libelf/elf_compress.c | 2 --
libelf/elf_end.c | 1 -
libelf/elf_getarsym.c | 4 ----
libelf/elf_getdata.c | 2 --
libelf/elf_getdata_rawchunk.c | 2 --
libelf/elf_getshdrstrndx.c | 2 --
libelf/elf_readall.c | 2 --
libelf/elf_update.c | 2 --
libelf/gelf_xlate.c | 1 -
libelf/libelfP.h | 1 +
libelf/nlist.c | 1 -
22 files changed, 8 insertions(+), 43 deletions(-)
Comments
On Sun, Oct 16, 2022 at 12:36:20AM +0800, Yonggang Luo via Elfutils-devel wrote:
> All of these files either #include <system.h> directly or #include "libelfP.h"
> And now "libelfP.h also #include <system.h>, so the platform depended include
> can be moved to system.h safely
Thanks. While reviewing wrote ChangeLog entries. Pushed with those added.
Cheers,
Mark
@@ -35,14 +35,17 @@
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
-#include <sys/param.h>
-#include <endian.h>
-#include <byteswap.h>
-#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
+/* System dependend headers */
+#include <byteswap.h>
+#include <endian.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <unistd.h>
+
#if defined(HAVE_ERROR_H)
#include <error.h>
#elif defined(HAVE_ERR_H)
@@ -30,9 +30,6 @@
#ifndef _COMMON_H
#define _COMMON_H 1
-#include <ar.h>
-#include <byteswap.h>
-#include <endian.h>
#include <stdlib.h>
#include <string.h>
@@ -32,7 +32,6 @@
#endif
#include <assert.h>
-#include <endian.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
@@ -34,10 +34,8 @@
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
-#include <unistd.h>
#include <assert.h>
-#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -34,9 +34,7 @@
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
-#include <unistd.h>
-#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -37,10 +37,7 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <system.h>
#include "libelfP.h"
@@ -32,12 +32,10 @@
#endif
#include <assert.h>
-#include <endian.h>
#include <libelf.h>
#include <stdbool.h>
#include <string.h>
-#include <system.h>
#include "libelfP.h"
#include "elf-knowledge.h"
@@ -32,7 +32,6 @@
#endif
#include <assert.h>
-#include <endian.h>
#include <string.h>
#include "libelfP.h"
@@ -32,7 +32,6 @@
#endif
#include <assert.h>
-#include <endian.h>
#include <string.h>
#include "libelfP.h"
@@ -39,11 +39,8 @@
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
#include <sys/stat.h>
-#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -31,8 +31,6 @@
# include <config.h>
#endif
-#include <unistd.h>
-
#include "libelfP.h"
@@ -31,14 +31,12 @@
#endif
#include <libelf.h>
-#include <system.h>
#include "libelfP.h"
#include "common.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <zlib.h>
/* Cleanup and return result. Don't leak memory. */
@@ -34,7 +34,6 @@
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
-#include <sys/mman.h>
#include "libelfP.h"
@@ -32,16 +32,12 @@
#endif
#include <assert.h>
-#include <byteswap.h>
-#include <endian.h>
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-#include <system.h>
#include <dl-hash.h>
#include "libelfP.h"
@@ -35,10 +35,8 @@
#include <errno.h>
#include <stddef.h>
#include <string.h>
-#include <unistd.h>
#include "libelfP.h"
-#include <system.h>
#include "common.h"
#include "elf-knowledge.h"
@@ -35,9 +35,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -35,9 +35,7 @@
#include <errno.h>
#include <gelf.h>
#include <stddef.h>
-#include <unistd.h>
-#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -32,10 +32,8 @@
#endif
#include <errno.h>
-#include <unistd.h>
#include <sys/stat.h>
-#include <system.h>
#include "libelfP.h"
#include "common.h"
@@ -33,8 +33,6 @@
#include <libelf.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
#include <sys/stat.h>
#include "libelfP.h"
@@ -32,7 +32,6 @@
# include <config.h>
#endif
-#include <byteswap.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <string.h>
+#include <system.h>
/* Helper Macros to write 32 bit and 64 bit functions. */
#define __elfw2_(Bits, Name) __elf##Bits##_##Name
@@ -35,7 +35,6 @@
#include <gelf.h>
#include <libelf.h>
#include <nlist.h>
-#include <unistd.h>
#include "libelfP.h"