This is the mail archive of the
mailing list for the Java project.
Re: Patch for Review: JvGetStringUTF and JvTempCString
- From: Bryce McKinlay <bryce at mckinlay dot net dot nz>
- To: gnustuff at thisiscool dot com,tromey at redhat dot com,java-patches at gcc dot gnu dot org
- Date: Sun, 10 Aug 2003 15:38:18 +1200
- Subject: Re: Patch for Review: JvGetStringUTF and JvTempCString
On Sunday, Aug 10, 2003, at 14:50 Pacific/Auckland, Mohan Embar wrote:
Mohan> * gcj/cni.h: Added function JvGetStringUTF (puts and null
Mohan> terminates a jstring into a character buffer) and class
Mohan> JvTempCString (helper class for getting a temporary C string
Mohan> from a jstring)
Sorry for yet another go around on this...
I'm not ready to put this class in cni.h yet. How about jvm.h?
I coded this all up, but jvm.h is internal to libgcj and doesn't
end up in the final installation :(. This would mean that this helper
class wouldn't be usable anywhere other than within libgcj.
Sorry if I missed earlier discussion on this. What is the rationale for
adding these? I don't like JvGetStringUTF because it is unsafe - it
knows nothing about the size of the buffer it is writing into. I think
a variant which accepts the buffer size as an argument, and makes sure
not to overrun it, would be better.
As for JvTempCString, do you have an example of when this is needed?
What is wrong with, in client code, simply using JvGetStringUTF into a
stack allocated buffer? I think it is better to keep CNI simple unless
there is a compelling reason to have this.
What about gcj/javaprims.h?
gcj/cni.h is the place to put things which are to be part of the public