[RFA/JVMTI] Implement GetErrorName
Keith Seitz
keiths@redhat.com
Wed Sep 20 00:23:00 GMT 2006
Tom Tromey wrote:
> One oddity...
>
> Keith> + jstring string = _Jv_NewStringUTF (name);
> Keith> + jlong len = _Jv_GetStringUTFLength (string);
> Keith> + *name_ptr = (char *) _Jv_Malloc (len + 1);
> Keith> + _Jv_GetStringUTFRegion (string, 0, string->length (), *name_ptr);
> Keith> + name_ptr[len] = '\0';
>
> This is pretty roundabout. You can just use strcpy.
> We already assume that the runtime charset for C string constants is
> ASCII.
I think I stole that from jni.cc or some such. My concern was for
unicode, but alas, as is plainly visible (to all but me at the time),
all the strings in this function are just simple ASCII. Doh!
I've corrected this to use vanilla strcpy. I've also included a little
test for it.
Look better?
Keith
ChangeLog
2006-09-19 Keith Seitz <keiths@redhat.com>
* jvmti.cc (_Jv_JVMTI_GetErrorName): New function.
(_Jv_JVMTI_Interface): Define GetErrorName member.
* testsuite/libjava.jvmti/geterrorname.java: New file.
* testsuite/libjava.jvmti/geterrorname.out: New file.
* testsuite/libjava.jvmti/natgeterrorname.cc: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jvmti-geterrorname-revised.patch
Type: text/x-patch
Size: 10716 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20060920/9e50f455/attachment.bin>
More information about the Java-patches
mailing list