X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=libvirt%2Fgenerator.pl;h=b4bd2c72552639222384ed59743a0cc9a5d63cab;hb=9f321a893d71b510cfc01b088e60e5ddba83e481;hp=4fbace6dab365e06a384ac4e20751848512d0f3b;hpb=9b1c8e53eaa6fb79ee801e3014793618b977857d;p=ocaml-libvirt.git diff --git a/libvirt/generator.pl b/libvirt/generator.pl index 4fbace6..b4bd2c7 100755 --- a/libvirt/generator.pl +++ b/libvirt/generator.pl @@ -7,7 +7,8 @@ # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. +# version 2 of the License, or (at your option) any later version, +# with the OCaml linking exception described in ../COPYING.LIB. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -226,7 +227,8 @@ print F <<'END'; * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2 of the License, or (at your option) any later version, + * with the OCaml linking exception described in ../COPYING.LIB. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -620,6 +622,16 @@ sub gen_c_code int i = Int_val (iv); int ids[i], r; + /* Some libvirt List* functions still throw exceptions if i == 0, + * so catch that and return an empty array directly. This changes + * the semantics slightly (masking other failures) but it's + * unlikely anyone will care. RWMJ 2008/06/10 + */ + if (i == 0) { + rv = caml_alloc (0, 0); + CAMLreturn (rv); + } + NONBLOCKING (r = $c_name (conn, ids, i)); CHECK_ERROR (r == -1, conn, \"$c_name\"); @@ -637,6 +649,16 @@ sub gen_c_code char *names[i]; int r; + /* Some libvirt List* functions still throw exceptions if i == 0, + * so catch that and return an empty array directly. This changes + * the semantics slightly (masking other failures) but it's + * unlikely anyone will care. RWMJ 2008/06/10 + */ + if (i == 0) { + rv = caml_alloc (0, 0); + CAMLreturn (rv); + } + NONBLOCKING (r = $c_name ($1, names, i)); CHECK_ERROR (r == -1, conn, \"$c_name\");