diff options
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/gnu/gcj/natCore.cc | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 85116e6f008..8504ee9c49b 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2002-04-22 Tom Tromey <tromey@redhat.com> + + * gnu/gcj/natCore.cc (create): Use __builtin_alloca, and compute + correct length of UTF-8 encoded name. Strip leading `/'. + (_Jv_RegisterResource): Use _Jv_Malloc. + 2002-04-23 Adam Megacz <adam@xwt.org> * win32.cc, include/win32.cc (backtrace): Added this function diff --git a/libjava/gnu/gcj/natCore.cc b/libjava/gnu/gcj/natCore.cc index 8e7a0240527..75a7ad05ae1 100644 --- a/libjava/gnu/gcj/natCore.cc +++ b/libjava/gnu/gcj/natCore.cc @@ -1,6 +1,6 @@ // natCore -- C++ side of Core -/* Copyright (C) 2001 Free Software Foundation +/* Copyright (C) 2001, 2002 Free Software Foundation This file is part of libgcj. @@ -40,7 +40,7 @@ void _Jv_RegisterResource (void *vptr) // These are permanent data structures for now. This routine is // called from a static constructor, so we shouldn't depend on too // much existing infrastructure. - core_chain *cc = (core_chain *) malloc (sizeof (core_chain)); + core_chain *cc = (core_chain *) _Jv_Malloc (sizeof (core_chain)); cc->name_length = ((int *)rptr)[0]; cc->data_length = ((int *)rptr)[1]; @@ -56,10 +56,18 @@ void _Jv_RegisterResource (void *vptr) gnu::gcj::Core * gnu::gcj::Core::create (jstring name) { - char buf[name->length() + 1]; + char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (name) + 1); jsize total = JvGetStringUTFRegion (name, 0, name->length(), buf); buf[total] = '\0'; + // Usually requests here end up as an absolute URL. We strip the + // initial `/'. + if (buf[0] == '/') + { + ++buf; + --total; + } + core_chain *node = root; while (node) |