146 ClassPathEntry* ClassLoader::_last_app_classpath_entry = NULL;
147 ClassPathEntry* ClassLoader::_module_path_entries = NULL;
148 ClassPathEntry* ClassLoader::_last_module_path_entry = NULL;
149 SharedPathsMiscInfo* ClassLoader::_shared_paths_misc_info = NULL;
150 #endif
151
152 // helper routines
153 bool string_starts_with(const char* str, const char* str_to_find) {
154 size_t str_len = strlen(str);
155 size_t str_to_find_len = strlen(str_to_find);
156 if (str_to_find_len > str_len) {
157 return false;
158 }
159 return (strncmp(str, str_to_find, str_to_find_len) == 0);
160 }
161
162 static const char* get_jimage_version_string() {
163 static char version_string[10] = "";
164 if (version_string[0] == '\0') {
165 jio_snprintf(version_string, sizeof(version_string), "%d.%d",
166 Abstract_VM_Version::vm_major_version(), Abstract_VM_Version::vm_minor_version());
167 }
168 return (const char*)version_string;
169 }
170
171 bool ClassLoader::string_ends_with(const char* str, const char* str_to_find) {
172 size_t str_len = strlen(str);
173 size_t str_to_find_len = strlen(str_to_find);
174 if (str_to_find_len > str_len) {
175 return false;
176 }
177 return (strncmp(str + (str_len - str_to_find_len), str_to_find, str_to_find_len) == 0);
178 }
179
180 // Used to obtain the package name from a fully qualified class name.
181 // It is the responsibility of the caller to establish a ResourceMark.
182 const char* ClassLoader::package_from_name(const char* const class_name, bool* bad_class_name) {
183 if (class_name == NULL) {
184 if (bad_class_name != NULL) {
185 *bad_class_name = true;
186 }
|
146 ClassPathEntry* ClassLoader::_last_app_classpath_entry = NULL;
147 ClassPathEntry* ClassLoader::_module_path_entries = NULL;
148 ClassPathEntry* ClassLoader::_last_module_path_entry = NULL;
149 SharedPathsMiscInfo* ClassLoader::_shared_paths_misc_info = NULL;
150 #endif
151
152 // helper routines
153 bool string_starts_with(const char* str, const char* str_to_find) {
154 size_t str_len = strlen(str);
155 size_t str_to_find_len = strlen(str_to_find);
156 if (str_to_find_len > str_len) {
157 return false;
158 }
159 return (strncmp(str, str_to_find, str_to_find_len) == 0);
160 }
161
162 static const char* get_jimage_version_string() {
163 static char version_string[10] = "";
164 if (version_string[0] == '\0') {
165 jio_snprintf(version_string, sizeof(version_string), "%d.%d",
166 VM_Version::vm_major_version(), VM_Version::vm_minor_version());
167 }
168 return (const char*)version_string;
169 }
170
171 bool ClassLoader::string_ends_with(const char* str, const char* str_to_find) {
172 size_t str_len = strlen(str);
173 size_t str_to_find_len = strlen(str_to_find);
174 if (str_to_find_len > str_len) {
175 return false;
176 }
177 return (strncmp(str + (str_len - str_to_find_len), str_to_find, str_to_find_len) == 0);
178 }
179
180 // Used to obtain the package name from a fully qualified class name.
181 // It is the responsibility of the caller to establish a ResourceMark.
182 const char* ClassLoader::package_from_name(const char* const class_name, bool* bad_class_name) {
183 if (class_name == NULL) {
184 if (bad_class_name != NULL) {
185 *bad_class_name = true;
186 }
|