+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
// natCore -- C++ side of Core
-/* Copyright (C) 2001 Free Software Foundation
+/* Copyright (C) 2001, 2002 Free Software Foundation
This file is part of libgcj.
// 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];
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)