natCore.cc (create): Use __builtin_alloca, and compute correct length of UTF-8 encoded name.
* gnu/gcj/natCore.cc (create): Use __builtin_alloca, and compute correct length of UTF-8 encoded name. Strip leading `/'. (_Jv_RegisterResource): Use _Jv_Malloc. From-SVN: r52744
This commit is contained in:
parent
a62d375fda
commit
0df9cfc799
@ -1,3 +1,9 @@
|
||||
2002-04-24 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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user