Re: [libvirt] [PATCH] fix mingw compilation warning

2008-10-24 Thread Jim Meyering
Jim Meyering [EMAIL PROTECTED] wrote:
 Building for mingw, I got this warning:

 libvirt.c:242: warning: control reaches end of non-void function

 Here's the fix:

 fix mingw compilation warning
 * src/libvirt.c (winsock_init) [HAVE_WINSOCK2_H]: Always return a value.

 diff --git a/src/libvirt.c b/src/libvirt.c
 index ca2675a..05a92d3 100644
 --- a/src/libvirt.c
 +++ b/src/libvirt.c
 @@ -237,8 +237,7 @@ winsock_init (void)
  /* http://msdn2.microsoft.com/en-us/library/ms742213.aspx */
  winsock_version = MAKEWORD (2, 2);
  err = WSAStartup (winsock_version, winsock_data);
 -if (err != 0)
 -return -1;
 +return err == 0 ? 0 : -1;
  }
  #endif

Committed.

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] FYI: fixes to events code for mingw

2008-10-24 Thread Daniel P. Berrange
FYI, I just committed the following patch to remove a couple of unneccessary
includes of sys/poll.h, and disable the event-test demo on platforms which
lack sys/poll.h  This makes the mingw builds work again

Regards,
Daniel

Index: configure.in
===
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.176
diff -u -p -r1.176 configure.in
--- configure.in23 Oct 2008 13:18:18 -  1.176
+++ configure.in24 Oct 2008 13:08:15 -
@@ -70,7 +70,7 @@ dnl Availability of various common funct
 AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity getuid getgid])
 
 dnl Availability of various common headers (non-fatal if missing).
-AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h 
sys/wait.h winsock2.h sched.h termios.h])
+AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h 
sys/wait.h winsock2.h sched.h termios.h sys/poll.h])
 
 dnl Where are the XDR functions?
 dnl If portablexdr is installed, prefer that.
Index: examples/domain-events/events-c/event-test.c
===
RCS file: /data/cvs/libvirt/examples/domain-events/events-c/event-test.c,v
retrieving revision 1.1
diff -u -p -r1.1 event-test.c
--- examples/domain-events/events-c/event-test.c23 Oct 2008 13:18:18 
-  1.1
+++ examples/domain-events/events-c/event-test.c24 Oct 2008 13:08:15 
-
@@ -1,6 +1,9 @@
 #include config.h
+
 #include stdio.h
 #include string.h
+
+#if HAVE_SYS_POLL_H
 #include sys/types.h
 #include sys/poll.h
 #include libvirt/libvirt.h
@@ -259,3 +262,9 @@ int main(int argc, char **argv)
 return 0;
 }
 
+#else
+int main(void) {
+printf(event-test program not available without sys/poll.h support\n);
+return 1;
+}
+#endif
Index: src/libvirt.c
===
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.162
diff -u -p -r1.162 libvirt.c
--- src/libvirt.c   24 Oct 2008 08:55:13 -  1.162
+++ src/libvirt.c   24 Oct 2008 13:08:16 -
@@ -16,7 +16,6 @@
 #include string.h
 #include sys/types.h
 #include sys/stat.h
-#include sys/poll.h
 #include unistd.h
 #include assert.h
 #ifdef HAVE_SYS_WAIT_H
Index: src/remote_internal.c
===
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.89
diff -u -p -r1.89 remote_internal.c
--- src/remote_internal.c   23 Oct 2008 13:18:18 -  1.89
+++ src/remote_internal.c   24 Oct 2008 13:08:16 -
@@ -34,7 +34,6 @@
 #include signal.h
 #include sys/types.h
 #include sys/stat.h
-#include sys/poll.h
 #include fcntl.h
 
 #ifdef HAVE_SYS_WAIT_H

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] FYI: fixes to events code for mingw

2008-10-24 Thread Daniel Veillard
On Fri, Oct 24, 2008 at 02:10:53PM +0100, Daniel P. Berrange wrote:
 FYI, I just committed the following patch to remove a couple of unneccessary
 includes of sys/poll.h, and disable the event-test demo on platforms which
 lack sys/poll.h  This makes the mingw builds work again

  okay

 +++ src/libvirt.c 24 Oct 2008 13:08:16 -
 @@ -16,7 +16,6 @@
  #include string.h
  #include sys/types.h
  #include sys/stat.h
 -#include sys/poll.h

  since we don't use poll anywhere there i assume it's a leftover from
the early event work.

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
[EMAIL PROTECTED]  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] PATCH: Remove util-lib file and replace with libvirt_util.la

