Commits

Alexandru Moșoi committed 6fa4be6

Disables assers in release mode.

Comments (0)

Files changed (1)

 /*
- * To enable DEBUG mode #define DEBUG
  * Environment variables for DEBUG mode:
  *    - TCPPRINTSENT  define to print sent packages
  *    - TCPPRINTRECV  define to print received packges
  */
 
+#if DEBUG != 1
+#define NDEBUG  /* Disables assert in release mode. */
+#endif  /* DEBUG */
+
+
 #include <assert.h>
 #include <errno.h>
 #include <setjmp.h>
         default:
                 LOG_ERROR("g_tcb.tcb_state = %s\n", strstate(g_tcb.tcb_state));
                 assert("tcp_write() in invalid state" && 0);
+                return -1;
         }
 
         assert("NACKed data" && g_tcb.tcb_una_seq_nr == g_tcb.tcb_nxt_seq_nr);
         default:
                 LOG_ERROR("g_tcb.tcb_state = %s\n", strstate(g_tcb.tcb_state));
                 assert("tcp_close() in invalid state" && 0);
+                return -1;
         }
 
         if (setjmp(g_tcb.tcb_jmpenv)) {