mv_machine_learning: make IsXXX functions simplified 09/264409/2
authorInki Dae <inki.dae@samsung.com>
Fri, 17 Sep 2021 06:37:21 +0000 (15:37 +0900)
committerInki Dae <inki.dae@samsung.com>
Fri, 17 Sep 2021 06:52:49 +0000 (06:52 +0000)
This patch changes existing code to just "return condition",
and declare IsJsonFile function as static function because
this function is used only in this module.

Change-Id: I86d8959ef32e382e4a0be76cbdc7ff781cede6e4
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/mv_inference/inference/src/mv_inference_open.cpp

index 8de14d5824b0deb88de63e82b67cc8e76cbda69b..466b368cae275a5fcecc0d6ff55e0c0091a71cc9 100644 (file)
@@ -112,31 +112,22 @@ int mv_inference_destroy_open(mv_inference_h infer)
        return MEDIA_VISION_ERROR_NONE;
 }
 
-bool IsJsonFile(const std::string& fileName)
+static bool IsJsonFile(const std::string& fileName)
 {
-       if (!fileName.substr(fileName.find_last_of(".") + 1).compare("json"))
-               return true;
-
-       return false;
+       return (!fileName.substr(fileName.find_last_of(".") + 1).compare("json"));
 }
 
 static bool IsValidBackendType(const int backend_type)
 {
-       if (backend_type > MV_INFERENCE_BACKEND_NONE &&
-                       backend_type < MV_INFERENCE_BACKEND_MAX)
-               return true;
-
-       return false;
+       return (backend_type > MV_INFERENCE_BACKEND_NONE &&
+                       backend_type < MV_INFERENCE_BACKEND_MAX);
 }
 
 static bool IsConfigFilePathRequired(const int target_device_type, const int backend_type)
 {
        // In case of MV_INFERENCE_TARGET_DEVICE_CUSTOM via MLAPI backend, config file path is required.
-       if (backend_type == MV_INFERENCE_BACKEND_MLAPI &&
-                       target_device_type & MV_INFERENCE_TARGET_DEVICE_CUSTOM)
-               return true;
-
-       return false;
+       return (backend_type == MV_INFERENCE_BACKEND_MLAPI &&
+                       target_device_type & MV_INFERENCE_TARGET_DEVICE_CUSTOM);
 }
 
 int mv_inference_configure_model_open(mv_inference_h infer,