2008-10-24 Thread Daniel P. Berrange
We've currently got a slightly nasty hack where some of the stuff from
util.c is split into  a util-lib.c file so it can be compiled twice,
once for libvirt.la, and second for virsh, without exporting it in our
public API. I'm trying to clean up the code / file deps and build stuff
in preparation of dlopen() support of drivers.  We also have a bunch of
stuff in util.a that is exported unofficially in the ABI. 

This patch demonstrates a different approach, putting the util-lib.c code
back into util.c. We then define a libtool convenience library covering
a bunch of our generic common code, that is linked to both libvirt.la
and virsh.  This also lets us remove most of the secret exports from
util.c.

The main change is that a little more code is statically linked into
virsh binary itself. Personally I don't think this is a huge problem.
Another possible approach though could be to create a real libvirt-common.so
file which gets installed into /usr/lib, but is explicitly not preserving
ABI. We could enforce this by using a version script to encode a version
number against every symbol. This would mean anyone linking to the 
libvirt-common.so would be forced to relink on every new update - which
would be such a PITA only in-tree programs like virsh  libvirtd would
do it.

Daniel

diff -r 5bd402f3762e configure.in
--- a/configure.in  Fri Oct 24 14:13:53 2008 +0100
+++ b/configure.in  Fri Oct 24 14:14:07 2008 +0100
@@ -671,6 +671,8 @@
 
 with_storage_dir=yes
 if test $with_libvirtd = no; then
+  with_qemu=no
+  with_lxc=no
   with_storage_dir=no
   with_storage_fs=no
   with_storage_lvm=no
diff -r 5bd402f3762e qemud/Makefile.am
--- a/qemud/Makefile.am Fri Oct 24 14:13:53 2008 +0100
+++ b/qemud/Makefile.am Fri Oct 24 14:14:07 2008 +0100
@@ -9,8 +9,7 @@
remote_dispatch_prototypes.h\
remote_dispatch_localvars.h \
remote_dispatch_proc_switch.h   \
-   remote_protocol.h remote_protocol.c \
-   $(srcdir)/../src/util-lib.c
+   remote_protocol.h remote_protocol.c
 
 AVAHI_SOURCES =\
mdns.c mdns.h
@@ -88,7 +87,7 @@
$(POLKIT_LIBS)
 
 libvirtd_DEPENDENCIES = ../src/libvirt.la
-libvirtd_LDADD = ../src/libvirt.la ../gnulib/lib/libgnu.la
+libvirtd_LDADD = ../src/libvirt.la ../src/libvirt_util.la 
../gnulib/lib/libgnu.la
 
 if HAVE_POLKIT
 policydir = $(datadir)/PolicyKit/policy
diff -r 5bd402f3762e src/Makefile.am
--- a/src/Makefile.am   Fri Oct 24 14:13:53 2008 +0100
+++ b/src/Makefile.am   Fri Oct 24 14:14:07 2008 +0100
@@ -37,21 +37,30 @@
 
 lib_LTLIBRARIES = libvirt.la
 
+noinst_LTLIBRARIES = libvirt_util.la
+
 # These files are not related to driver APIs. Simply generic
 # helper APIs for various purposes
-GENERIC_LIB_SOURCES =  \
-   bridge.c bridge.h   \
+UTIL_SOURCES = \
buf.c buf.h \
conf.c conf.h   \
event.c event.h \
-   iptables.c iptables.h   \
memory.c memory.h   \
qparams.c qparams.h \
-   stats_linux.c stats_linux.h \
uuid.c uuid.h   \
util.c util.h   \
virterror.c \
xml.c xml.h
+
+DRIVER_SOURCES =   \
+   driver.h\
+   hash.c hash.h   \
+   internal.h  \
+   libvirt.c   \
+   bridge.c bridge.h   \
+   iptables.c iptables.h   \
+   stats_linux.c stats_linux.h
+
 
 # Domain driver generic impl APIs
 DOMAIN_CONF_SOURCES =  \
@@ -147,14 +156,13 @@
 # First deal with sources usable in non-daemon context
 
 libvirt_la_SOURCES =   \
-   driver.h\
-   hash.c hash.h   \
-   internal.h  \
-   libvirt.c   \
-   $(GENERIC_LIB_SOURCES)  \
+   $(DRIVER_SOURCES)   \
$(DOMAIN_CONF_SOURCES)  \
$(NETWORK_CONF_SOURCES)  

Re: [libvirt] FYI: fixes to events code for mingw

2008-10-24 Thread Ben Guthro


Daniel Veillard wrote on 10/24/2008 09:26 AM:
   since we don't use poll anywhere there i assume it's a leftover from
 the early event work.

