Skip to content

Commit

Permalink
litterals on left side of operator
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelarguedas committed Nov 13, 2017
1 parent ec697fa commit d63b0f5
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion include/class_loader/class_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class ClassLoader
delete (obj);
plugin_ref_count_ = plugin_ref_count_ - 1;
assert(plugin_ref_count_ >= 0);
if (plugin_ref_count_ == 0 && isOnDemandLoadUnloadEnabled()) {
if (0 == plugin_ref_count_ && isOnDemandLoadUnloadEnabled()) {
if (!ClassLoader::hasUnmanagedInstanceBeenCreated()) {
unloadLibraryInternal(false);
} else {
Expand Down
4 changes: 2 additions & 2 deletions include/class_loader/class_loader_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void registerPlugin(const std::string & class_name, const std::string & base_cla
class_name.c_str(), getCurrentlyActiveClassLoader(),
getCurrentlyLoadingLibraryName().c_str());

if (getCurrentlyActiveClassLoader() == NULL) {
if (NULL == getCurrentlyActiveClassLoader()) {
CONSOLE_BRIDGE_logDebug(
"class_loader.impl: ALERT!!! "
"A library containing plugins has been opened through a means other than through the "
Expand Down Expand Up @@ -246,7 +246,7 @@ Base * createInstance(const std::string & derived_class_name, ClassLoader * load
obj = factory->create();
}

if (obj == NULL) { // Was never created
if (NULL == obj) { // Was never created
if (factory && factory->isOwnedBy(NULL)) {
CONSOLE_BRIDGE_logDebug(
"class_loader.impl: ALERT!!! "
Expand Down
12 changes: 6 additions & 6 deletions include/class_loader/multi_library_class_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MultiLibraryClassLoader
"Attempting to create instance of class type %s.",
class_name.c_str());
ClassLoader * loader = getClassLoaderForClass<Base>(class_name);
if (loader == NULL) {
if (NULL == loader) {
throw class_loader::CreateClassException(
"MultiLibraryClassLoader: Could not create object of class type " +
class_name +
Expand All @@ -103,7 +103,7 @@ class MultiLibraryClassLoader
createInstance(const std::string & class_name, const std::string & library_path)
{
ClassLoader * loader = getClassLoaderForLibrary(library_path);
if (loader == NULL) {
if (NULL == loader) {
throw class_loader::NoClassLoaderExistsException(
"Could not create instance as there is no ClassLoader in "
"MultiLibraryClassLoader bound to library " + library_path +
Expand All @@ -127,7 +127,7 @@ class MultiLibraryClassLoader
"class_loader::MultiLibraryClassLoader: Attempting to create instance of class type %s.",
class_name.c_str());
ClassLoader * loader = getClassLoaderForClass<Base>(class_name);
if (loader == nullptr) {
if (nullptr == loader) {
throw class_loader::CreateClassException(
"MultiLibraryClassLoader: Could not create object of class type " + class_name +
" as no factory exists for it. "
Expand All @@ -150,7 +150,7 @@ class MultiLibraryClassLoader
createUniqueInstance(const std::string & class_name, const std::string & library_path)
{
ClassLoader * loader = getClassLoaderForLibrary(library_path);
if (loader == nullptr) {
if (nullptr == loader) {
throw class_loader::NoClassLoaderExistsException(
"Could not create instance as there is no ClassLoader in "
"MultiLibraryClassLoader bound to library " + library_path +
Expand All @@ -172,7 +172,7 @@ class MultiLibraryClassLoader
Base * createUnmanagedInstance(const std::string & class_name)
{
ClassLoader * loader = getClassLoaderForClass<Base>(class_name);
if (loader == NULL) {
if (NULL == loader) {
throw class_loader::CreateClassException(
"MultiLibraryClassLoader: Could not create class of type " + class_name);
}
Expand All @@ -191,7 +191,7 @@ class MultiLibraryClassLoader
Base * createUnmanagedInstance(const std::string & class_name, const std::string & library_path)
{
ClassLoader * loader = getClassLoaderForLibrary(library_path);
if (loader == NULL) {
if (NULL == loader) {
throw class_loader::NoClassLoaderExistsException(
"Could not create instance as there is no ClassLoader in MultiLibraryClassLoader "
"bound to library " + library_path +
Expand Down
2 changes: 1 addition & 1 deletion src/class_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int ClassLoader::unloadLibraryInternal(bool lock_plugin_ref_count)
"destroying the ClassLoader. The library will NOT be unloaded.");
} else {
load_ref_count_ = load_ref_count_ - 1;
if (load_ref_count_ == 0) {
if (0 == load_ref_count_) {
class_loader::class_loader_private::unloadLibrary(getLibraryPath(), this);
} else if (load_ref_count_ < 0) {
load_ref_count_ = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/class_loader_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ bool isLibraryLoaded(const std::string & library_path, ClassLoader * loader)
int num_meta_objs_for_lib_bound_to_loader =
allMetaObjectsForLibraryOwnedBy(library_path, loader).size();
bool are_meta_objs_bound_to_loader =
(num_meta_objs_for_lib == 0) ? true : (
(0 == num_meta_objs_for_lib) ? true : (
num_meta_objs_for_lib_bound_to_loader <= num_meta_objs_for_lib);

return is_lib_loaded_by_anyone && are_meta_objs_bound_to_loader;
Expand Down Expand Up @@ -518,7 +518,7 @@ void loadLibrary(const std::string & library_path, ClassLoader * loader)

// Graveyard scenario
unsigned int num_lib_objs = allMetaObjectsForLibrary(library_path).size();
if (num_lib_objs == 0) {
if (0 == num_lib_objs) {
CONSOLE_BRIDGE_logDebug(
"class_loader.class_loader_private: "
"Though the library %s was just loaded, it seems no factory metaobjects were registered. "
Expand Down
2 changes: 1 addition & 1 deletion src/multi_library_class_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int MultiLibraryClassLoader::unloadLibrary(const std::string & library_path)
LibraryToClassLoaderMap::iterator itr = active_class_loaders_.find(library_path);
if (itr != active_class_loaders_.end()) {
ClassLoader * loader = itr->second;
if ((remaining_unloads = loader->unloadLibrary()) == 0) {
if (0 == (remaining_unloads = loader->unloadLibrary())) {
delete (loader);
active_class_loaders_.erase(itr);
}
Expand Down
2 changes: 1 addition & 1 deletion test/unique_ptr_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TEST(ClassLoaderUniquePtrTest, nonExistentPlugin) {

try {
ClassLoader::UniquePtr<Base> obj = loader1.createUniqueInstance<Base>("Bear");
if (obj == NULL) {
if (nullptr == obj) {
FAIL() << "Null object being returned instead of exception thrown.";
}

Expand Down
2 changes: 1 addition & 1 deletion test/utest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ TEST(ClassLoaderTest, nonExistentPlugin) {

try {
boost::shared_ptr<Base> obj = loader1.createInstance<Base>("Bear");
if (obj == NULL) {
if (NULL == obj) {
FAIL() << "Null object being returned instead of exception thrown.";
}

Expand Down

0 comments on commit d63b0f5

Please sign in to comment.