3474 // skip over all the leading empty paths |
3474 // skip over all the leading empty paths |
3475 while (*src == separator) { |
3475 while (*src == separator) { |
3476 src ++; |
3476 src ++; |
3477 } |
3477 } |
3478 |
3478 |
3479 char* copy = AllocateHeap(strlen(src) + 1, mtInternal); |
3479 char* copy = os::strdup(src, mtInternal); |
3480 strncpy(copy, src, strlen(src) + 1); |
|
3481 |
3480 |
3482 // trim all trailing empty paths |
3481 // trim all trailing empty paths |
3483 for (char* tail = copy + strlen(copy) - 1; tail >= copy && *tail == separator; tail--) { |
3482 for (char* tail = copy + strlen(copy) - 1; tail >= copy && *tail == separator; tail--) { |
3484 *tail = '\0'; |
3483 *tail = '\0'; |
3485 } |
3484 } |
3854 os::jvm_path(jvm_path, sizeof(jvm_path)); |
3853 os::jvm_path(jvm_path, sizeof(jvm_path)); |
3855 char *end = strrchr(jvm_path, *os::file_separator()); |
3854 char *end = strrchr(jvm_path, *os::file_separator()); |
3856 if (end != NULL) *end = '\0'; |
3855 if (end != NULL) *end = '\0'; |
3857 size_t jvm_path_len = strlen(jvm_path); |
3856 size_t jvm_path_len = strlen(jvm_path); |
3858 size_t file_sep_len = strlen(os::file_separator()); |
3857 size_t file_sep_len = strlen(os::file_separator()); |
3859 shared_archive_path = NEW_C_HEAP_ARRAY(char, jvm_path_len + |
3858 const size_t len = jvm_path_len + file_sep_len + 20; |
3860 file_sep_len + 20, mtInternal); |
3859 shared_archive_path = NEW_C_HEAP_ARRAY(char, len, mtInternal); |
3861 if (shared_archive_path != NULL) { |
3860 if (shared_archive_path != NULL) { |
3862 strncpy(shared_archive_path, jvm_path, jvm_path_len + 1); |
3861 jio_snprintf(shared_archive_path, len, "%s%sclasses.jsa", |
3863 strncat(shared_archive_path, os::file_separator(), file_sep_len); |
3862 jvm_path, os::file_separator()); |
3864 strncat(shared_archive_path, "classes.jsa", 11); |
|
3865 } |
3863 } |
3866 } else { |
3864 } else { |
3867 shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(SharedArchiveFile) + 1, mtInternal); |
3865 shared_archive_path = os::strdup(SharedArchiveFile, mtInternal); |
3868 if (shared_archive_path != NULL) { |
|
3869 strncpy(shared_archive_path, SharedArchiveFile, strlen(SharedArchiveFile) + 1); |
|
3870 } |
|
3871 } |
3866 } |
3872 return shared_archive_path; |
3867 return shared_archive_path; |
3873 } |
3868 } |
3874 |
3869 |
3875 #ifndef PRODUCT |
3870 #ifndef PRODUCT |