Yes, this was mistakenly left in from prior versions of the patch
 

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] mingw warnings

2008-10-24 Thread Jim Meyering
I've been building with mingw to make sure that my gnulib-upgrade-and-extend
patch doesn't break anything and found some compiler warnings.
I fixed most of them, but this one is ugly:

  ../qemud/remote_protocol.c:317: warning: assignment from incompatible pointer 
type
  ../qemud/remote_protocol.c:346: warning: assignment from incompatible pointer 
type

That's due to the fact that the mingw xdr.h header,
/usr/i686-pc-mingw32/sys-root/mingw/include/rpc/xdr.h, defines this

#define XDR_INLINE(xdrs, len)   \
(*(xdrs)-x_ops-x_inline)(xdrs, len)

and has an x_inline member of type long*,

typedef struct {
enum xdr_op x_op;   /* operation; fast additional param */
struct xdr_ops {
bool_t  (*x_getlong)(); /* get a long from underlying stream */
bool_t  (*x_putlong)(); /* put a long to  */
bool_t  (*x_getbytes)();/* get some bytes from  */
bool_t  (*x_putbytes)();/* put some bytes to  */
u_int   (*x_getpostn)();/* returns bytes off from beginning */
bool_t  (*x_setpostn)();/* lets you reposition the stream */
long *  (*x_inline)();  /* buf quick ptr to buffered data */

while we're used to one with type matching buf: int32_t*:

If you're serious about getting rid of warnings even on mingw,
here's one approach:

diff --git a/qemud/remote_protocol.c b/qemud/remote_protocol.c
index 68e9696..c8cf504 100644
--- a/qemud/remote_protocol.c
+++ b/qemud/remote_protocol.c
@@ -314,7 +314,7 @@ xdr_remote_node_get_info_ret (XDR *xdrs, 
remote_node_get_info_ret *objp)
  return FALSE;
  if (!xdr_quad_t (xdrs, objp-memory))
  return FALSE;
-buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
+buf = (void*)XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
 if (buf == NULL) {
  if (!xdr_int (xdrs, objp-cpus))
  return FALSE;
@@ -343,7 +343,7 @@ xdr_remote_node_get_info_ret (XDR *xdrs, 
remote_node_get_info_ret *objp)
  return FALSE;
  if (!xdr_quad_t (xdrs, objp-memory))
  return FALSE;
-buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
+buf = (void*)XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT);
 if (buf == NULL) {
  if (!xdr_int (xdrs, objp-cpus))
  return FALSE;

Better would be to fix the decl in xdr.h, but probably not feasible.
Alternatively, redefine XDR_INLINE for mingw, adding the void* cast in that.
But that means peeking inside (and copying) the current definition,
so I prefer the above.

So I'm leaning towards using the patch above.

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] mingw warnings

2008-10-24 Thread Daniel P. Berrange
On Fri, Oct 24, 2008 at 07:50:13PM +0200, Jim Meyering wrote:
 I've been building with mingw to make sure that my gnulib-upgrade-and-extend
 patch doesn't break anything and found some compiler warnings.
 I fixed most of them, but this one is ugly:

[snip]

 Better would be to fix the decl in xdr.h, but probably not feasible.
 Alternatively, redefine XDR_INLINE for mingw, adding the void* cast in that.
 But that means peeking inside (and copying) the current definition,
 so I prefer the above.

I'd go for fixing XDR_INLINE, since this comes from portablexdr which
is a package Rich maintains especially for libvirt's use :-)

  http://et.redhat.com/~rjones/portablexdr/

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] fix JNI flags in libvirt-java build

2008-10-24 Thread David Lively
This tiny patch adds $LIBVIRT_CFLAGS to the flags used when compiling
the Java Native Interface C code in libvirt-java.  This allows one to
build, for example, against a local (non-installed) libvirt tree.

Dave


commit dfd82305b4c871244dff2f9057e8b73a043c0213
Author: David Lively [EMAIL PROTECTED]
Date:   Fri Oct 3 09:28:38 2008 -0400

vi-patch: fix-jni-cflags

Include LIBVIRT_CFLAGS in the CFLAGS used for the libvirt JNI sources.

diff --git a/src/jni/Makefile.am b/src/jni/Makefile.am
index 8feed24..ad1158a 100644
--- a/src/jni/Makefile.am
+++ b/src/jni/Makefile.am
@@ -52,7 +52,7 @@ libvirt_jni_la_SOURCES = \
 nodist_libvirt_jni_la_SOURCES = $(GENERATED)
 libvirt_jni_la_LIBADD = $(LIBVIRT_LIBS)
 libvirt_jni_la_LDFLAGS = -version-info  @JNI_VERSION_INFO@
-libvirt_jni_la_CFLAGS = @JNI_CFLAGS@
+libvirt_jni_la_CFLAGS = $(LIBVIRT_CFLAGS) @JNI_CFLAGS@
 
 
 CLEANFILES = \
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] fix memory leak in __virStringListFree

