mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 16:30:23 +01:00
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.
This commit is contained in:
parent
cd09159201
commit
468c08511c
6 changed files with 33 additions and 39 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "libgsystem"]
|
||||
path = libgsystem
|
||||
url = git://git.gnome.org/libgsystem
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
1
libgsystem
Submodule
1
libgsystem
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit be1b3b9d3dbfacf15ede143de377452a92976468
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
50
src/main.c
50
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue