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\");
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\");
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 = virConnectListDomains (conn, ids, i));
CHECK_ERROR (r == -1, conn, "virConnectListDomains");
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 = virConnectListDefinedDomains (conn, names, i));
CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
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 = virConnectListNetworks (conn, names, i));
CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
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 = virConnectListDefinedNetworks (conn, names, i));
CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
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 = virConnectListStoragePools (conn, names, i));
CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
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 = virConnectListDefinedStoragePools (conn, names, i));
CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
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 = virStoragePoolListVolumes (pool, names, i));
CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");