common/utils: Refactor stdlib, gnulib and libxml2 cleanup functions.

This refactoring change just moves the cleanup functions around in the
common/utils directory.

libxml2 cleanups are moved to a separate object file, so that we can
still link to libutils even if the main program is not using libxml2
anywhere.  Similarly gnulib cleanups.

cleanup.c is renamed to cleanups.c.

A new header file cleanups.h is introduced which will replace
guestfs-internal-frontend-cleanups.h (fully replaced in a later commit).
This commit is contained in:
Richard W.M. Jones
2017-06-19 12:20:45 +01:00
parent 7489d22843
commit b2469a6d96
10 changed files with 296 additions and 151 deletions

View File

@@ -97,9 +97,10 @@ setup-install: setup.py stamp-extra-files
# to hard-link any extra files we need into the local directory.
stamp-extra-files: \
c-ctype.h \
cleanups.c \
cleanups.h \
config.h \
guestfs-internal-all.h \
guestfs-internal-frontend-cleanups.h \
guestfs-internal-frontend.h \
ignore-value.h \
utils.c
@@ -111,15 +112,18 @@ config.h:
c-ctype.h:
ln $(top_srcdir)/gnulib/lib/c-ctype.h $@
cleanups.c:
ln $(top_srcdir)/common/utils/cleanups.c $@
cleanups.h:
ln $(top_srcdir)/common/utils/cleanups.h $@
ignore-value.h:
ln $(top_srcdir)/gnulib/lib/ignore-value.h $@
guestfs-internal-all.h:
ln $(top_srcdir)/lib/guestfs-internal-all.h $@
guestfs-internal-frontend-cleanups.h:
ln $(top_srcdir)/common/utils/guestfs-internal-frontend-cleanups.h $@
guestfs-internal-frontend.h:
ln $(top_srcdir)/common/utils/guestfs-internal-frontend.h $@
@@ -145,8 +149,9 @@ CLEANFILES += \
t/*~ t/*.pyc \
c-ctype.h \
config.h \
cleanups.c \
cleanups.h \
guestfs-internal-all.h \
guestfs-internal-frontend-cleanups.h \
guestfs-internal-frontend.h \
ignore-value.h \
stamp-extra-files \