diff options
author | Colin Walters <walters@verbum.org> | 2013-04-26 16:42:54 -0400 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2013-05-16 14:08:09 -0500 |
commit | 468c08511c86dac621bc63169c0e3bb6e2517a68 (patch) | |
tree | 571086f1b047cc6dfd533cf08e6592622bd1313b | |
parent | cd091592016fce37473a108b02499a2748aa209a (diff) |
core: add libgsystem as a git submodule
And change src/main.c to use the local allocation macros. This
results in much cleaner code, as one can see from the diff.
Because libgsystem is designed for nonrecursive make, it fits best in
the current recursive setup if we build . first. This will be a lot
nicer when we switch NM to a nonrecursive setup.
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile.am | 7 | ||||
-rwxr-xr-x | autogen.sh | 8 | ||||
m--------- | libgsystem | 0 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/main.c | 50 |
6 files changed, 32 insertions, 39 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..e93bbea6d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libgsystem"] + path = libgsystem + url = git://git.gnome.org/libgsystem diff --git a/Makefile.am b/Makefile.am index 32fc74d47..9976a2aa0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,7 @@ include $(GLIB_MAKEFILE) SUBDIRS = \ + . \ include \ libnm-util \ libnm-glib \ @@ -53,3 +54,9 @@ CLEANFILES = cscope.in.out cscope.out cscope.po.out .PHONY: cscope cscope: cscope -b -q -R -Iinclude -ssrc -slibnm-glib -slibnm-util -scli/src; + +libgsystem_srcpath := libgsystem +libgsystem_cflags := $(GLIB_CFLAGS) -I$(srcdir)/libgsystem +libgsystem_libs = $(GLIB_LIBS) +include libgsystem/Makefile-libgsystem.am +noinst_LTLIBRARIES = libgsystem.la diff --git a/autogen.sh b/autogen.sh index ef6d20f5e..8c6179a9f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,6 +13,14 @@ PKG_NAME=NetworkManager exit 1 } +# Fetch submodules if needed +if test ! -f src/libgsystem/README; +then + echo "+ Setting up submodules" + git submodule init + git submodule update +fi + (cd $srcdir; gtkdocize || exit 1 autopoint --force diff --git a/libgsystem b/libgsystem new file mode 160000 +Subproject be1b3b9d3dbfacf15ede143de377452a9297646 diff --git a/src/Makefile.am b/src/Makefile.am index 12a7aa063..d34e911fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,6 +25,7 @@ endif INCLUDES = \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ + -I${top_srcdir}/libgsystem \ -I$(top_srcdir)/libnm-util \ -I$(top_builddir)/libnm-util \ -I$(top_srcdir)/callouts @@ -42,7 +43,7 @@ sbin_PROGRAMS = NetworkManager NetworkManager_SOURCES = \ main.c -NetworkManager_LDADD = libNetworkManager.la +NetworkManager_LDADD = libNetworkManager.la $(top_builddir)/libgsystem.la noinst_LTLIBRARIES = libNetworkManager.la diff --git a/src/main.c b/src/main.c index ed71bb62e..37e05c4e8 100644 --- a/src/main.c +++ b/src/main.c @@ -38,6 +38,7 @@ #include <gmodule.h> #include <string.h> +#include "gsystem-local-alloc.h" #include "NetworkManager.h" #include "NetworkManagerUtils.h" #include "nm-manager.h" @@ -305,18 +306,19 @@ main (int argc, char *argv[]) GOptionContext *opt_ctx = NULL; gboolean become_daemon = FALSE; gboolean g_fatal_warnings = FALSE; - char *pidfile = NULL, *state_file = NULL; + gs_free char *pidfile = NULL; + gs_free char *state_file = NULL; gboolean wifi_enabled = TRUE, net_enabled = TRUE, wwan_enabled = TRUE, wimax_enabled = TRUE; gboolean success, show_version = FALSE; NMPolicy *policy = NULL; - NMVPNManager *vpn_manager = NULL; - NMDnsManager *dns_mgr = NULL; - NMDBusManager *dbus_mgr = NULL; - NMSupplicantManager *sup_mgr = NULL; - NMDHCPManager *dhcp_mgr = NULL; - NMFirewallManager *fw_mgr = NULL; - NMSettings *settings = NULL; - NMConfig *config; + gs_unref_object NMVPNManager *vpn_manager = NULL; + gs_unref_object NMDnsManager *dns_mgr = NULL; + gs_unref_object NMDBusManager *dbus_mgr = NULL; + gs_unref_object NMSupplicantManager *sup_mgr = NULL; + gs_unref_object NMDHCPManager *dhcp_mgr = NULL; + gs_unref_object NMFirewallManager *fw_mgr = NULL; + gs_unref_object NMSettings *settings = NULL; + gs_unref_object NMConfig *config = NULL; GError *error = NULL; gboolean wrote_pidfile = FALSE; @@ -579,41 +581,13 @@ done: if (policy) nm_policy_destroy (policy); - if (manager) - g_object_unref (manager); - - if (settings) - g_object_unref (settings); - - if (vpn_manager) - g_object_unref (vpn_manager); - - if (dns_mgr) - g_object_unref (dns_mgr); - - if (dhcp_mgr) - g_object_unref (dhcp_mgr); - - if (sup_mgr) - g_object_unref (sup_mgr); - - if (fw_mgr) - g_object_unref (fw_mgr); - - if (dbus_mgr) - g_object_unref (dbus_mgr); + g_clear_object (&manager); nm_logging_shutdown (); if (pidfile && wrote_pidfile) unlink (pidfile); - g_object_unref (config); - - /* Free options */ - g_free (pidfile); - g_free (state_file); - nm_log_info (LOGD_CORE, "exiting (%s)", success ? "success" : "error"); exit (success ? 0 : 1); } |