mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 09:04:41 +02:00
8230168: Use ClasspathStream for FileMapInfo::create_path_array
Reviewed-by: lfoltan, fparain
This commit is contained in:
parent
f85fe3a3d6
commit
11ca73d744
5 changed files with 111 additions and 68 deletions
|
@ -69,6 +69,7 @@
|
|||
#include "runtime/vm_version.hpp"
|
||||
#include "services/management.hpp"
|
||||
#include "services/threadService.hpp"
|
||||
#include "utilities/classpathStream.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#include "utilities/hashtable.inline.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
@ -168,41 +169,6 @@ static const char* get_jimage_version_string() {
|
|||
return (const char*)version_string;
|
||||
}
|
||||
|
||||
class ClasspathStream : public StackObj {
|
||||
const char* _class_path;
|
||||
int _len;
|
||||
int _start;
|
||||
int _end;
|
||||
|
||||
public:
|
||||
ClasspathStream(const char* class_path) {
|
||||
_class_path = class_path;
|
||||
_len = (int)strlen(class_path);
|
||||
_start = 0;
|
||||
_end = 0;
|
||||
}
|
||||
|
||||
bool has_next() {
|
||||
return _start < _len;
|
||||
}
|
||||
|
||||
const char* get_next() {
|
||||
while (_class_path[_end] != '\0' && _class_path[_end] != os::path_separator()[0]) {
|
||||
_end++;
|
||||
}
|
||||
int path_len = _end - _start;
|
||||
char* path = NEW_RESOURCE_ARRAY(char, path_len + 1);
|
||||
strncpy(path, &_class_path[_start], path_len);
|
||||
path[path_len] = '\0';
|
||||
|
||||
while (_class_path[_end] == os::path_separator()[0]) {
|
||||
_end++;
|
||||
}
|
||||
_start = _end;
|
||||
return path;
|
||||
}
|
||||
};
|
||||
|
||||
bool ClassLoader::string_ends_with(const char* str, const char* str_to_find) {
|
||||
size_t str_len = strlen(str);
|
||||
size_t str_to_find_len = strlen(str_to_find);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue