diff --git a/contrib/apps/chargen/chargen.c b/contrib/apps/chargen/chargen.c
index 47408eef..94a70b90 100644
--- a/contrib/apps/chargen/chargen.c
+++ b/contrib/apps/chargen/chargen.c
@@ -73,7 +73,7 @@ struct charcb {
   char nextchar;
 };
 
-static struct charcb *charcb_list = 0;
+static struct charcb *charcb_list = NULL;
 
 /**************************************************************
  * void close_chargen(struct charcb *p_charcb)
@@ -190,7 +190,7 @@ chargen_thread(void *arg)
     }
 
     /* Wait for data or a new connection */
-    i = lwip_select(maxfdp1, &readset, &writeset, 0, 0);
+    i = lwip_select(maxfdp1, &readset, &writeset, NULL, NULL);
 
     if (i == 0) {
       continue;
@@ -268,7 +268,7 @@ chargen_thread(void *arg)
 void
 chargen_init(void)
 {
-  sys_thread_new(CHARGEN_THREAD_NAME, chargen_thread, 0, CHARGEN_THREAD_STACKSIZE, CHARGEN_PRIORITY);
+  sys_thread_new(CHARGEN_THREAD_NAME, chargen_thread, NULL, CHARGEN_THREAD_STACKSIZE, CHARGEN_PRIORITY);
 }
 
 #endif /* LWIP_SOCKET && LWIP_SOCKET_SELECT */
diff --git a/contrib/apps/shell/shell.c b/contrib/apps/shell/shell.c
index 5ecbda0e..f4f668d7 100644
--- a/contrib/apps/shell/shell.c
+++ b/contrib/apps/shell/shell.c
@@ -160,7 +160,7 @@ static struct stats_proto* shell_stat_proto_stats[] = {
   &lwip_stats.tcp,
 #endif
 };
-const size_t num_protostats = sizeof(shell_stat_proto_stats)/sizeof(struct stats_proto*);
+static const size_t num_protostats = sizeof(shell_stat_proto_stats)/sizeof(struct stats_proto*);
 
 static const char *stat_msgs_proto[] = {
   " * transmitted ",
diff --git a/contrib/apps/socket_examples/socket_examples.c b/contrib/apps/socket_examples/socket_examples.c
index e7af5ee3..a60156f0 100644
--- a/contrib/apps/socket_examples/socket_examples.c
+++ b/contrib/apps/socket_examples/socket_examples.c
@@ -31,7 +31,7 @@
 #define SOCKET_EXAMPLES_RUN_PARALLEL 0
 #endif
 
-const u8_t cmpbuf[8] = {0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab};
+static const u8_t cmpbuf[8] = {0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab};
 
 /* a helper struct to ensure memory before/after fd_set is not touched */
 typedef struct _xx
diff --git a/contrib/examples/example_app/lwipcfg.h.example b/contrib/examples/example_app/lwipcfg.h.example
index a7517130..0fc5e859 100644
--- a/contrib/examples/example_app/lwipcfg.h.example
+++ b/contrib/examples/example_app/lwipcfg.h.example
@@ -70,8 +70,5 @@
 #define LWIP_UDPECHO_APP              0
 #define LWIP_LWIPERF_APP              0
 
-/*#define USE_DHCP    1*/
-/*#define USE_AUTOIP  1*/
-
 /* define this to your custom application-init function */
 /* #define LWIP_APP_INIT my_app_init() */
diff --git a/contrib/examples/example_app/test.c b/contrib/examples/example_app/test.c
index fc168443..9e6114fa 100644
--- a/contrib/examples/example_app/test.c
+++ b/contrib/examples/example_app/test.c
@@ -153,11 +153,11 @@
 #if USE_ETHERNET
 #if LWIP_DHCP
 /* dhcp struct for the ethernet netif */
-struct dhcp netif_dhcp;
+static struct dhcp netif_dhcp;
 #endif /* LWIP_DHCP */
 #if LWIP_AUTOIP
 /* autoip struct for the ethernet netif */
-struct autoip netif_autoip;
+static struct autoip netif_autoip;
 #endif /* LWIP_AUTOIP */
 #endif /* USE_ETHERNET */
 #if USE_PPP
@@ -490,8 +490,8 @@ dns_dorequest(void *arg)
   ip_addr_t dnsresp;
   LWIP_UNUSED_ARG(arg);
 
-  if (dns_gethostbyname(dnsname, &dnsresp, dns_found, 0) == ERR_OK) {
-    dns_found(dnsname, &dnsresp, 0);
+  if (dns_gethostbyname(dnsname, &dnsresp, dns_found, NULL) == ERR_OK) {
+    dns_found(dnsname, &dnsresp, NULL);
   }
 }
 #endif /* LWIP_DNS_APP && LWIP_DNS */
@@ -610,7 +610,7 @@ test_init(void * arg)
 #endif /* NO_SYS */
 
   /* init randomizer again (seed per thread) */
-  srand((unsigned int)time(0));
+  srand((unsigned int)time(NULL));
 
   /* init network interfaces */
   test_netif_init();
diff --git a/contrib/ports/unix/check/README b/contrib/ports/unix/check/README
index 3d678663..8b326724 100644
--- a/contrib/ports/unix/check/README
+++ b/contrib/ports/unix/check/README
@@ -1,7 +1,7 @@
 
 Helper files to run lwIP unit tests on unix-like systems.
 
-1. Install the check library, through a package manager or from http://check.sourceforge.net/
+1. Install the check library, through a package manager or from https://libcheck.github.io/check/
 2. Put the lwip code in a directory called 'lwip'
 3. Run `make check`
 4. Make sure all tests pass
diff --git a/contrib/ports/unix/lib/lwipopts.h b/contrib/ports/unix/lib/lwipopts.h
index 231fc779..c278bef4 100644
--- a/contrib/ports/unix/lib/lwipopts.h
+++ b/contrib/ports/unix/lib/lwipopts.h
@@ -72,8 +72,8 @@
 
 /**
  * MEM_ALIGNMENT: should be set to the alignment of the CPU
- *    4 byte alignment -> #define MEM_ALIGNMENT 4
- *    2 byte alignment -> #define MEM_ALIGNMENT 2
+ *    4 byte alignment -> #define MEM_ALIGNMENT 4U
+ *    2 byte alignment -> #define MEM_ALIGNMENT 2U
  */
 #define MEM_ALIGNMENT                   1U
 
@@ -238,8 +238,8 @@
 /**
  * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP
  * fragmentation. Otherwise pbufs are allocated and reference the original
-    * packet data to be fragmented.
-*/
+ * packet data to be fragmented.
+ */
 #define IP_FRAG_USES_STATIC_BUF         0
 
 /**
@@ -359,7 +359,7 @@
  * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is
  * designed to accommodate single full size TCP frame in one pbuf, including
  * TCP_MSS, IP header, and link header.
-*
+ *
  */
 #define PBUF_POOL_BUFSIZE               LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
 
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index b06f5f2f..69bec3d3 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -106,9 +106,9 @@ lwip_netconn_is_deallocated_msg(void *msg)
 #endif /* LWIP_NETCONN_FULLDUPLEX */
 
 #if LWIP_TCP
-const u8_t netconn_aborted = 0;
-const u8_t netconn_reset = 0;
-const u8_t netconn_closed = 0;
+static const u8_t netconn_aborted = 0;
+static const u8_t netconn_reset = 0;
+static const u8_t netconn_closed = 0;
 
 /** Translate an error to a unique void* passed via an mbox */
 static void *
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 8d5d1311..929cd652 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2115,7 +2115,7 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
           set_errno(EBADF);
         } else if (!nready) {
           /* Still none ready, just wait to be woken */
-          if (timeout == 0) {
+          if (timeout == NULL) {
             /* Wait forever */
             msectimeout = 0;
           } else {
diff --git a/src/apps/http/fsdata.c b/src/apps/http/fsdata.c
index 50bc87ac..5f01e653 100644
--- a/src/apps/http/fsdata.c
+++ b/src/apps/http/fsdata.c
@@ -308,7 +308,7 @@ static const unsigned char FSDATA_ALIGN_PRE data__index_html[] FSDATA_ALIGN_POST
 
 
 
-const struct fsdata_file file__img_sics_gif[] = { {
+static const struct fsdata_file file__img_sics_gif[] = { {
 file_NULL,
 data__img_sics_gif,
 data__img_sics_gif + 16,
@@ -316,7 +316,7 @@ sizeof(data__img_sics_gif) - 16,
 FS_FILE_FLAGS_HEADER_INCLUDED | FS_FILE_FLAGS_HEADER_PERSISTENT,
 }};
 
-const struct fsdata_file file__404_html[] = { {
+static const struct fsdata_file file__404_html[] = { {
 file__img_sics_gif,
 data__404_html,
 data__404_html + 12,
@@ -324,7 +324,7 @@ sizeof(data__404_html) - 12,
 FS_FILE_FLAGS_HEADER_INCLUDED | FS_FILE_FLAGS_HEADER_PERSISTENT,
 }};
 
-const struct fsdata_file file__index_html[] = { {
+static const struct fsdata_file file__index_html[] = { {
 file__404_html,
 data__index_html,
 data__index_html + 12,
diff --git a/src/apps/http/httpd.c b/src/apps/http/httpd.c
index 66c7723b..bcf4b25f 100644
--- a/src/apps/http/httpd.c
+++ b/src/apps/http/httpd.c
@@ -2079,7 +2079,7 @@ http_parse_request(struct pbuf *inp, struct http_state *hs, struct altcp_pcb *pc
       }
 #endif /* LWIP_HTTPD_SUPPORT_V09 */
       uri_len = (u16_t)(sp2 - (sp1 + 1));
-      if ((sp2 != 0) && (sp2 > sp1)) {
+      if ((sp2 != NULL) && (sp2 > sp1)) {
         /* wait for CRLFCRLF (indicating end of HTTP headers) before parsing anything */
         if (lwip_strnstr(data, CRLF CRLF, data_len) != NULL) {
           char *uri = sp1 + 1;
diff --git a/src/apps/http/makefsdata/makefsdata.c b/src/apps/http/makefsdata/makefsdata.c
index 707d06f4..240c72e4 100644
--- a/src/apps/http/makefsdata/makefsdata.c
+++ b/src/apps/http/makefsdata/makefsdata.c
@@ -108,8 +108,8 @@ static int deflate_level; /* default compression level, can be changed via comma
 #include "../core/def.c"
 
 /** (Your server name here) */
-const char *serverID = "Server: "HTTPD_SERVER_AGENT"\r\n";
-char serverIDBuffer[1024];
+static const char *serverID = "Server: "HTTPD_SERVER_AGENT"\r\n";
+static char serverIDBuffer[1024];
 
 /* change this to suit your MEM_ALIGNMENT */
 #define PAYLOAD_ALIGNMENT 4
@@ -144,26 +144,26 @@ static int file_can_be_compressed(const char* filename);
 /* 5 bytes per char + 3 bytes per line */
 static char file_buffer_c[COPY_BUFSIZE * 5 + ((COPY_BUFSIZE / HEX_BYTES_PER_LINE) * 3)];
 
-char curSubdir[MAX_PATH_LEN-3];
-char lastFileVar[MAX_PATH_LEN];
-char hdr_buf[4096];
+static char curSubdir[MAX_PATH_LEN-3];
+static char lastFileVar[MAX_PATH_LEN];
+static char hdr_buf[4096];
 
-unsigned char processSubs = 1;
-unsigned char includeHttpHeader = 1;
-unsigned char useHttp11 = 0;
-unsigned char supportSsi = 1;
-unsigned char precalcChksum = 0;
-unsigned char includeLastModified = 0;
+static unsigned char processSubs = 1;
+static unsigned char includeHttpHeader = 1;
+static unsigned char useHttp11 = 0;
+static unsigned char supportSsi = 1;
+static unsigned char precalcChksum = 0;
+static unsigned char includeLastModified = 0;
 #if MAKEFS_SUPPORT_DEFLATE
-unsigned char deflateNonSsiFiles = 0;
-size_t deflatedBytesReduced = 0;
-size_t overallDataBytes = 0;
+static unsigned char deflateNonSsiFiles = 0;
+static size_t deflatedBytesReduced = 0;
+static size_t overallDataBytes = 0;
 #endif
-const char *exclude_list = NULL;
-const char *ncompress_list = NULL;
+static const char *exclude_list = NULL;
+static const char *ncompress_list = NULL;
 
-struct file_entry *first_file = NULL;
-struct file_entry *last_file = NULL;
+static struct file_entry *first_file = NULL;
+static struct file_entry *last_file = NULL;
 
 static char *ssi_file_buffer;
 static char **ssi_file_lines;
diff --git a/src/apps/mqtt/mqtt.c b/src/apps/mqtt/mqtt.c
index 0da1a405..feb16e4e 100644
--- a/src/apps/mqtt/mqtt.c
+++ b/src/apps/mqtt/mqtt.c
@@ -695,7 +695,7 @@ mqtt_message_received(mqtt_client_t *client, u8_t fixed_hdr_len, u16_t length, u
         client->cyclic_tick = 0;
         client->conn_state = MQTT_CONNECTED;
         /* Notify upper layer */
-        if (client->connect_cb != 0) {
+        if (client->connect_cb != NULL) {
           client->connect_cb(client, client->connect_arg, res);
         }
       }
@@ -1020,7 +1020,7 @@ mqtt_tcp_err_cb(void *arg, err_t err)
   LWIP_DEBUGF(MQTT_DEBUG_TRACE, ("mqtt_tcp_err_cb: TCP error callback: error %d, arg: %p\n", err, arg));
   LWIP_ASSERT("mqtt_tcp_err_cb: client != NULL", client != NULL);
   /* Set conn to null before calling close as pcb is already deallocated*/
-  client->conn = 0;
+  client->conn = NULL;
   mqtt_close(client, MQTT_CONNECT_DISCONNECTED);
 }
 
diff --git a/src/core/dns.c b/src/core/dns.c
index f83ea9b4..e84bab24 100644
--- a/src/core/dns.c
+++ b/src/core/dns.c
@@ -1421,7 +1421,7 @@ dns_enqueue(const char *name, size_t hostnamelen, dns_found_callback found,
 #endif /* LWIP_IPV4 && LWIP_IPV6 */
       /* this is a duplicate entry, find a free request entry */
       for (r = 0; r < DNS_MAX_REQUESTS; r++) {
-        if (dns_requests[r].found == 0) {
+        if (dns_requests[r].found == NULL) {
           dns_requests[r].found = found;
           dns_requests[r].arg = callback_arg;
           dns_requests[r].dns_table_idx = i;
diff --git a/src/core/ipv4/dhcp.c b/src/core/ipv4/dhcp.c
index 4b3c479d..ba3ef355 100644
--- a/src/core/ipv4/dhcp.c
+++ b/src/core/ipv4/dhcp.c
@@ -160,11 +160,11 @@ enum dhcp_option_idx {
 
 /** Holds the decoded option values, only valid while in dhcp_recv.
     @todo: move this into struct dhcp? */
-u32_t dhcp_rx_options_val[DHCP_OPTION_IDX_MAX];
+static u32_t dhcp_rx_options_val[DHCP_OPTION_IDX_MAX];
 /** Holds a flag which option was received and is contained in dhcp_rx_options_val,
     only valid while in dhcp_recv.
     @todo: move this into struct dhcp? */
-u8_t  dhcp_rx_options_given[DHCP_OPTION_IDX_MAX];
+static u8_t  dhcp_rx_options_given[DHCP_OPTION_IDX_MAX];
 
 static u8_t dhcp_discover_request_options[] = {
   DHCP_OPTION_SUBNET_MASK,
diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c
index 2717cf7f..3092dc94 100644
--- a/src/core/ipv4/etharp.c
+++ b/src/core/ipv4/etharp.c
@@ -1015,7 +1015,7 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
      * new PBUF_RAM. See the definition of PBUF_NEEDS_COPY for details. */
     p = q;
     while (p) {
-      LWIP_ASSERT("no packet queues allowed!", (p->len != p->tot_len) || (p->next == 0));
+      LWIP_ASSERT("no packet queues allowed!", (p->len != p->tot_len) || (p->next == NULL));
       if (PBUF_NEEDS_COPY(p)) {
         copy_needed = 1;
         break;
@@ -1039,7 +1039,7 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
       new_entry = (struct etharp_q_entry *)memp_malloc(MEMP_ARP_QUEUE);
       if (new_entry != NULL) {
         unsigned int qlen = 0;
-        new_entry->next = 0;
+        new_entry->next = NULL;
         new_entry->p = p;
         if (arp_table[i].q != NULL) {
           /* queue was already existent, append the new entry to the end */
diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c
index d4673ca6..3b13c21e 100644
--- a/src/core/ipv6/nd6.c
+++ b/src/core/ipv6/nd6.c
@@ -96,7 +96,7 @@ u32_t reachable_time = LWIP_ND6_REACHABLE_TIME;
 u32_t retrans_timer = LWIP_ND6_RETRANS_TIMER; /* @todo implement this value in timer */
 
 #if LWIP_ND6_QUEUEING
-u8_t nd6_queue_size = 0;
+static u8_t nd6_queue_size = 0;
 #endif
 
 /* Index for cache entries. */
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index e6027261..4da1bd5c 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -680,7 +680,7 @@ pbuf_free_header(struct pbuf *q, u16_t size)
       struct pbuf *f = p;
       free_left = (u16_t)(free_left - p->len);
       p = p->next;
-      f->next = 0;
+      f->next = NULL;
       pbuf_free(f);
     } else {
       pbuf_remove_header(p, free_left);
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 5b4f4e5e..24b21be7 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -275,8 +275,9 @@ tcp_listen_closed(struct tcp_pcb *pcb)
   for (i = 1; i < LWIP_ARRAYSIZE(tcp_pcb_lists); i++) {
     tcp_remove_listener(*tcp_pcb_lists[i], (struct tcp_pcb_listen *)pcb);
   }
-#endif
+#else
   LWIP_UNUSED_ARG(pcb);
+#endif
 }
 
 #if TCP_LISTEN_BACKLOG
diff --git a/src/include/lwip/arch.h b/src/include/lwip/arch.h
index 596c1c9e..324a0891 100644
--- a/src/include/lwip/arch.h
+++ b/src/include/lwip/arch.h
@@ -37,6 +37,12 @@
 #ifndef LWIP_HDR_ARCH_H
 #define LWIP_HDR_ARCH_H
 
+#if defined __linux__
+
+#include <endian.h>
+
+#else
+
 #ifndef LITTLE_ENDIAN
 #define LITTLE_ENDIAN 1234
 #endif
@@ -45,6 +51,16 @@
 #define BIG_ENDIAN 4321
 #endif
 
+/** Define the byte order of the system.
+ * Needed for conversion of network data to host byte order.
+ * Allowed values: LITTLE_ENDIAN and BIG_ENDIAN
+ */
+#ifndef BYTE_ORDER
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+
+#endif
+
 #include "arch/cc.h"
 
 /**
@@ -59,14 +75,6 @@
  * @{
  */
 
-/** Define the byte order of the system.
- * Needed for conversion of network data to host byte order.
- * Allowed values: LITTLE_ENDIAN and BIG_ENDIAN
- */
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
 /** Define random number generator function of your system */
 #ifdef __DOXYGEN__
 #define LWIP_RAND() ((u32_t)rand())
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index 5a4fc88b..964aa2ae 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -254,8 +254,8 @@ struct pbuf_custom {
 #ifndef PBUF_POOL_FREE_OOSEQ
 #define PBUF_POOL_FREE_OOSEQ 1
 #endif /* PBUF_POOL_FREE_OOSEQ */
-#if LWIP_TCP && TCP_QUEUE_OOSEQ && NO_SYS && PBUF_POOL_FREE_OOSEQ
 extern volatile u8_t pbuf_free_ooseq_pending;
+#if LWIP_TCP && TCP_QUEUE_OOSEQ && NO_SYS && PBUF_POOL_FREE_OOSEQ
 void pbuf_free_ooseq(void);
 /** When not using sys_check_timeouts(), call PBUF_CHECK_FREE_OOSEQ()
     at regular intervals from main level to check if ooseq pbufs need to be
diff --git a/src/netif/bridgeif.c b/src/netif/bridgeif.c
index 8a97bce3..021922f6 100644
--- a/src/netif/bridgeif.c
+++ b/src/netif/bridgeif.c
@@ -120,7 +120,7 @@ typedef struct bridgeif_private_s {
 } bridgeif_private_t;
 
 /* netif data index to get the bridge on input */
-u8_t bridgeif_netif_client_id = 0xff;
+static u8_t bridgeif_netif_client_id = 0xff;
 
 /**
  * @ingroup bridgeif
