From: Amos Jeffries Date: Tue, 20 Jan 2026 06:49:31 +0000 (+0000) Subject: Maintenance: Add missing stub_fde.cc (#2359) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1be073ffa78f3b1c7a64ba68e510cf9e8d95dfb;p=thirdparty%2Fsquid.git Maintenance: Add missing stub_fde.cc (#2359) Also moved `fdNFree()` declaration to `fd.h` (to match its definition location) and polished its stub's return value. --- diff --git a/src/Makefile.am b/src/Makefile.am index e6bb899718..4480764023 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1471,6 +1471,7 @@ nodist_tests_testStore_SOURCES = \ $(TESTSOURCES) \ SquidMath.cc \ SquidMath.h \ + tests/stub_fde.cc \ tests/stub_libtime.cc \ swap_log_op.cc tests_testStore_LDADD= \ @@ -1588,8 +1589,7 @@ tests_testDiskIO_SOURCES = \ fatal.h \ fd.cc \ fd.h \ - fde.cc \ - fde.h \ + tests/stub_fde.cc \ filemap.cc \ tests/stub_fqdncache.cc \ fs_io.cc \ @@ -1902,6 +1902,7 @@ tests_testHttpReply_SOURCES = \ wordlist.h nodist_tests_testHttpReply_SOURCES = \ $(TESTSOURCES) \ + tests/stub_fde.cc \ hier_code.cc \ tests/stub_libtime.cc tests_testHttpReply_LDADD=\ diff --git a/src/fd.h b/src/fd.h index ab15ad07f5..f611a293c5 100644 --- a/src/fd.h +++ b/src/fd.h @@ -22,6 +22,7 @@ void fd_open(int fd, unsigned int type, const char *); void fd_note(int fd, const char *); void fd_bytes(int fd, int len, IoDirection); void fdDumpOpen(void); +int fdNFree(void); int fdUsageHigh(void); void fdAdjustReserved(void); int default_read_method(int, char *, int); diff --git a/src/fde.h b/src/fde.h index a839e9dc6c..38dea7d4b0 100644 --- a/src/fde.h +++ b/src/fde.h @@ -188,8 +188,6 @@ private: #define fd_table fde::Table -int fdNFree(void); - inline int FD_READ_METHOD(int fd, char *buf, int len) { diff --git a/src/stat.cc b/src/stat.cc index 969a7b3751..d713c05045 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -18,6 +18,7 @@ #include "comm/Connection.h" #include "comm/Loops.h" #include "event.h" +#include "fd.h" #include "fde.h" #include "format/Token.h" #include "globals.h" diff --git a/src/store.cc b/src/store.cc index 1331c00f4e..b21075480e 100644 --- a/src/store.cc +++ b/src/store.cc @@ -24,7 +24,7 @@ #endif #include "ETag.h" #include "event.h" -#include "fde.h" +#include "fd.h" #include "globals.h" #include "http.h" #include "HttpReply.h" diff --git a/src/tests/Stub.am b/src/tests/Stub.am index 4702629605..af657f6dfa 100644 --- a/src/tests/Stub.am +++ b/src/tests/Stub.am @@ -49,6 +49,7 @@ STUB_SOURCE = \ tests/stub_external_acl.cc \ tests/stub_fatal.cc \ tests/stub_fd.cc \ + tests/stub_fde.cc \ tests/stub_fqdncache.cc \ tests/stub_helper.cc \ tests/stub_http.cc \ diff --git a/src/tests/stub_fd.cc b/src/tests/stub_fd.cc index 365f66f75f..bced0ca392 100644 --- a/src/tests/stub_fd.cc +++ b/src/tests/stub_fd.cc @@ -17,6 +17,7 @@ void fd_open(int, unsigned int, const char *) STUB void fd_note(int, const char *) STUB void fd_bytes(int, int, IoDirection) STUB void fdDumpOpen() STUB +int fdNFree() STUB_RETVAL(0) int fdUsageHigh() STUB void fdAdjustReserved() STUB int default_read_method(int, char *, int) STUB_RETVAL(0) @@ -32,8 +33,3 @@ const char *fdTypeStr[] = { "MsgHdr", "Unknown" }; - -// XXX: should be in stub_fde.cc -#include "fde.h" -fde *fde::Table = nullptr; -int fdNFree(void) STUB_RETVAL(-1) diff --git a/src/tests/stub_fde.cc b/src/tests/stub_fde.cc new file mode 100644 index 0000000000..545ffae226 --- /dev/null +++ b/src/tests/stub_fde.cc @@ -0,0 +1,23 @@ +/* + * Copyright (C) 1996-2026 The Squid Software Foundation and contributors + * + * Squid software is distributed under GPLv2+ license and includes + * contributions from numerous individuals and organizations. + * Please see the COPYING and CONTRIBUTORS files for details. + */ + +#include "squid.h" + +#define STUB_API "fde.cc" +#include "tests/STUB.h" + +#include "fde.h" +void fde::Init() STUB +void fde::setIo(READ_HANDLER *, WRITE_HANDLER *) STUB +void fde::useDefaultIo() STUB +void fde::useBufferedIo(READ_HANDLER *, WRITE_HANDLER *) STUB +void fde::DumpStats(StoreEntry *) STUB +char const *fde::remoteAddr() const STUB_RETVAL(nullptr) +void fde::dumpStats(StoreEntry &, int) const STUB +bool fde::readPending(int) const STUB_RETVAL(false) +fde* fde::Table = nullptr;