Skip to content

Commit 9e15563

Browse files
committed
[CodeClean] change param name
Code clean, update confusing param name and use predefined macro to release data. Signed-off-by: Jaeyun Jung <[email protected]>
1 parent ca2448f commit 9e15563

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

c/src/ml-api-inference-pipeline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,13 +2374,13 @@ ml_pipeline_element_release_handle (ml_pipeline_element_h elem_h)
23742374
* @brief Check property existence and its type.
23752375
*/
23762376
static bool
2377-
ml_pipeline_element_check_property (GObjectClass * class,
2377+
ml_pipeline_element_check_property (GObjectClass * klass,
23782378
const char *property_name, const GType type)
23792379
{
23802380
GParamSpec *pspec = NULL;
23812381

23822382
/* Check property existence */
2383-
pspec = g_object_class_find_property (class, property_name);
2383+
pspec = g_object_class_find_property (klass, property_name);
23842384
if (pspec == NULL) {
23852385
_ml_logw ("The property name [%s] does not exist.", property_name);
23862386
return FALSE;

c/src/ml-api-service.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ _ml_service_invoke_event_new_data (ml_service_s * mls, const char *name,
849849
const ml_tensors_data_h data)
850850
{
851851
ml_service_event_cb_info_s cb_info = { 0 };
852-
ml_information_h ml_information = NULL;
852+
ml_information_h ml_info = NULL;
853853
int status = ML_ERROR_NONE;
854854

855855
if (!mls || !data) {
@@ -861,25 +861,26 @@ _ml_service_invoke_event_new_data (ml_service_s * mls, const char *name,
861861

862862
if (cb_info.cb) {
863863
/* Create information handle for ml-service event. */
864-
status = _ml_information_create (&ml_information);
864+
status = _ml_information_create (&ml_info);
865865
if (status != ML_ERROR_NONE)
866866
goto done;
867867

868868
if (name) {
869-
status =
870-
_ml_information_set (ml_information, "name", (void *) name, NULL);
869+
status = _ml_information_set (ml_info, "name", (void *) name, NULL);
871870
if (status != ML_ERROR_NONE)
872871
goto done;
873872
}
874873

875-
status = _ml_information_set (ml_information, "data", (void *) data, NULL);
876-
if (status == ML_ERROR_NONE)
877-
cb_info.cb (ML_SERVICE_EVENT_NEW_DATA, ml_information, cb_info.pdata);
874+
status = _ml_information_set (ml_info, "data", (void *) data, NULL);
875+
if (status != ML_ERROR_NONE)
876+
goto done;
877+
878+
cb_info.cb (ML_SERVICE_EVENT_NEW_DATA, ml_info, cb_info.pdata);
878879
}
879880

880881
done:
881-
if (ml_information)
882-
ml_information_destroy (ml_information);
882+
if (ml_info)
883+
ml_information_destroy (ml_info);
883884

884885
if (status != ML_ERROR_NONE) {
885886
_ml_error_report ("Failed to invoke 'new data' event.");

java/android/nnstreamer/src/main/jni/nnstreamer-native-common.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ _load_app_context (JNIEnv * env, jobject context)
246246
g_return_val_if_fail (context, FALSE);
247247

248248
/* Clear old value. */
249-
g_free (g_files_dir);
250-
g_files_dir = NULL;
249+
g_clear_pointer (&g_files_dir, g_free);
251250

252251
cls_context = (*env)->GetObjectClass (env, context);
253252
if (!cls_context) {
@@ -539,8 +538,7 @@ nnstreamer_native_finalize (void)
539538
#endif
540539
#endif
541540

542-
g_free (g_files_dir);
543-
g_files_dir = NULL;
541+
g_clear_pointer (&g_files_dir, g_free);
544542
g_nns_is_initialized = FALSE;
545543
}
546544

0 commit comments

Comments
 (0)