move platform depended include into system.h of libelf
authorYonggang Luo <luoyonggang@gmail.com>
Sat, 15 Oct 2022 16:36:20 +0000 (00:36 +0800)
committerMark Wielaard <mark@klomp.org>
Sun, 16 Oct 2022 20:34:17 +0000 (22:34 +0200)
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>
24 files changed:
lib/ChangeLog
lib/system.h
libelf/ChangeLog
libelf/common.h
libelf/elf32_checksum.c
libelf/elf32_getphdr.c
libelf/elf32_getshdr.c
libelf/elf32_updatefile.c
libelf/elf32_updatenull.c
libelf/elf32_xlatetof.c
libelf/elf32_xlatetom.c
libelf/elf_begin.c
libelf/elf_cntl.c
libelf/elf_compress.c
libelf/elf_end.c
libelf/elf_getarsym.c
libelf/elf_getdata.c
libelf/elf_getdata_rawchunk.c
libelf/elf_getshdrstrndx.c
libelf/elf_readall.c
libelf/elf_update.c
libelf/gelf_xlate.c
libelf/libelfP.h
libelf/nlist.c

index 36c3131..e4f00a8 100644 (file)
@@ -1,3 +1,13 @@
+2022-10-16  Yonggang Luo  <luoyonggang@gmail.com>
+
+       * 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  <mark@klomp.org>
 
        * dynamicsizehash_concurrent.c (resize_helper): Add documentation.
index d3f42c9..48004df 100644 (file)
 #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)
index 558d795..1c6c492 100644 (file)
@@ -1,3 +1,28 @@
+2022-10-16  Yonggang Luo  <luoyonggang@gmail.com>
+
+       * 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  <mark@klomp.org>
 
        * elf_begin.c (__libelf_next_arhdr_wrlock): Add OCT_FIELD macro,
index 3718b3f..4561854 100644 (file)
@@ -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>
 
index c5f27bb..521668a 100644 (file)
@@ -32,7 +32,6 @@
 #endif
 
 #include <assert.h>
-#include <endian.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include <string.h>
index 99b4ac0..4bfca24 100644 (file)
 #include <errno.h>
 #include <stdbool.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <assert.h>
 
-#include <system.h>
 #include "libelfP.h"
 #include "common.h"
 
index 237d912..fc69630 100644 (file)
@@ -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"
 
index 1ff5890..46afa1f 100644 (file)
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
 
-#include <system.h>
 #include "libelfP.h"
 
 
index d0d4d1e..6c06e5e 100644 (file)
 #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"
 
index 082d833..377659c 100644 (file)
@@ -32,7 +32,6 @@
 #endif
 
 #include <assert.h>
-#include <endian.h>
 #include <string.h>
 
 #include "libelfP.h"
index cb0bb8d..fa3dc9a 100644 (file)
@@ -32,7 +32,6 @@
 #endif
 
 #include <assert.h>
-#include <endian.h>
 #include <string.h>
 
 #include "libelfP.h"
index 71eb359..fe8c640 100644 (file)
 #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"
 
index fd68178..04aa913 100644 (file)
@@ -31,8 +31,6 @@
 # include <config.h>
 #endif
 
-#include <unistd.h>
-
 #include "libelfP.h"
 
 
index df0144e..d7f53af 100644 (file)
 #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.  */
index 160f0b8..5c451f3 100644 (file)
@@ -34,7 +34,6 @@
 #include <assert.h>
 #include <stddef.h>
 #include <stdlib.h>
-#include <sys/mman.h>
 
 #include "libelfP.h"
 
index 05ebf6a..2203521 100644 (file)
 #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"
 
index a704aae..5ebd270 100644 (file)
 #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"
 
index 2f55cbb..5a35ccd 100644 (file)
@@ -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"
 
index ad884fd..2391317 100644 (file)
@@ -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"
 
index 0a3a233..d0f9a28 100644 (file)
 #endif
 
 #include <errno.h>
-#include <unistd.h>
 #include <sys/stat.h>
 
-#include <system.h>
 #include "libelfP.h"
 #include "common.h"
 
index 97ca9ca..56af3a1 100644 (file)
@@ -33,8 +33,6 @@
 
 #include <libelf.h>
 #include <fcntl.h>
-#include <unistd.h>
-#include <sys/mman.h>
 #include <sys/stat.h>
 
 #include "libelfP.h"
index 6f8c57b..d8ad063 100644 (file)
@@ -32,7 +32,6 @@
 # include <config.h>
 #endif
 
-#include <byteswap.h>
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
index 56331f4..d88a613 100644 (file)
@@ -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
index 8593c1d..b3d6043 100644 (file)
@@ -35,7 +35,6 @@
 #include <gelf.h>
 #include <libelf.h>
 #include <nlist.h>
-#include <unistd.h>
 
 #include "libelfP.h"