From 0ec317dca69cb5bbfb6f715d2f5a65114ce82f69 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Tue, 16 Jun 2026 11:01:26 +0800 Subject: [PATCH 1/4] Merge custom_unistd.h into build-pre.h --- CMakeLists.txt | 1 - build-pre.h | 12 +++++++++++- custom_unistd.h | 14 -------------- zio.c | 1 - 4 files changed, 11 insertions(+), 17 deletions(-) delete mode 100644 custom_unistd.h diff --git a/CMakeLists.txt b/CMakeLists.txt index df2a793..13686db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 3.22) project(eb VERSION 1.0.0 LANGUAGES C) set(SOURCES - custom_unistd.h appendix.c appendix.h appsub.c diff --git a/build-pre.h b/build-pre.h index 90d3fc6..462ed68 100644 --- a/build-pre.h +++ b/build-pre.h @@ -40,7 +40,16 @@ #include #include #include -#include "custom_unistd.h" +/* + * Platform abstraction for unistd.h. + * unistd.h maps (roughly) to io.h on Windows. + */ +#if defined( __APPLE__) || defined(__linux__) +#include +#else +#include +#include +#endif #include #if defined( _WIN32 ) @@ -119,3 +128,4 @@ typedef intptr_t ssize_t; #endif #endif /* EB_BUILD_PRE_H */ + diff --git a/custom_unistd.h b/custom_unistd.h deleted file mode 100644 index 221988d..0000000 --- a/custom_unistd.h +++ /dev/null @@ -1,14 +0,0 @@ -/** This file is part of the Mingw32 package. - -unistd.h maps (roughly) to io.h -*/ -#ifndef CUSTOM_UNISTD_H -#define CUSTOM_UNISTD_H - -#if defined( __APPLE__) || defined(__linux__) -#include -#else -#include -#include -#endif -#endif /* _UNISTD_H */ diff --git a/zio.c b/zio.c index e4621ae..a52fda0 100644 --- a/zio.c +++ b/zio.c @@ -27,7 +27,6 @@ */ #include "build-pre.h" -#include "custom_unistd.h" #include #include #include From b03dcc51e91d18b9b80ba8f0c57e07a84ad09101 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 03:06:06 +0000 Subject: [PATCH 2/4] [autofix.ci] apply automated fixes --- build-pre.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build-pre.h b/build-pre.h index 462ed68..16bac18 100644 --- a/build-pre.h +++ b/build-pre.h @@ -44,7 +44,7 @@ * Platform abstraction for unistd.h. * unistd.h maps (roughly) to io.h on Windows. */ -#if defined( __APPLE__) || defined(__linux__) +#if defined(__APPLE__) || defined(__linux__) #include #else #include @@ -128,4 +128,3 @@ typedef intptr_t ssize_t; #endif #endif /* EB_BUILD_PRE_H */ - From 1610f3532b3af9a5bab6d3cfbc7bc3bfd6f11bd1 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Tue, 16 Jun 2026 11:10:32 +0800 Subject: [PATCH 3/4] Optimize conditional compilation: replace __APPLE__/__linux__ checks with unified _WIN32 check - build-pre.h: Change unistd.h/io.h include logic to use _WIN32 check - build-post.h: Change dirent.h/win_dirent.h include logic to use _WIN32 check - filename.c: Remove redundant dirent.h include (now provided by build-post.h), unify condition --- build-post.h | 2 +- build-pre.h | 6 +++--- filename.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build-post.h b/build-post.h index 3f57722..de4f54d 100644 --- a/build-post.h +++ b/build-post.h @@ -33,7 +33,7 @@ extern "C" { #endif #include "defs.h" -#if defined( __APPLE__) || defined(__linux__) +#ifndef _WIN32 #include #else #include "win_dirent.h" diff --git a/build-pre.h b/build-pre.h index 16bac18..07f2e50 100644 --- a/build-pre.h +++ b/build-pre.h @@ -44,11 +44,11 @@ * Platform abstraction for unistd.h. * unistd.h maps (roughly) to io.h on Windows. */ -#if defined(__APPLE__) || defined(__linux__) -#include -#else +#if defined(_WIN32) #include #include +#else +#include #endif #include diff --git a/filename.c b/filename.c index 62ca2f3..db82ff7 100644 --- a/filename.c +++ b/filename.c @@ -33,10 +33,10 @@ #include "build-post.h" -#if defined( __APPLE__) || defined(__linux__) -#include -#else +#ifdef _WIN32 #include "win_dirent.h" +#else +#include #endif From 378d8b333821211a6ea416e8b45174836b250fe6 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 03:13:06 +0000 Subject: [PATCH 4/4] [autofix.ci] apply automated fixes --- build-post.h | 2 +- filename.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build-post.h b/build-post.h index de4f54d..6d6f5e3 100644 --- a/build-post.h +++ b/build-post.h @@ -34,7 +34,7 @@ extern "C" { #include "defs.h" #ifndef _WIN32 - #include +#include #else #include "win_dirent.h" #endif diff --git a/filename.c b/filename.c index db82ff7..89960e3 100644 --- a/filename.c +++ b/filename.c @@ -32,7 +32,6 @@ #include "build-post.h" - #ifdef _WIN32 #include "win_dirent.h" #else