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

Cedric Bosdonnat cbosdonnat at suse.com
Tue Feb 14 16:19:27 UTC 2017


On Tue, 2017-02-14 at 15:35 +0000, Richard W.M. Jones wrote:
> 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.

Ooops

> > +#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?

I could add them to the commit using the osinfo from mllib if you want.
Otherwise the functions are missing when linking the mllib ocaml / C wrapper.

--
Cedric




More information about the Libguestfs mailing list