From e5e64bfd4158e2ac29bd3e576447a07c87e7a297 Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Tue, 7 Jun 2005 17:06:33 +0000
Subject: [PATCH] header ordering fixes for FreeBSD (pending a global merge
 into asterisk.h) (bug #4484)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_agent.c     | 3 ++-
 channels/chan_features.c  | 3 ++-
 channels/chan_local.c     | 3 ++-
 channels/chan_mgcp.c      | 5 +++--
 channels/chan_modem.c     | 6 +++---
 channels/chan_sip.c       | 5 +++--
 channels/chan_skinny.c    | 2 +-
 formats/format_g723.c     | 3 ++-
 formats/format_g726.c     | 2 +-
 formats/format_g729.c     | 2 +-
 formats/format_gsm.c      | 2 +-
 formats/format_h263.c     | 2 +-
 formats/format_ilbc.c     | 2 +-
 formats/format_pcm.c      | 2 +-
 formats/format_pcm_alaw.c | 2 +-
 formats/format_sln.c      | 2 +-
 formats/format_vox.c      | 2 +-
 formats/format_wav.c      | 2 +-
 formats/format_wav_gsm.c  | 2 +-
 include/asterisk/utils.h  | 1 +
 pbx/pbx_dundi.c           | 2 +-
 21 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 10fec951fe..a2d721d1e6 100755
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -13,12 +13,13 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <sys/socket.h>
 #include <errno.h>
 #include <unistd.h>
+#include <sys/socket.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <netdb.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <sys/signal.h>
 
diff --git a/channels/chan_features.c b/channels/chan_features.c
index f7505d30bb..18f7367cf4 100755
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -13,12 +13,13 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/socket.h>
 #include <errno.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <netdb.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <sys/signal.h>
 
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 8804b6a53c..e520edaede 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -13,12 +13,13 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/socket.h>
 #include <errno.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <netdb.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <sys/signal.h>
 
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 6382b8bb56..f2b03fb80b 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -55,19 +55,20 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <errno.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <netdb.h>
-#include <arpa/inet.h>
 #include <sys/signal.h>
 #include <signal.h>
+#include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
+#include <arpa/inet.h>
 #include <ctype.h>
 
 #include "asterisk.h"
diff --git a/channels/chan_modem.c b/channels/chan_modem.c
index 0b2e10d091..25a052f6b9 100755
--- a/channels/chan_modem.c
+++ b/channels/chan_modem.c
@@ -13,18 +13,18 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/termios.h>
 #include <sys/signal.h>
-#include <ctype.h>
 
 #include "asterisk.h"
 
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d99ac9535b..84b23b1ffc 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -15,18 +15,19 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <errno.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <netdb.h>
-#include <arpa/inet.h>
 #include <signal.h>
 #include <sys/signal.h>
+#include <netinet/in.h>
 #include <netinet/in_systm.h>
+#include <arpa/inet.h>
 #include <netinet/ip.h>
 #include <regex.h>
 
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index f70d61dc3d..d5c2f939ee 100755
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -16,13 +16,13 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <errno.h>
-#include <unistd.h>
 #include <fcntl.h>
 #include <netdb.h>
 #include <arpa/inet.h>
diff --git a/formats/format_g723.c b/formats/format_g723.c
index 9a84301846..d0e1b23258 100755
--- a/formats/format_g723.c
+++ b/formats/format_g723.c
@@ -11,10 +11,11 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <sys/time.h>
diff --git a/formats/format_g726.c b/formats/format_g726.c
index 8e3c8b3c36..4813a72c08 100755
--- a/formats/format_g726.c
+++ b/formats/format_g726.c
@@ -9,12 +9,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_g729.c b/formats/format_g729.c
index bb25f190f2..19e6809be9 100755
--- a/formats/format_g729.c
+++ b/formats/format_g729.c
@@ -11,12 +11,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_gsm.c b/formats/format_gsm.c
index 381733adac..01fb2a1f94 100755
--- a/formats/format_gsm.c
+++ b/formats/format_gsm.c
@@ -11,12 +11,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_h263.c b/formats/format_h263.c
index 518ccf6ab2..990acbecc4 100755
--- a/formats/format_h263.c
+++ b/formats/format_h263.c
@@ -11,12 +11,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_ilbc.c b/formats/format_ilbc.c
index 47a437c97b..a690f26901 100755
--- a/formats/format_ilbc.c
+++ b/formats/format_ilbc.c
@@ -13,12 +13,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_pcm.c b/formats/format_pcm.c
index d3b8a04fbb..5c28fe3d12 100755
--- a/formats/format_pcm.c
+++ b/formats/format_pcm.c
@@ -11,12 +11,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_pcm_alaw.c b/formats/format_pcm_alaw.c
index f53deb4871..b5de9f980c 100755
--- a/formats/format_pcm_alaw.c
+++ b/formats/format_pcm_alaw.c
@@ -11,6 +11,7 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -18,7 +19,6 @@
 #include <sys/times.h>
 #include <sys/types.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_sln.c b/formats/format_sln.c
index 911163de94..3d051c1c12 100755
--- a/formats/format_sln.c
+++ b/formats/format_sln.c
@@ -9,12 +9,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_vox.c b/formats/format_vox.c
index 659281ea1c..e8f9218eae 100755
--- a/formats/format_vox.c
+++ b/formats/format_vox.c
@@ -11,12 +11,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_wav.c b/formats/format_wav.c
index 3e8117c3fb..6e9246754c 100755
--- a/formats/format_wav.c
+++ b/formats/format_wav.c
@@ -11,12 +11,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c
index 441cb5d603..866c5f54cc 100755
--- a/formats/format_wav_gsm.c
+++ b/formats/format_wav_gsm.c
@@ -11,12 +11,12 @@
  * the GNU General Public License
  */
  
+#include <unistd.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <string.h>
 
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 4439085780..5b2001a6de 100755
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -17,6 +17,7 @@
 #endif
 
 #include <netinet/in.h>
+#include <arpa/inet.h>	/* we want to override inet_ntoa */
 #include <netdb.h>
 #include <pthread.h>
 #include <limits.h>
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 36149f39ca..aa58d5556d 100755
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -11,8 +11,8 @@
 
 #include <stdlib.h>
 #include <unistd.h>
-#include <arpa/inet.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <sys/socket.h>
 #include <string.h>
 #include <errno.h>
-- 
GitLab