diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f456a149 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/libgsystem"] + path = src/libgsystem + url = git://git.gnome.org/libgsystem diff --git a/Makefile-daemon.am b/Makefile-daemon.am index caa97f2e..aab7e408 100644 --- a/Makefile-daemon.am +++ b/Makefile-daemon.am @@ -24,5 +24,5 @@ ostreed_SOURCES = src/daemon/ostreed.c \ src/daemon/ot-daemon.c \ $(NULL) -ostreed_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/daemon -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) +ostreed_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libgsystem -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/daemon -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) ostreed_LDADD = libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS) diff --git a/Makefile-libostree.am b/Makefile-libostree.am index 2d2b3b22..89e7b191 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -46,7 +46,7 @@ libostree_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \ $(NULL) endif -libostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) +libostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libgsystem -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) libostree_la_LDFLAGS = -avoid-version -Bsymbolic-functions libostree_la_LIBADD = libotutil.la $(OT_INTERNAL_GIO_UNIX_LIBS) diff --git a/Makefile-ostadmin.am b/Makefile-ostadmin.am index f0e01127..16eca428 100644 --- a/Makefile-ostadmin.am +++ b/Makefile-ostadmin.am @@ -25,5 +25,5 @@ ostadmin_SOURCES = src/ostadmin/main.c \ src/ostadmin/ot-admin-main.c \ $(NULL) -ostadmin_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostadmin -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) -ostadmin_LDADD = libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS) +ostadmin_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libgsystem -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostadmin -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) +ostadmin_LDADD = libgsystem.la libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS) diff --git a/Makefile-ostree.am b/Makefile-ostree.am index b5b07b44..9571e5eb 100644 --- a/Makefile-ostree.am +++ b/Makefile-ostree.am @@ -43,7 +43,7 @@ ostree_SOURCES = src/ostree/main.c \ src/ostree/ot-main.c \ $(NULL) -ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostree -DLOCALEDIR=\"$(datadir)/locale\" +ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libgsystem -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostree -DLOCALEDIR=\"$(datadir)/locale\" ostree_bin_shared_ldadd = libotutil.la libostree.la ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) diff --git a/Makefile-otutil.am b/Makefile-otutil.am index cf7c50e2..5d887162 100644 --- a/Makefile-otutil.am +++ b/Makefile-otutil.am @@ -22,7 +22,6 @@ noinst_LTLIBRARIES += libotutil.la libotutil_la_SOURCES = \ src/libotutil/ot-checksum-utils.c \ src/libotutil/ot-checksum-utils.h \ - src/libotutil/ot-local-alloc.c \ src/libotutil/ot-local-alloc.h \ src/libotutil/ot-opt-utils.c \ src/libotutil/ot-opt-utils.h \ @@ -39,5 +38,5 @@ libotutil_la_SOURCES = \ src/libotutil/otutil.c \ src/libotutil/otutil.h \ $(NULL) -libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) -libotutil_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS) +libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libgsystem -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS) +libotutil_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS) libgsystem.la diff --git a/Makefile.am b/Makefile.am index ad85e97c..101dec6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,6 +68,10 @@ OT_INTERNAL_SOUP_CFLAGS = $(OT_DEP_SOUP_CFLAGS) OT_INTERNAL_SOUP_LIBS = $(OT_DEP_SOUP_LIBS) endif +libgsystem_srcpath := src/libgsystem +libgsystem_cflags = $(OT_INTERNAL_GIO_UNIX_CFLAGS) +libgsystem_libs = $(OT_INTERNAL_GIO_UNIX_LIBS) +include src/libgsystem/Makefile-libgsystem.am include Makefile-daemon.am include Makefile-otutil.am include Makefile-libostree.am diff --git a/src/libgsystem b/src/libgsystem new file mode 160000 index 00000000..ba5d7480 --- /dev/null +++ b/src/libgsystem @@ -0,0 +1 @@ +Subproject commit ba5d74802c0ffe51bd18d2ba64db87e1e7456349 diff --git a/src/libotutil/ot-local-alloc.c b/src/libotutil/ot-local-alloc.c deleted file mode 100644 index cf1dba32..00000000 --- a/src/libotutil/ot-local-alloc.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2012 Colin Walters - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Colin Walters - */ - -#include "config.h" - -#include "otutil.h" - -void -ot_local_free (void *loc) -{ - void **location = loc; - if (location) - g_free (*location); -} - -#define _ot_local_free(type, function) do { \ - void **location = loc; \ - if (location) \ - { \ - type *value = *location; \ - if (value) \ - function (value); \ - } \ - } while (0) - -void -ot_local_obj_unref (void *loc) -{ - GObject **location = (GObject**)loc; - if (location && *location) - g_object_unref (*location); -} - -void -ot_local_variant_unref (GVariant **loc) -{ - if (loc && *loc) - g_variant_unref (*loc); -} - -void -ot_local_ptrarray_unref (GPtrArray **loc) -{ - if (loc && *loc) - g_ptr_array_unref (*loc); -} - -void -ot_local_hashtable_unref (GHashTable **loc) -{ - if (loc && *loc) - g_hash_table_unref (*loc); -} diff --git a/src/libotutil/ot-local-alloc.h b/src/libotutil/ot-local-alloc.h index 3cbfc528..ee3b93f4 100644 --- a/src/libotutil/ot-local-alloc.h +++ b/src/libotutil/ot-local-alloc.h @@ -24,20 +24,15 @@ #define __OSTREE_LOCAL_ALLOC_H__ #include +#include "libgsystem.h" G_BEGIN_DECLS -void ot_local_free (void *loc); -void ot_local_obj_unref (void *loc); -void ot_local_variant_unref (GVariant **loc); -void ot_local_ptrarray_unref (GPtrArray **loc); -void ot_local_hashtable_unref (GHashTable **loc); - -#define ot_lfree __attribute__ ((cleanup(ot_local_free))) -#define ot_lobj __attribute__ ((cleanup(ot_local_obj_unref))) -#define ot_lvariant __attribute__ ((cleanup(ot_local_variant_unref))) -#define ot_lptrarray __attribute__ ((cleanup(ot_local_ptrarray_unref))) -#define ot_lhash __attribute__ ((cleanup(ot_local_hashtable_unref))) +#define ot_lfree __attribute__ ((cleanup(gs_local_free))) +#define ot_lobj __attribute__ ((cleanup(gs_local_obj_unref))) +#define ot_lvariant __attribute__ ((cleanup(gs_local_variant_unref))) +#define ot_lptrarray __attribute__ ((cleanup(gs_local_ptrarray_unref))) +#define ot_lhash __attribute__ ((cleanup(gs_local_hashtable_unref))) G_END_DECLS