Преглед изворни кода

Minor code cleanup api_lib.c

Dirk Ziegelmeier пре 9 година
родитељ
комит
c21763f6cb
1 измењених фајлова са 4 додато и 8 уклоњено
  1. 4 8
      src/api/api_lib.c

+ 4 - 8
src/api/api_lib.c

@@ -390,7 +390,6 @@ netconn_accept(struct netconn *conn, struct netconn **new_conn)
 #if LWIP_TCP
 #if LWIP_TCP
   void *accept_ptr;
   void *accept_ptr;
   struct netconn *newconn;
   struct netconn *newconn;
-  err_t err;
 #if TCP_LISTEN_BACKLOG
 #if TCP_LISTEN_BACKLOG
   API_MSG_VAR_DECLARE(msg);
   API_MSG_VAR_DECLARE(msg);
 #endif /* TCP_LISTEN_BACKLOG */
 #endif /* TCP_LISTEN_BACKLOG */
@@ -399,11 +398,10 @@ netconn_accept(struct netconn *conn, struct netconn **new_conn)
   *new_conn = NULL;
   *new_conn = NULL;
   LWIP_ERROR("netconn_accept: invalid conn",       (conn != NULL),                      return ERR_ARG;);
   LWIP_ERROR("netconn_accept: invalid conn",       (conn != NULL),                      return ERR_ARG;);
 
 
-  err = conn->last_err;
-  if (ERR_IS_FATAL(err)) {
+  if (ERR_IS_FATAL(conn->last_err)) {
     /* don't recv on fatal errors: this might block the application task
     /* don't recv on fatal errors: this might block the application task
        waiting on acceptmbox forever! */
        waiting on acceptmbox forever! */
-    return err;
+    return conn->last_err;
   }
   }
   if (!sys_mbox_valid(&conn->acceptmbox)) {
   if (!sys_mbox_valid(&conn->acceptmbox)) {
     return ERR_CLSD;
     return ERR_CLSD;
@@ -479,7 +477,6 @@ netconn_recv_data(struct netconn *conn, void **new_buf)
 {
 {
   void *buf = NULL;
   void *buf = NULL;
   u16_t len;
   u16_t len;
-  err_t err;
 #if LWIP_TCP
 #if LWIP_TCP
   API_MSG_VAR_DECLARE(msg);
   API_MSG_VAR_DECLARE(msg);
 #if LWIP_MPU_COMPATIBLE
 #if LWIP_MPU_COMPATIBLE
@@ -503,13 +500,12 @@ netconn_recv_data(struct netconn *conn, void **new_buf)
 #endif /* LWIP_TCP */
 #endif /* LWIP_TCP */
   LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;);
   LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;);
 
 
-  err = conn->last_err;
-  if (ERR_IS_FATAL(err)) {
+  if (ERR_IS_FATAL(conn->last_err)) {
     /* don't recv on fatal errors: this might block the application task
     /* don't recv on fatal errors: this might block the application task
        waiting on recvmbox forever! */
        waiting on recvmbox forever! */
     /* @todo: this does not allow us to fetch data that has been put into recvmbox
     /* @todo: this does not allow us to fetch data that has been put into recvmbox
        before the fatal error occurred - is that a problem? */
        before the fatal error occurred - is that a problem? */
-    return err;
+    return conn->last_err;
   }
   }
 #if LWIP_TCP
 #if LWIP_TCP
 #if (LWIP_UDP || LWIP_RAW)
 #if (LWIP_UDP || LWIP_RAW)