From a6b2ec76d51386dd06ab86d46eabbcf5140fe80d Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sun, 16 Oct 2022 00:36:20 +0800 Subject: [PATCH] move platform depended include into system.h of libelf All of these files either #include directly or #include "libelfP.h" And now "libelfP.h also #include , so the platform depended include can be moved to system.h safely Signed-off-by: Yonggang Luo --- lib/ChangeLog | 10 ++++++++++ lib/system.h | 11 +++++++---- libelf/ChangeLog | 25 +++++++++++++++++++++++++ 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 - 24 files changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 36c3131..e4f00a8 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,13 @@ +2022-10-16 Yonggang Luo + + * system.h: Add sys/mman.h as system dependend header. + * common.h: Remove ar.h, byteswap.h and endian.h. + * elf32_checksum.c: Remove endian.h. + * elf32_getphdr.c: Remove unistd.h and system.h. + * elf32_getshdr.c: Remove unistd.h.h and system.h. + * elf32_updatefile.c: Remove unistd.h, sys/mman.h and system.h. + * elf32_updatenull.c: Remove endian.h and system.h. + 2022-08-05 Mark Wielaard * dynamicsizehash_concurrent.c (resize_helper): Add documentation. diff --git a/lib/system.h b/lib/system.h index d3f42c9..48004df 100644 --- a/lib/system.h +++ b/lib/system.h @@ -35,14 +35,17 @@ #include #include #include -#include -#include -#include -#include #include #include #include +/* System dependend headers */ +#include +#include +#include +#include +#include + #if defined(HAVE_ERROR_H) #include #elif defined(HAVE_ERR_H) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 558d795..1c6c492 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,28 @@ +2022-10-16 Yonggang Luo + + * common.h: Remove ar.h, byteswap.h and endian.h. + * elf32_checksum.c: Remove endian.h. + * elf32_getphdr.c: Remove unistd.h and system.h. + * elf32_getshdr.c: Remove unistd.h.h and system.h. + * elf32_updatefile.c: Remove unistd.h, sys/mman.h and system.h. + * elf32_updatenull.c: Remove endian.h and system.h. + * elf32_xlatetof.c: Remove endian.h. + * elf32_xlatetom.c: Likewise. + * elf_begin.c: Remove unistd.h, sys/mman.h and system.h. + * elf_cntl.c: Remove unistd.h. + * elf_compress.c: Remove system.h and unistd.h. + * elf_end.c: Remove sys.mman.h. + * elf_getarsym.c: Remove byteswap.h, endian.h, unistd.h and + system.h. + * elf_getdata.c: Remove unistd.h and system.h. + * elf_getdata_rawchunk.c: Remove unistd.h and system.h. + * elf_getshdrstrndx.c: Likewise. + * elf_readall.c: Likewise. + * elf_update.c: Remove unistd.h and sys/mman.h. + * gelf_xlate.c: Remove byteswap.h. + * libelfP.h: Add system.h. + * nlist.c: Remove unistd.h. + 2022-08-28 Mark Wielaard * elf_begin.c (__libelf_next_arhdr_wrlock): Add OCT_FIELD macro, diff --git a/libelf/common.h b/libelf/common.h index 3718b3f..4561854 100644 --- a/libelf/common.h +++ b/libelf/common.h @@ -30,9 +30,6 @@ #ifndef _COMMON_H #define _COMMON_H 1 -#include -#include -#include #include #include diff --git a/libelf/elf32_checksum.c b/libelf/elf32_checksum.c index c5f27bb..521668a 100644 --- a/libelf/elf32_checksum.c +++ b/libelf/elf32_checksum.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include #include diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c index 99b4ac0..4bfca24 100644 --- a/libelf/elf32_getphdr.c +++ b/libelf/elf32_getphdr.c @@ -34,10 +34,8 @@ #include #include #include -#include #include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf32_getshdr.c b/libelf/elf32_getshdr.c index 237d912..fc69630 100644 --- a/libelf/elf32_getshdr.c +++ b/libelf/elf32_getshdr.c @@ -34,9 +34,7 @@ #include #include #include -#include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 1ff5890..46afa1f 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -37,10 +37,7 @@ #include #include #include -#include -#include -#include #include "libelfP.h" diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c index d0d4d1e..6c06e5e 100644 --- a/libelf/elf32_updatenull.c +++ b/libelf/elf32_updatenull.c @@ -32,12 +32,10 @@ #endif #include -#include #include #include #include -#include #include "libelfP.h" #include "elf-knowledge.h" diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c index 082d833..377659c 100644 --- a/libelf/elf32_xlatetof.c +++ b/libelf/elf32_xlatetof.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include "libelfP.h" diff --git a/libelf/elf32_xlatetom.c b/libelf/elf32_xlatetom.c index cb0bb8d..fa3dc9a 100644 --- a/libelf/elf32_xlatetom.c +++ b/libelf/elf32_xlatetom.c @@ -32,7 +32,6 @@ #endif #include -#include #include #include "libelfP.h" diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index 71eb359..fe8c640 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -39,11 +39,8 @@ #include #include #include -#include -#include #include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_cntl.c b/libelf/elf_cntl.c index fd68178..04aa913 100644 --- a/libelf/elf_cntl.c +++ b/libelf/elf_cntl.c @@ -31,8 +31,6 @@ # include #endif -#include - #include "libelfP.h" diff --git a/libelf/elf_compress.c b/libelf/elf_compress.c index df0144e..d7f53af 100644 --- a/libelf/elf_compress.c +++ b/libelf/elf_compress.c @@ -31,14 +31,12 @@ #endif #include -#include #include "libelfP.h" #include "common.h" #include #include #include -#include #include /* Cleanup and return result. Don't leak memory. */ diff --git a/libelf/elf_end.c b/libelf/elf_end.c index 160f0b8..5c451f3 100644 --- a/libelf/elf_end.c +++ b/libelf/elf_end.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "libelfP.h" diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c index 05ebf6a..2203521 100644 --- a/libelf/elf_getarsym.c +++ b/libelf/elf_getarsym.c @@ -32,16 +32,12 @@ #endif #include -#include -#include #include #include #include #include #include -#include -#include #include #include "libelfP.h" diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c index a704aae..5ebd270 100644 --- a/libelf/elf_getdata.c +++ b/libelf/elf_getdata.c @@ -35,10 +35,8 @@ #include #include #include -#include #include "libelfP.h" -#include #include "common.h" #include "elf-knowledge.h" diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c index 2f55cbb..5a35ccd 100644 --- a/libelf/elf_getdata_rawchunk.c +++ b/libelf/elf_getdata_rawchunk.c @@ -35,9 +35,7 @@ #include #include #include -#include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_getshdrstrndx.c b/libelf/elf_getshdrstrndx.c index ad884fd..2391317 100644 --- a/libelf/elf_getshdrstrndx.c +++ b/libelf/elf_getshdrstrndx.c @@ -35,9 +35,7 @@ #include #include #include -#include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_readall.c b/libelf/elf_readall.c index 0a3a233..d0f9a28 100644 --- a/libelf/elf_readall.c +++ b/libelf/elf_readall.c @@ -32,10 +32,8 @@ #endif #include -#include #include -#include #include "libelfP.h" #include "common.h" diff --git a/libelf/elf_update.c b/libelf/elf_update.c index 97ca9ca..56af3a1 100644 --- a/libelf/elf_update.c +++ b/libelf/elf_update.c @@ -33,8 +33,6 @@ #include #include -#include -#include #include #include "libelfP.h" diff --git a/libelf/gelf_xlate.c b/libelf/gelf_xlate.c index 6f8c57b..d8ad063 100644 --- a/libelf/gelf_xlate.c +++ b/libelf/gelf_xlate.c @@ -32,7 +32,6 @@ # include #endif -#include #include #include #include diff --git a/libelf/libelfP.h b/libelf/libelfP.h index 56331f4..d88a613 100644 --- a/libelf/libelfP.h +++ b/libelf/libelfP.h @@ -39,6 +39,7 @@ #include #include +#include /* Helper Macros to write 32 bit and 64 bit functions. */ #define __elfw2_(Bits, Name) __elf##Bits##_##Name diff --git a/libelf/nlist.c b/libelf/nlist.c index 8593c1d..b3d6043 100644 --- a/libelf/nlist.c +++ b/libelf/nlist.c @@ -35,7 +35,6 @@ #include #include #include -#include #include "libelfP.h" -- 2.7.4