You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/19 08:36:50 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #5271: net/sockif: explicit the member declaration

pkarashchenko commented on pull request #5271:
URL: https://github.com/apache/incubator-nuttx/pull/5271#issuecomment-1016202732


   > > We need to fix this in the way that is C89 compatible
   > 
   > This PR solves the issue of the definition mismatch, The definition here is incompatible with C89 originally, I think we can make unified changes later.
   
   I do not understand "The definition here is incompatible with C89 originally". Could you please explain more?
   I see that initialization is
   ```
   const struct sock_intf_s g_usrsock_sockif =
   {
     usrsock_sockif_setup,       /* si_setup */
     usrsock_sockif_sockcaps,    /* si_sockcaps */
     usrsock_sockif_addref,      /* si_addref */
     usrsock_bind,               /* si_bind */
     usrsock_getsockname,        /* si_getsockname */
     usrsock_getpeername,        /* si_getpeername */
     usrsock_listen,             /* si_listen */
     usrsock_connect,            /* si_connect */
     usrsock_accept,             /* si_accept */
     usrsock_poll,               /* si_poll */
     usrsock_sendmsg,            /* si_sendmsg */
     usrsock_recvmsg,            /* si_recvmsg */
     usrsock_sockif_close,       /* si_close */
   #ifdef CONFIG_NET_SENDFILE
     NULL,                       /* si_sendfile */
   #endif
     usrsock_ioctl               /* si_ioctl */
   };
   ```
   that is C89 compatible. What is needed is to change it to
   ```
   const struct sock_intf_s g_usrsock_sockif =
   {
     usrsock_sockif_setup,       /* si_setup */
     usrsock_sockif_sockcaps,    /* si_sockcaps */
     usrsock_sockif_addref,      /* si_addref */
     usrsock_bind,               /* si_bind */
     usrsock_getsockname,        /* si_getsockname */
     usrsock_getpeername,        /* si_getpeername */
     usrsock_listen,             /* si_listen */
     usrsock_connect,            /* si_connect */
     usrsock_accept,             /* si_accept */
     usrsock_poll,               /* si_poll */
     usrsock_sendmsg,            /* si_sendmsg */
     usrsock_recvmsg,            /* si_recvmsg */
     usrsock_sockif_close,       /* si_close */
     usrsock_ioctl,              /* si_ioctl */
     NULL,                /* si_socketpair */
   #ifdef CONFIG_NET_SENDFILE
     , NULL                      /* si_sendfile */
   #endif
   };
   ```


-- 
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