You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "wengzhe (via GitHub)" <gi...@apache.org> on 2024/02/29 06:28:44 UTC
Re: [PR] Minor local socket improvement [nuttx]
wengzhe commented on code in PR #11804:
URL: https://github.com/apache/nuttx/pull/11804#discussion_r1507071171
##########
net/local/local_sendmsg.c:
##########
@@ -124,19 +135,11 @@ static int local_sendctl(FAR struct local_conn_s *conn,
}
net_unlock();
-
return count;
fail:
- while (i-- > 0)
- {
- file_close(peer->lc_cfps[--peer->lc_cfpcount]);
- kmm_free(peer->lc_cfps[peer->lc_cfpcount]);
- peer->lc_cfps[peer->lc_cfpcount] = NULL;
- }
-
+ local_freectl(conn, count);
Review Comment:
```suggestion
local_freectl(peer, i);
```
##########
net/local/local_sendmsg.c:
##########
@@ -58,6 +58,18 @@
****************************************************************************/
#ifdef CONFIG_NET_LOCAL_SCM
+static void local_freectl(FAR struct local_conn_s *conn, int count)
+{
+ FAR struct local_conn_s *peer = conn->lc_peer;
+
+ while (count-- > 0)
+ {
+ file_close(peer->lc_cfps[--peer->lc_cfpcount]);
+ kmm_free(peer->lc_cfps[peer->lc_cfpcount]);
+ peer->lc_cfps[peer->lc_cfpcount] = NULL;
+ }
Review Comment:
```suggestion
while (count-- > 0)
{
file_close(conn->lc_cfps[--conn->lc_cfpcount]);
kmm_free(conn->lc_cfps[conn->lc_cfpcount]);
conn->lc_cfps[conn->lc_cfpcount] = NULL;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org