From ea65f9503c80c33fb236703a7e81747bcb94666b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 9 Oct 2025 19:24:37 -0700 Subject: header file refactoring for IWYU (protocols) This changes the header files mostly in the protocols to include directly rather than through the commmon nng_impl.h header. This should lead to faster compiles, and by properly making all includes relative should reduce friction with language servers and other tooling. --- src/sp/protocol/reqrep0/rep.c | 9 ++++++++- src/sp/protocol/reqrep0/rep_test.c | 3 +-- src/sp/protocol/reqrep0/req.c | 12 ++++++++++-- src/sp/protocol/reqrep0/req_test.c | 3 +-- src/sp/protocol/reqrep0/reqstress_test.c | 4 +--- src/sp/protocol/reqrep0/xrep.c | 12 +++++++++--- src/sp/protocol/reqrep0/xrep_test.c | 3 +-- src/sp/protocol/reqrep0/xreq.c | 10 +++++++--- src/sp/protocol/reqrep0/xreq_test.c | 3 +-- 9 files changed, 39 insertions(+), 20 deletions(-) (limited to 'src/sp/protocol/reqrep0') diff --git a/src/sp/protocol/reqrep0/rep.c b/src/sp/protocol/reqrep0/rep.c index 6df65df3..ea3e9558 100644 --- a/src/sp/protocol/reqrep0/rep.c +++ b/src/sp/protocol/reqrep0/rep.c @@ -10,7 +10,14 @@ #include -#include "core/nng_impl.h" +#include "../../../core/aio.h" +#include "../../../core/defs.h" +#include "../../../core/idhash.h" +#include "../../../core/list.h" +#include "../../../core/message.h" +#include "../../../core/pipe.h" +#include "../../../core/pollable.h" +#include "../../../core/protocol.h" // Response protocol. The REP protocol is the "reply" side of a // request-reply pair. This is useful for building RPC servers, for diff --git a/src/sp/protocol/reqrep0/rep_test.c b/src/sp/protocol/reqrep0/rep_test.c index 7c788d96..a8370880 100644 --- a/src/sp/protocol/reqrep0/rep_test.c +++ b/src/sp/protocol/reqrep0/rep_test.c @@ -7,8 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "nng/nng.h" -#include +#include "../../../testing/nuts.h" #define REP0_SELF 0x31 #define REP0_PEER 0x30 diff --git a/src/sp/protocol/reqrep0/req.c b/src/sp/protocol/reqrep0/req.c index 85c2dfa4..451253bd 100644 --- a/src/sp/protocol/reqrep0/req.c +++ b/src/sp/protocol/reqrep0/req.c @@ -7,9 +7,17 @@ // file was obtained (LICENSE.txt). A copy of the license may also be // found online at https://opensource.org/licenses/MIT. // -#include -#include "core/nng_impl.h" +#include "../../../core/aio.h" +#include "../../../core/defs.h" +#include "../../../core/idhash.h" +#include "../../../core/list.h" +#include "../../../core/message.h" +#include "../../../core/pipe.h" +#include "../../../core/platform.h" +#include "../../../core/pollable.h" +#include "../../../core/protocol.h" +#include "../../../core/socket.h" // Request protocol. The REQ protocol is the "request" side of a // request-reply pair. This is useful for building RPC clients, for example. diff --git a/src/sp/protocol/reqrep0/req_test.c b/src/sp/protocol/reqrep0/req_test.c index 1da63ffc..d77f06d0 100644 --- a/src/sp/protocol/reqrep0/req_test.c +++ b/src/sp/protocol/reqrep0/req_test.c @@ -8,8 +8,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "nng/nng.h" -#include +#include "../../../testing/nuts.h" #define REQ0_SELF 0x30 #define REQ0_PEER 0x31 diff --git a/src/sp/protocol/reqrep0/reqstress_test.c b/src/sp/protocol/reqrep0/reqstress_test.c index 2b2e1980..db0da0d6 100644 --- a/src/sp/protocol/reqrep0/reqstress_test.c +++ b/src/sp/protocol/reqrep0/reqstress_test.c @@ -12,9 +12,7 @@ #include #include -#include "nng/nng.h" - -#include "nuts.h" +#include "../../../testing/nuts.h" #ifdef NDEBUG #define dprintf(...) diff --git a/src/sp/protocol/reqrep0/xrep.c b/src/sp/protocol/reqrep0/xrep.c index fe6c9fde..e0b5fece 100644 --- a/src/sp/protocol/reqrep0/xrep.c +++ b/src/sp/protocol/reqrep0/xrep.c @@ -8,9 +8,15 @@ // found online at https://opensource.org/licenses/MIT. // -#include - -#include "core/nng_impl.h" +#include "../../../core/aio.h" +#include "../../../core/defs.h" +#include "../../../core/idhash.h" +#include "../../../core/message.h" +#include "../../../core/msgqueue.h" +#include "../../../core/pipe.h" +#include "../../../core/platform.h" +#include "../../../core/protocol.h" +#include "../../../core/socket.h" #define REP0_SELF 0x31 #define REP0_PEER 0x30 diff --git a/src/sp/protocol/reqrep0/xrep_test.c b/src/sp/protocol/reqrep0/xrep_test.c index d4e4ce26..ef9b9246 100644 --- a/src/sp/protocol/reqrep0/xrep_test.c +++ b/src/sp/protocol/reqrep0/xrep_test.c @@ -7,8 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "nng/nng.h" -#include +#include "../../../testing/nuts.h" #define REP0_SELF 0x31 #define REP0_PEER 0x30 diff --git a/src/sp/protocol/reqrep0/xreq.c b/src/sp/protocol/reqrep0/xreq.c index f80391dd..8939d8f4 100644 --- a/src/sp/protocol/reqrep0/xreq.c +++ b/src/sp/protocol/reqrep0/xreq.c @@ -8,9 +8,13 @@ // found online at https://opensource.org/licenses/MIT. // -#include - -#include "core/nng_impl.h" +#include "../../../core/aio.h" +#include "../../../core/defs.h" +#include "../../../core/message.h" +#include "../../../core/msgqueue.h" +#include "../../../core/pipe.h" +#include "../../../core/protocol.h" +#include "../../../core/socket.h" #define REQ0_SELF 0x30 #define REQ0_PEER 0x31 diff --git a/src/sp/protocol/reqrep0/xreq_test.c b/src/sp/protocol/reqrep0/xreq_test.c index 7969ff0f..ef06c711 100644 --- a/src/sp/protocol/reqrep0/xreq_test.c +++ b/src/sp/protocol/reqrep0/xreq_test.c @@ -7,8 +7,7 @@ // found online at https://opensource.org/licenses/MIT. // -#include "nng/nng.h" -#include +#include "../../../testing/nuts.h" #define REQ0_SELF 0x30 #define REQ0_PEER 0x31 -- cgit v1.2.3-70-g09d2