[php-src] master: Remove various useless `#include` (#22581)

Weilin Du via GitHub <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Weilin Du (LamentXU123)
Committer: GitHub (web-flow)
Pusher: LamentXU123
Date: 2026-07-04T19:52:47+08:00

Commit: https://github.com/php/php-src/commit/3afe4e3edeaee2d5c7cf7552e783ab9b3f41f75e
Raw diff: https://github.com/php/php-src/commit/3afe4e3edeaee2d5c7cf7552e783ab9b3f41f75e.diff

Remove various useless `#include` (#22581)

This removes leftover win32/param.h / <sys/param.h> includes from files that
do not use any of the macros provided by those headers (MAXPATHLEN,
MAXHOSTNAMELEN, howmany, roundup).

It also removes local Windows O_RDONLY -> _O_RDONLY aliases from files where
O_RDONLY is not used.

Changed paths:
  M  ext/ffi/ffi.c
  M  ext/standard/ftp_fopen_wrapper.c
  M  ext/standard/http_fopen_wrapper.c
  M  main/network.c
  M  main/php_scandir.c
  M  sapi/phpdbg/phpdbg_prompt.c


Diff:

diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index 779b41fcad3d..c3c08327fbe2 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -34,11 +34,9 @@
 
 #ifdef HAVE_LIBDL
 #ifdef PHP_WIN32
-#include "win32/param.h"
 #include "win32/winutil.h"
 #define GET_DL_ERROR()  php_win_err()
 #else
-#include <sys/param.h>
 #define GET_DL_ERROR()  DL_ERROR()
 #endif
 #endif
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 457d1410aabe..dfe905a8c220 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -30,10 +30,6 @@
 
 #ifdef PHP_WIN32
 #include <winsock2.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
 #endif
 
 #include "php_standard.h"
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 195394c7ed8d..4b2aa7116a24 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -33,13 +33,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-
 #include "php_standard.h"
 
 #ifdef HAVE_SYS_SOCKET_H
diff --git a/main/network.c b/main/network.c
index 84a755505b21..b4d3ded15196 100644
--- a/main/network.c
+++ b/main/network.c
@@ -24,10 +24,6 @@
 #ifdef PHP_WIN32
 # include <Ws2tcpip.h>
 # include "win32/winutil.h"
-# define O_RDONLY _O_RDONLY
-# include "win32/param.h"
-#else
-#include <sys/param.h>
 #endif
 
 #include <sys/types.h>
diff --git a/main/php_scandir.c b/main/php_scandir.c
index 848a0cf96168..c180272e5f48 100644
--- a/main/php_scandir.c
+++ b/main/php_scandir.c
@@ -27,7 +27,6 @@
 #ifndef HAVE_SCANDIR
 
 #ifdef PHP_WIN32
-#include "win32/param.h"
 #include "win32/readdir.h"
 #endif
 
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 2da7e4193001..d6249ae068da 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -48,11 +48,9 @@ extern int phpdbg_startup_run;
 
 #ifdef HAVE_LIBDL
 #ifdef PHP_WIN32
-#include "win32/param.h"
 #include "win32/winutil.h"
 #define GET_DL_ERROR()  php_win_err()
 #else
-#include <sys/param.h>
 #define GET_DL_ERROR()  DL_ERROR()
 #endif
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.