Replace an un-necessary goto

This commit is contained in:
Gregory Nutt 2015-01-25 17:53:01 -06:00
parent f756545eb0
commit a25f6cb7fd

View File

@ -83,6 +83,7 @@ int psock_local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
{ {
FAR struct local_conn_s *server; FAR struct local_conn_s *server;
FAR struct local_conn_s *client; FAR struct local_conn_s *client;
int ret;
/* Some sanity checks */ /* Some sanity checks */
@ -96,12 +97,14 @@ int psock_local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
/* Loop as necessary if we have to wait for a connection */
for (;;)
{
/* Are there pending connections. Remove the client from the /* Are there pending connections. Remove the client from the
* head of the waiting list. * head of the waiting list.
*/ */
try_again:
client = (FAR struct local_conn_s *) client = (FAR struct local_conn_s *)
dq_remfirst(&server->u.server.lc_waiters); dq_remfirst(&server->u.server.lc_waiters);
@ -170,9 +173,6 @@ try_again:
*newconn = (FAR void *)client; *newconn = (FAR void *)client;
return OK; return OK;
} }
else
{
int ret;
/* No.. then there should be no pending connections */ /* No.. then there should be no pending connections */
@ -194,8 +194,6 @@ try_again:
{ {
return ret; return ret;
} }
goto try_again;
} }
} }