Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary conditional judgment in isLibraryLoaded ? #173

Open
daohu527 opened this issue Oct 26, 2020 · 1 comment
Open

Unnecessary conditional judgment in isLibraryLoaded ? #173

daohu527 opened this issue Oct 26, 2020 · 1 comment
Labels

Comments

@daohu527
Copy link

I wonder num_meta_objs_for_lib_bound_to_loader will always less than num_meta_objs_for_lib, because num_meta_objs_for_lib_bound_to_loader is look forward in allMetaObjectsForLibrary(library_path) and

num_meta_objs_for_lib is equal with allMetaObjectsForLibrary(library_path).size()

bool isLibraryLoaded(const std::string & library_path, ClassLoader * loader)
{
bool is_lib_loaded_by_anyone = isLibraryLoadedByAnybody(library_path);
size_t num_meta_objs_for_lib = allMetaObjectsForLibrary(library_path).size();
size_t num_meta_objs_for_lib_bound_to_loader =
allMetaObjectsForLibraryOwnedBy(library_path, loader).size();
bool are_meta_objs_bound_to_loader =
(0 == num_meta_objs_for_lib) ? true : (
num_meta_objs_for_lib_bound_to_loader <= num_meta_objs_for_lib);

@hidmic
Copy link
Contributor

hidmic commented Oct 30, 2020

It'd appear like it, yes. @mjcarroll am I missing anything? Do you recall what was the intent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants