header: Define GUESTFS_HAVE_* for every function.

Previously we only defined GUESTFS_HAVE_* macros for functions that
were not deprecated, test or debug functions.  The reasoning for that
is given in this commit message [note that 'LIBGUESTFS_HAVE_' is the
old/deprecated macro]:

  commit 2d8fd7dacd
  Author: Richard Jones <rjones@redhat.com>
  Date:   Thu Sep 2 22:45:54 2010 +0100

    Define LIBGUESTFS_HAVE_<shortname> for C API functions.

    The actions each have a corresponding define, eg:

      #define LIBGUESTFS_HAVE_VGUUID 1
      extern char *guestfs_vguuid (guestfs_h *g, const char *vgname);

    However functions which are for testing, debugging or deprecated do
    not have the corresponding define.  Also a few functions are so
    basic (eg. guestfs_create) that there is no point defining a symbol
    for them.

This wasn't in fact carried through very consistently, since when we
replaced s/LIBGUESTFS_HAVE_/GUESTFS_HAVE_/, we kept the old
LIBGUESTFS_HAVE_* macros, but defined them for every function.  Oops.

This commit defines GUESTFS_HAVE_* for every function in <guestfs.h>,
making it easier to write the Python language bindings (see following
commits).
This commit is contained in:
Richard W.M. Jones
2015-09-15 14:36:48 +01:00
parent f2540d68e4
commit a17627cdd2

View File

@@ -645,13 +645,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
let generate_action_header { name = shortname;
style = ret, args, optargs as style;
deprecated_by = deprecated_by } =
let test =
String.length shortname >= 13 &&
String.sub shortname 0 13 = "internal_test" in
let debug =
String.length shortname >= 5 && String.sub shortname 0 5 = "debug" in
if deprecated_by = None && not test && not debug then
pr "#define GUESTFS_HAVE_%s 1\n" (String.uppercase shortname);
pr "#define GUESTFS_HAVE_%s 1\n" (String.uppercase shortname);
if optargs <> [] then (
iteri (