[Libguestfs] [PATCH] builder: proper consider subkeys in index files

Richard W.M. Jones rjones at redhat.com
Tue Jan 21 16:37:20 UTC 2014


On Tue, Jan 21, 2014 at 05:18:27PM +0100, Pino Toscano wrote:
> +      sv = caml_copy_string (fields->subkey ? fields->subkey : "");
>        Store_field (v, 1, sv);

Heh, sure would be nice if this was an option type :-)

I believe the following should work:

(1) Change CAMLlocal4 (..) at the top of the function to:

  CAMLlocal5 (rv, v, sv, sv2, fv);

(2) Then the new code is:

  if (fields->subkey) {                      /* Some subkey */
    sv2 = caml_copy_string (fields->subkey);
    sv = caml_alloc (1, 0);
    Store_field (sv, 0, sv2);
  } else                                     /* None */
    sv = Val_int (0);
  Store_field (v, 1, sv);

Also you will need to make the corresponding adjustment to the field
type, ie. (string, string option, string) instead of this:

> +and field = string * string * string    (* key + subkey + value *)

I'll have a look at the rest in a minute.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
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