[Libguestfs] [PATCH v3 04/10] lib/osinfo.c: Extract xml processing into a callback

Richard W.M. Jones rjones at redhat.com
Tue Feb 14 15:35:00 UTC 2017


On Fri, Feb 10, 2017 at 04:05:59PM +0100, Cédric Bosdonnat wrote:
> In order to further reuse the osinfo database parsing in OCAML, this
> commit extracts the XML processing for the distro ISOs and places it
> into a newly created callback.
> 
> This will later help other code to traverse the osinfo DB files and
> let them extract what they need from them.

> diff --git a/lib/osinfo.c b/lib/osinfo.c
> index ea2a7659a..b77ff96b3 100644
> --- a/lib/osinfo.c
> +++ b/lib/osinfo.c
> @@ -43,6 +43,7 @@
>   *
>   * XXX Currently the database is not freed when the program exits /
>   * library is unloaded, although we should probably do that.
> + *
>   */

An extra line has been added to this comment.

> +#ifndef GUESTFS_PRIVATE
> +void guestfs_int_debug (guestfs_h *g, const char *fs, ...)
> +{
> +  va_list args;
> +
> +  va_start (args, fs);
> +  vfprintf (stderr, fs, args);
> +  va_end (args);
> +}
> +
> +void
> +guestfs_int_perrorf (guestfs_h *g, const char *fs, ...)
> +{
> +  va_list args;
> +  CLEANUP_FREE char *msg = NULL;
> +  int err;
> +
> +  va_start (args, fs);
> +  err = vasprintf (&msg, fs, args);
> +  va_end (args);
> +
> +  if (err < 0) return;
> +
> +  perror(msg);
> +}
> +#endif /* GUESTFS_PRIVATE */

Why have these functions been added in this commit?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list