Skip to content

Commit e3b2e44

Browse files
committed
fix(sock): make Ns_SockCork take non-const Ns_Sock*; correct mutating API and silence const warnings
- Removed "const" from declaration of sock in prototyes and implementation. Rationale: the function mutates socket state (setsockopt TCP_CORK/UDP_CORK) and updates sockPtr->flags; taking a const pointer was misleading and required unsafe const-drops. The change eliminates -Wdiscarded-qualifiers / -Wcast-qual at call sites and aligns type with side effects. The change improves API clarity: mutators must take non-const,
1 parent b85900e commit e3b2e44

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/ns.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3059,7 +3059,7 @@ Ns_SockSendFileBufs(Ns_Sock *sock, const Ns_FileVec *bufs, int nbufs, unsigned i
30593059
NS_GNUC_NONNULL(1) NS_GNUC_NONNULL(2);
30603060

30613061
NS_EXTERN bool
3062-
Ns_SockCork(const Ns_Sock *sock, bool cork)
3062+
Ns_SockCork(Ns_Sock *sock, bool cork)
30633063
NS_GNUC_NONNULL(1);
30643064

30653065
/*

nsd/sockfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Ns_SockSendFileBufs(Ns_Sock *sock, const Ns_FileVec *bufs, int nbufs, unsigned i
227227
*----------------------------------------------------------------------
228228
*/
229229
bool
230-
Ns_SockCork(const Ns_Sock *sock, bool cork)
230+
Ns_SockCork(Ns_Sock *sock, bool cork)
231231
{
232232
bool success = NS_FALSE;
233233
#if defined(TCP_CORK) || defined(UDP_CORK)

0 commit comments

Comments
 (0)