[network-manager-openvpn/th/vpn-editor-split-bgo765732: 3/13] build: cleanup includes and include "nm-default.h" first



commit 6c895964a9ef865761e419e7262604abae6f80a1
Author: Thomas Haller <thaller redhat com>
Date:   Thu Apr 28 19:12:04 2016 +0200

    build: cleanup includes and include "nm-default.h" first
    
    - every source code file should include "nm-default.h" as first.
    - "nm-default.h" now includes <config.h> as first. Thus, every
      source code file implicitly includes <config.h> as first. No
      other place should include <config.h> as first.
    - as second, the source file should include its corresponding header
      file to ensure that every header file is self-contained (except
      what is universally provided via "nm-default.h".
    - then follow system headers, libnm/libnma headers, and finally all
      internal headers.

 auth-dialog/main.c                      |    4 +---
 properties/auth-helpers.c               |    7 +++----
 properties/import-export.c              |    7 +++----
 properties/nm-openvpn.c                 |    7 +++----
 properties/tests/test-import-export.c   |    4 +---
 shared/nm-default.h                     |    2 ++
 shared/utils.c                          |    6 +++---
 src/nm-openvpn-service-openvpn-helper.c |    4 +---
 src/nm-openvpn-service.c                |    7 +++----
 9 files changed, 20 insertions(+), 28 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 760467e..32c1686 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -22,7 +22,7 @@
  *               2005 Tim Niemueller [www.niemueller.de]
  */
 
-#include "config.h"
+#include "nm-default.h"
 
 #include <errno.h>
 #include <string.h>
@@ -32,8 +32,6 @@
 #define SECRET_API_SUBJECT_TO_CHANGE
 #include <libsecret/secret.h>
 
-#include "nm-default.h"
-
 #include <nm-vpn-service-plugin.h>
 #include <nma-vpn-password-dialog.h>
 
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index d662199..31f1254 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -21,7 +21,9 @@
  *
  **************************************************************************/
 
-#include "config.h"
+#include "nm-default.h"
+
+#include "auth-helpers.h"
 
 #include <string.h>
 #include <sys/types.h>
@@ -31,9 +33,6 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include "nm-default.h"
-
-#include "auth-helpers.h"
 #include "nm-openvpn.h"
 #include "nm-openvpn-service-defines.h"
 #include "utils.h"
diff --git a/properties/import-export.c b/properties/import-export.c
index 16a5925..de918ed 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -19,7 +19,9 @@
  *
  **************************************************************************/
 
-#include "config.h"
+#include "nm-default.h"
+
+#include "import-export.h"
 
 #include <string.h>
 #include <sys/types.h>
@@ -32,9 +34,6 @@
 #include <ctype.h>
 #include <stdio.h>
 
-#include "nm-default.h"
-
-#include "import-export.h"
 #include "nm-openvpn.h"
 #include "nm-openvpn-service-defines.h"
 #include "utils.h"
diff --git a/properties/nm-openvpn.c b/properties/nm-openvpn.c
index b98f036..c7c2715 100644
--- a/properties/nm-openvpn.c
+++ b/properties/nm-openvpn.c
@@ -25,7 +25,9 @@
  *
  **************************************************************************/
 
-#include "config.h"
+#include "nm-default.h"
+
+#include "nm-openvpn.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -34,10 +36,7 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
-#include "nm-default.h"
-
 #include "nm-openvpn-service-defines.h"
-#include "nm-openvpn.h"
 #include "auth-helpers.h"
 #include "import-export.h"
 
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 5c8b7a0..3fcb822 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -18,7 +18,7 @@
  *
  */
 
-#include "config.h"
+#include "nm-default.h"
 
 #include <string.h>
 #include <netinet/in.h>
@@ -26,8 +26,6 @@
 #include <locale.h>
 #include <sys/stat.h>
 
-#include "nm-default.h"
-
 #include "nm-openvpn.h"
 #include "nm-openvpn-service-defines.h"
 #include "import-export.h"
diff --git a/shared/nm-default.h b/shared/nm-default.h
index 0567727..c54b556 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -36,6 +36,8 @@
 
 /*****************************************************************************/
 
+#include <config.h>
+
 /* always include these headers for our internal source files. */
 
 #include "nm-glib.h"
diff --git a/shared/utils.c b/shared/utils.c
index 13cb73d..edd3171 100644
--- a/shared/utils.c
+++ b/shared/utils.c
@@ -19,13 +19,13 @@
  * (C) Copyright 2010 Red Hat, Inc.
  */
 
-#include "config.h"
+#include "nm-default.h"
+
+#include "utils.h"
 
 #include <string.h>
 #include <errno.h>
 
-#include "nm-default.h"
-#include "utils.h"
 #include "nm-macros-internal.h"
 
 gboolean
diff --git a/src/nm-openvpn-service-openvpn-helper.c b/src/nm-openvpn-service-openvpn-helper.c
index 5a2e0be..1cf34e1 100644
--- a/src/nm-openvpn-service-openvpn-helper.c
+++ b/src/nm-openvpn-service-openvpn-helper.c
@@ -25,7 +25,7 @@
  * $Id: nm-openvpn-service-openvpn-helper.c 4170 2008-10-11 14:44:45Z dcbw $
  */
 
-#include "config.h"
+#include "nm-default.h"
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -39,8 +39,6 @@
 #include <ctype.h>
 #include <netdb.h>
 
-#include "nm-default.h"
-
 #include "nm-openvpn-service.h"
 #include "nm-utils.h"
 
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 61ecc58..f25593c 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -22,7 +22,9 @@
  *
  */
 
-#include "config.h"
+#include "nm-default.h"
+
+#include "nm-openvpn-service.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -44,11 +46,8 @@
 #include <grp.h>
 #include "glib-unix.h"
 
-#include "nm-default.h"
-
 #include <nm-vpn-service-plugin.h>
 
-#include "nm-openvpn-service.h"
 #include "nm-utils.h"
 #include "utils.h"
 #include "nm-macros-internal.h"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]