From 7167cb3f1c1d28e4dcd481f75dcb6179dd0847f5 Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Sun, 19 Mar 2017 11:17:54 +0100
Subject: [PATCH] trivial: avoid redundant redefinition of htons

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 lib/arp.c  | 6 ++----
 lib/ipv4.c | 7 ++-----
 lib/snmp.c | 7 ++-----
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/lib/arp.c b/lib/arp.c
index 4d5341c57..d58c55f91 100644
--- a/lib/arp.c
+++ b/lib/arp.c
@@ -6,16 +6,14 @@
  *
  * Released according to the GNU GPL, version 2 or any later version.
  */
+#include <wrc.h>
+#include <wrpc.h>
 #include <string.h>
 
 #include "endpoint.h"
 #include "ipv4.h"
 #include "ptpd_netif.h"
 
-#ifndef htons
-#define htons(x) x
-#endif
-
 static uint8_t __arp_queue[128];
 static struct wrpc_socket __static_arp_socket = {
 	.queue.buff = __arp_queue,
diff --git a/lib/ipv4.c b/lib/ipv4.c
index 5ed6f03e2..db86dd218 100644
--- a/lib/ipv4.c
+++ b/lib/ipv4.c
@@ -6,8 +6,9 @@
  *
  * Released according to the GNU GPL, version 2 or any later version.
  */
-#include <string.h>
+#include <wrc.h>
 #include <wrpc.h>
+#include <string.h>
 
 #include "endpoint.h"
 #include "ipv4.h"
@@ -16,10 +17,6 @@
 #include "hw/memlayout.h"
 #include "hw/etherbone-config.h"
 
-#ifndef htons
-#define htons(x) x
-#endif
-
 enum ip_status ip_status = IP_TRAINING;
 static uint8_t myIP[4];
 
diff --git a/lib/snmp.c b/lib/snmp.c
index 99fcf4875..4e02bc717 100644
--- a/lib/snmp.c
+++ b/lib/snmp.c
@@ -12,8 +12,9 @@
  * Each OID is divided into the limb and twig part.
  * The twig part can be handled as a group or a table
  */
-#include <string.h>
+#include <wrc.h>
 #include <wrpc.h>
+#include <string.h>
 #include <minic.h>
 #include <limits.h>
 
@@ -30,10 +31,6 @@
 
 #include "storage.h"
 
-#ifndef htons
-#define htons(x) x
-#endif
-
 #define ASN_BOOLEAN	((u_char)0x01)
 #define ASN_INTEGER	((u_char)0x02)
 #define ASN_OCTET_STR	((u_char)0x04)
-- 
GitLab