1332 }
1333 strcpy(inpath, path);
1334 int count = 1;
1335 char* p = strchr(inpath, psepchar);
1336 // Get a count of elements to allocate memory
1337 while (p != NULL) {
1338 count++;
1339 p++;
1340 p = strchr(p, psepchar);
1341 }
1342 char** opath = (char**) NEW_C_HEAP_ARRAY(char*, count, mtInternal);
1343 if (opath == NULL) {
1344 return NULL;
1345 }
1346
1347 // do the actual splitting
1348 p = inpath;
1349 for (int i = 0 ; i < count ; i++) {
1350 size_t len = strcspn(p, os::path_separator());
1351 if (len > JVM_MAXPATHLEN) {
1352 return NULL;
1353 }
1354 // allocate the string and add terminator storage
1355 char* s = (char*)NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
1356 if (s == NULL) {
1357 return NULL;
1358 }
1359 strncpy(s, p, len);
1360 s[len] = '\0';
1361 opath[i] = s;
1362 p += len + 1;
1363 }
1364 FREE_C_HEAP_ARRAY(char, inpath);
1365 *n = count;
1366 return opath;
1367 }
1368
1369 // Returns true if the current stack pointer is above the stack shadow
1370 // pages, false otherwise.
1371 bool os::stack_shadow_pages_available(Thread *thread, const methodHandle& method, address sp) {
1372 if (!thread->is_Java_thread()) return false;
|
1332 }
1333 strcpy(inpath, path);
1334 int count = 1;
1335 char* p = strchr(inpath, psepchar);
1336 // Get a count of elements to allocate memory
1337 while (p != NULL) {
1338 count++;
1339 p++;
1340 p = strchr(p, psepchar);
1341 }
1342 char** opath = (char**) NEW_C_HEAP_ARRAY(char*, count, mtInternal);
1343 if (opath == NULL) {
1344 return NULL;
1345 }
1346
1347 // do the actual splitting
1348 p = inpath;
1349 for (int i = 0 ; i < count ; i++) {
1350 size_t len = strcspn(p, os::path_separator());
1351 if (len > JVM_MAXPATHLEN) {
1352 //return NULL;
1353 }
1354 // allocate the string and add terminator storage
1355 char* s = (char*)NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
1356 if (s == NULL) {
1357 return NULL;
1358 }
1359 strncpy(s, p, len);
1360 s[len] = '\0';
1361 opath[i] = s;
1362 p += len + 1;
1363 }
1364 FREE_C_HEAP_ARRAY(char, inpath);
1365 *n = count;
1366 return opath;
1367 }
1368
1369 // Returns true if the current stack pointer is above the stack shadow
1370 // pages, false otherwise.
1371 bool os::stack_shadow_pages_available(Thread *thread, const methodHandle& method, address sp) {
1372 if (!thread->is_Java_thread()) return false;
|