2008-10-24 Thread David Lively
Currently __virStringListFree is freeing only the list nodes, but not
the strings on the list (and neither is anyone else freeing these).
This small patch fixes that, and documents the two __virStringList
functions.

Dave

diff --git a/src/libvirt.c b/src/libvirt.c
index 8fd594b..bee98d2 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5308,8 +5308,18 @@ virStorageVolGetPath(virStorageVolPtr vol)
 
 
 
-/* Not for public use.  Combines the elements of a virStringList
+/**
+ * __virStringListJoin:
+ * @list: the StringList
+ * @pre: string to prepend to the result string
+ * @post: string to append to the result string
+ * @sep: string to separate the list elements
+ *
+ * Internal function to combine the elements of a virStringList
  * into a single string.
+ *
+ * Returns the resulting string, which the caller is responsible
+ * for freeing when they're done with it.  Returns NULL on error.
  */
 char *__virStringListJoin(const virStringList *list, const char *pre,
 const char *post, const char *sep)
@@ -5338,10 +5348,17 @@ char *__virStringListJoin(const virStringList *list, const char *pre,
 }
 
 
+/**
+ * __virStringListFree:
+ * @list: the StringList to free
+ *
+ * Internal function to free the memory used by a string list.
+ */
 void __virStringListFree(virStringList *list)
 {
 while (list) {
 virStringList *p = list-next;
+VIR_FREE(list-val);
 VIR_FREE(list);
 list = p;
 }
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] Re: [PATCH 7/6] host (node) device enumeration - Java bindings

2008-10-24 Thread David Lively
This patch (for libvirt-java) implements Java bindings for the node
device enumeration functions.

Dave

diff --git a/src/Makefile.am b/src/Makefile.am
index 5200c1d..466a0eb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,7 @@ java_libvirt_source_files = \
   org/libvirt/Error.java \
   org/libvirt/Network.java \
   org/libvirt/NodeInfo.java \
+  org/libvirt/NodeDevice.java \
   org/libvirt/SchedBooleanParameter.java \
   org/libvirt/SchedDoubleParameter.java \
   org/libvirt/SchedIntParameter.java \
diff --git a/src/jni/Makefile.am b/src/jni/Makefile.am
index 6e19384..8feed24 100644
--- a/src/jni/Makefile.am
+++ b/src/jni/Makefile.am
@@ -10,7 +10,8 @@ GENERATED = \
   org_libvirt_StoragePool.h \
   org_libvirt_StorageVol_Type.h \
   org_libvirt_StorageVol_DeleteFlags.h \
-  org_libvirt_StorageVol.h
+  org_libvirt_StorageVol.h \
+  org_libvirt_NodeDevice.h
 
 BUILT_SOURCES = $(GENERATED)
 
@@ -31,6 +32,9 @@ org_libvirt_StoragePool.h org_libvirt_StoragePool_BuildFlags.h org_libvirt_Stora
 org_libvirt_StorageVol.h org_libvirt_StorageVol_Type.h org_libvirt_StorageVol_DeleteFlags.h : $(JAVA_CLASS_ROOT)/org/libvirt/StorageVol.class
 	$(JAVAH) -classpath $(JAVA_CLASS_ROOT) org.libvirt.StorageVol
 
+org_libvirt_NodeDevice.h : $(JAVA_CLASS_ROOT)/org/libvirt/NodeDevice.class
+	$(JAVAH) -classpath $(JAVA_CLASS_ROOT) org.libvirt.NodeDevice
+
 lib_LTLIBRARIES = libvirt_jni.la
 libvirt_jni_la_SOURCES = \
   org_libvirt_Network.c \
@@ -38,6 +42,7 @@ libvirt_jni_la_SOURCES = \
   org_libvirt_Domain.c \
   org_libvirt_StoragePool.c \
   org_libvirt_StorageVol.c \
+  org_libvirt_NodeDevice.c \
   generic.h \
   ErrorHandler.c \
   ErrorHandler.h \
