Commit 8bace23b authored by Thomas Haller's avatar Thomas Haller

all: cleanup includes and let "nm-default.h" include "config.h"

- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for <config.h> itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
parent 89d6fa6a
......@@ -18,18 +18,16 @@
* Copyright (C) 2008 - 2011 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
#include "nm-dbus-interface.h"
#include "nm-connection.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-connection.h"
#include <nm-dbus-interface.h>
#include <nm-connection.h>
#include <nm-setting-ip4-config.h>
#include <nm-setting-ip6-config.h>
#include <nm-setting-connection.h>
#include "nm-default.h"
#include "nm-dispatcher-api.h"
#include "nm-utils.h"
......
......@@ -18,8 +18,6 @@
* Copyright (C) 2008 - 2012 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include <syslog.h>
......
......@@ -18,13 +18,12 @@
*
*/
#include "config.h"
#include "nm-default.h"
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include "nm-default.h"
#include "nm-core-internal.h"
#include "nm-dispatcher-utils.h"
#include "nm-dispatcher-api.h"
......
......@@ -19,16 +19,14 @@
* Copyright 2014 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "nm-default.h"
#include "common.h"
#include "utils.h"
#include "nm-secret-agent-simple.h"
......
......@@ -19,18 +19,16 @@
* Copyright 2012 - 2014 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "nm-default.h"
#include "nm-vpn-helpers.h"
#include "common.h"
#include "utils.h"
......
......@@ -17,7 +17,7 @@
* Copyright 2010 - 2015 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include <stdio.h>
#include <string.h>
......@@ -29,7 +29,6 @@
#include <readline/readline.h>
#include <readline/history.h>
#include "nm-default.h"
#include "utils.h"
#include "common.h"
#include "settings.h"
......
......@@ -17,7 +17,7 @@
* Copyright 2010 - 2014 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include <stdio.h>
#include <string.h>
......@@ -25,7 +25,6 @@
#include <errno.h>
#include <readline/readline.h>
#include "nm-default.h"
#include "nm-secret-agent-simple.h"
#include "polkit-agent.h"
#include "utils.h"
......
......@@ -17,12 +17,11 @@
* Copyright 2010 - 2015 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
#include <stdlib.h>
#include "nm-default.h"
#include "polkit-agent.h"
#include "utils.h"
#include "general.h"
......
......@@ -20,7 +20,7 @@
*/
/* Generated configuration file */
#include "config.h"
#include "nm-default.h"
#include <stdio.h>
#include <string.h>
......@@ -33,7 +33,6 @@
#include <readline/readline.h>
#include <readline/history.h>
#include "nm-default.h"
#include "polkit-agent.h"
#include "nmcli.h"
#include "utils.h"
......
......@@ -20,8 +20,6 @@
#ifndef NMC_NMCLI_H
#define NMC_NMCLI_H
#include "config.h"
#include <NetworkManager.h>
#include <nm-secret-agent-old.h>
......
......@@ -17,7 +17,7 @@
* Copyright 2014 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#if WITH_POLKIT_AGENT
......@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <unistd.h>
#include "nm-default.h"
#include "polkit-agent.h"
#include "nm-polkit-listener.h"
#include "common.h"
......
......@@ -17,9 +17,8 @@
* Copyright 2010 - 2015 Red Hat, Inc.
*/
#include "config.h"
#include "nm-default.h"
#include "settings.h"
#include <stdlib.h>
......
......@@ -18,18 +18,17 @@
*/
/* Generated configuration file */
#include "config.h"
#include "nm-default.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "nm-default.h"
#include "utils.h"
int
......
......@@ -31,13 +31,12 @@
* https://github.com/lxde/lxqt-policykit/tree/master/src
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "nm-default.h"
#include "nm-polkit-listener.h"
G_DEFINE_TYPE (NMPolkitListener, nm_polkit_listener, POLKIT_AGENT_TYPE_LISTENER)
......
......@@ -29,14 +29,13 @@
* replace ShellNetworkAgent.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
#include <NetworkManager.h>
#include <nm-vpn-service-plugin.h>
#include "NetworkManager.h"
#include "nm-vpn-service-plugin.h"
#include "nm-default.h"
#include "nm-vpn-helpers.h"
#include "nm-secret-agent-simple.h"
......
......@@ -23,9 +23,8 @@
* Some functions should probably eventually move into libnm.
*/
#include "config.h"
#include "nm-default.h"
#include "nm-vpn-helpers.h"
#include <string.h>
......
......@@ -31,16 +31,14 @@
* Robert Love <rml@novell.com>
*/
#include "config.h"
#include "nm-default.h"
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <locale.h>
#include <NetworkManager.h>
#include "nm-default.h"
#include "NetworkManager.h"
#define PROGRESS_STEPS 15
#define WAIT_STARTUP_TAG "wait-startup"
......
......@@ -29,7 +29,7 @@
* within each of the two sections.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -23,7 +23,7 @@
* #NmtNewtButton implements a button widget.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-button.h"
#include "nmt-newt-utils.h"
......
......@@ -23,7 +23,7 @@
* #NmtNewtCheckbox implements a checkbox widget.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-checkbox.h"
#include "nmt-newt-utils.h"
......
......@@ -24,7 +24,7 @@
* wrap a (single) #newtComponent.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-component.h"
#include "nmt-newt-form.h"
......
......@@ -26,7 +26,7 @@
* #NmtNewtGrid is the most generic container type.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -26,7 +26,7 @@
* #NmtNewtEntryValidator functions, so you should not set your own.
*/
#include "config.h"
#include "nm-default.h"
#include <stdlib.h>
......
......@@ -26,7 +26,7 @@
* See also #NmtNewtEntryNumeric, for numeric-only entries.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -24,7 +24,7 @@
* "form" (aka dialog) to the user.
*/
#include "config.h"
#include "nm-default.h"
#include <fcntl.h>
#include <string.h>
......
......@@ -40,7 +40,7 @@
* must be implemented by the container...
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -24,7 +24,7 @@
* functions that were added after 0.52.15.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-hacks.h"
......
......@@ -19,8 +19,6 @@
#ifndef NMT_NEWT_HACKS_H
#define NMT_NEWT_HACKS_H
#include "config.h"
#include <newt.h>
#ifndef HAVE_NEWTCOMPONENTGETSIZE
......
......@@ -25,7 +25,7 @@
* See also #NmtNewtTextbox, for multiline.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -31,7 +31,7 @@
* presses Return on a selection.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-listbox.h"
#include "nmt-newt-form.h"
......
......@@ -26,7 +26,7 @@
* #NmtNewtForm containing an #NmtNewtListbox to select from.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-popup.h"
#include "nmt-newt-form.h"
......
......@@ -35,7 +35,7 @@
* extent of the section.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -25,7 +25,7 @@
* between widgets in containers that don't implement padding.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-separator.h"
......
......@@ -29,7 +29,7 @@
* children.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -24,7 +24,7 @@
* word-wrapping.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
......
......@@ -23,7 +23,7 @@
* #NmtNewtToggleButton implements a two-state toggle button.
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-toggle-button.h"
......
......@@ -21,14 +21,13 @@
* @short_description: Utility functions
*/
#include "config.h"
#include "nm-default.h"
#include <errno.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/wait.h>
#include "nm-default.h"
#include "nmt-newt-utils.h"
static void
......
......@@ -34,7 +34,7 @@
* FIXME: need RTL support
*/
#include "config.h"
#include "nm-default.h"
#include "nmt-newt-widget.h"
#include "nmt-newt-form.h"
......
......@@ -25,7 +25,7 @@
* shared between nmtui, nm-connection-editor, and gnome-control-center.
*/
#include "config.h"
#include "nm-default.h"
#include <arpa/inet.h>
#include <netinet/in.h>
......
......@@ -25,11 +25,10 @@
* nm-connection-editor, and gnome-control-center.
*/
#include "config.h"
#include "nm-default.h"
#include <NetworkManager.h>
#include "NetworkManager.h"
#include "nm-default.h"
#include "nm-editor-utils.h"
#if 0
#include "nm-vpn-helpers.h"
......
......@@ -28,7 +28,7 @@
* functions.
*/
#include "config.h"
#include "nm-default.h"
#include <arpa/inet.h>
#include <netinet/in.h>
......
......@@ -24,11 +24,11 @@
* access points displayed by "nmtui connect".
*/
#include "config.h"
#include "nm-default.h"
#include <stdlib.h>
#include <NetworkManager.h>
#include "NetworkManager.h"
#include "nmtui.h"
#include "nmt-connect-connection-list.h"
......
......@@ -34,13 +34,13 @@
* to implement that then we should make it just an #NmtNewtEntry.
*/
#include "config.h"
#include "nm-default.h"
#include <string.h>
#include <sys/socket.h>
#include <linux/if_arp.h>
#include <NetworkManager.h>
#include "NetworkManager.h"
#include "nmtui.h"
#include "nmt-device-entry.h"
......
......@@ -24,7 +24,7 @@
* "nmtui edit".
*/
#include "config.h"
#include "nm-default.h"
#include "nmtui.h"