Checking in for Ulrich Drepper. Bug #99246. r=beard, sr=brendan

This commit is contained in:
blizzard%redhat.com 2001-09-12 03:19:08 +00:00
Родитель df42254a93
Коммит 7576f9d61f
2 изменённых файлов: 18 добавлений и 3 удалений

Просмотреть файл

@ -2406,7 +2406,7 @@ dnl ========================================================
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(random strerror lchown fchmod snprintf localtime_r statvfs memmove rint)
AC_CHECK_FUNCS(nl_langinfo)
AC_CHECK_FUNCS(nl_langinfo strtok_r)
AC_LANG_CPLUSPLUS
AC_CACHE_CHECK(

Просмотреть файл

@ -393,6 +393,18 @@ standard_java_packages[] = {
{NULL, NULL, 0, 0}
};
/*
* On systems which provide strtok_r we'll use that function to avoid
* problems with non-thread-safety.
*/
#if HAVE_STRTOK_R
# define STRTOK_1ST(str, seps, res) strtok_r (str, seps, &res)
# define STRTOK_OTHER(seps, res) strtok_r (res, seps, &res)
#else
# define STRTOK_1ST(str, seps, res) strtok (str, seps)
# define STRTOK_OTHER(seps, res) strtok (NULL, seps)
#endif
/*
* Pre-define a hierarchy of JavaPackage objects.
* Pre-defining a Java package at initialization time is not necessary, but
@ -414,6 +426,9 @@ pre_define_java_packages(JSContext *cx, JSObject *global_obj,
/* Iterate over all pre-defined Java packages */
for (package_def = predefined_packages; package_def->name; package_def++) {
#if HAVE_STRTOK_R
char *nextstr;
#endif
package_name = path = NULL;
parent_obj = global_obj;
@ -423,7 +438,7 @@ pre_define_java_packages(JSContext *cx, JSObject *global_obj,
/* Walk the chain of JavaPackage objects to get to the parent of the
rightmost sub-package in the fully-qualified package name. */
for (simple_name = strtok(package_name, "."); simple_name /*1*/; simple_name = strtok(NULL, ".")) {
for (simple_name = STRTOK_1ST(package_name, ".", nextstr); simple_name /*1*/; simple_name = STRTOK_OTHER(".", nextstr)) {
jsval v;
if (!simple_name) {
@ -444,7 +459,7 @@ pre_define_java_packages(JSContext *cx, JSObject *global_obj,
/* New package objects should only be created at the terminal
sub-package in a fully-qualified package-name */
if (strtok(NULL, ".")) {
if (STRTOK_OTHER(".", nextstr)) {
JS_ReportErrorNumber(cx, jsj_GetErrorMessage, NULL,
JSJMSG_BAD_PACKAGE_PREDEF,
package_def->name);