diff --git a/src/jni/generic.h b/src/jni/generic.h
index 347c076..e1da179 100644
--- a/src/jni/generic.h
+++ b/src/jni/generic.h
@@ -70,6 +70,16 @@
 	return retval;
 
 /*
+ * Generic macro with a VIROBJ and a String and an int arguments
+ * returning an int
+ */
+#define GENERIC_VIROBJ_STRING_INT__INT(ENV, OBJ, VIROBJ, J_STR, ARG1, VIRFUNC1) \
+	const char *str=(*ENV)-GetStringUTFChars(ENV, J_STR, NULL); \
+	jint retval = (jlong)VIRFUNC1(VIROBJ, str, ARG1);	 \
+	(*ENV)-ReleaseStringUTFChars(ENV, J_STR, str);		 \
+	return retval;
+
+/*
  * Generic macro with a VIROBJ and an String arguments returning a virObject
  * (for functions like *CreateXML* that take no flags)
  */
@@ -81,15 +91,14 @@
 
 /*
  * Generic macro with a VIROBJ and String and int arguments returning a
- * virObject (for functions like *CreateXML* that take a flags)
+ * virObject
  */
-#define GENERIC_VIROBJ_STRING_INT__VIROBJ(ENV, OBJ, VIROBJ, J_XMLDESC, FLAGS, VIRFUNC1) \
-	const char *xmlDesc=(*ENV)-GetStringUTFChars(ENV, J_XMLDESC, NULL); \
-	jlong retval = (jlong)VIRFUNC1(VIROBJ, xmlDesc, FLAGS);		\
-	(*ENV)-ReleaseStringUTFChars(ENV, J_XMLDESC, xmlDesc);		\
+#define GENERIC_VIROBJ_STRING_INT__VIROBJ(ENV, OBJ, VIROBJ, J_STR, ARG1, VIRFUNC1) \
+	const char *str=(*ENV)-GetStringUTFChars(ENV, J_STR, NULL);	\
+	jlong retval = (jlong)VIRFUNC1(VIROBJ, str, ARG1);		\
+	(*ENV)-ReleaseStringUTFChars(ENV, J_STR, str);			\
 	return retval;
 
-
 /*
  * Generic macro for the *getAutoStart functions
  */
@@ -150,6 +159,61 @@
 	return j_names;
 
 /*
+ * Generic macro for the *List* functions that return an array of strings
+ * and take a single int arg.
+ * VIRFUNC1 is the *List* function
+ * VIRFUNC2 is the corresponding *NumOf* function
+ */
+#define GENERIC_INT__LIST_STRINGARRAY(ENV, OBJ, VIROBJ, JINT, VF1, VF2) \
+	int maxnames;			\
+	char **names;			\
+	int c;\
+	jobjectArray j_names=NULL;	\
+	if((maxnames = VF2(VIROBJ, JINT))0)\
+		return NULL;		\
+	names= (char**)calloc(maxnames, sizeof(char*));			\
+	if(VF1(VIROBJ, names, maxnames, JINT)=0){			\
+		j_names= (jobjectArray)(*ENV)-NewObjectArray(ENV, maxnames, \
+			(*ENV)-FindClass(ENV,java/lang/String),	\
+			(*ENV)-NewStringUTF(ENV,));			\
+		for(c=0; cmaxnames; c++){\
+			(*ENV)-SetObjectArrayElement(ENV, j_names, c,	\
+			(*ENV)-NewStringUTF(ENV, names[c]));		\
+		}			\
+	}\
+	free(names);			\
+	return j_names;
+
+/*
+ * Generic macro for the *List* functions that return an array of strings
+ * and take a single string arg and an int arg.
+ * VIRFUNC1 is the *List* function
+ * VIRFUNC2 is the corresponding *NumOf* function
+ */
+#define GENERIC_STRING_INT__LIST_STRINGARRAY(ENV, OBJ, VIROBJ, J_STR, JINT, VF1, VF2) \
+	int maxnames;			\
+	char **names;			\
+	int c;\
+	jobjectArray j_names=NULL;	\
+	const char *str = (*ENV)-GetStringUTFChars(ENV, J_STR, NULL);	\
+	if((maxnames = VF2(VIROBJ, str, JINT))0)			\
+		goto cleanup;		\
+	names= (char**)calloc(maxnames, sizeof(char*));			\
+	if(VF1(VIROBJ, str, names, maxnames, JINT)=0){			\
+		j_names= (jobjectArray)(*ENV)-NewObjectArray(ENV, maxnames, \
+			(*ENV)-FindClass(ENV,java/lang/String),	\
+			(*ENV)-NewStringUTF(ENV,));			\
+		for(c=0; cmaxnames; c++){\
+			(*ENV)-SetObjectArrayElement(ENV, j_names, c,	\
+