启用constVariablePointer检查并修复6处指针const化
.pre-commit-config.yaml: 移除 --suppress=constVariablePointer net_select.c: 5 处 p_sock 改 const net_sock_t *(仅只读使用) net_socket.c: net_getsockname 的 p_sock 改 const(只读字段) docs/代码规范/cppcheck使用说明.md: 同步抑制表与处理记录
This commit is contained in:
@@ -1848,7 +1848,7 @@ int net_getsockname(int sockfd, struct net_sockaddr *addr, int *addrlen) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
net_sock_t *p_sock = &s_net_socks[sockfd];
|
||||
const net_sock_t *p_sock = &s_net_socks[sockfd];
|
||||
if (!p_sock->in_use && p_sock->state == NET_SOCK_STATE_CLOSED) {
|
||||
s_net_errno = NET_ERR_BADF;
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user