diff --git a/kv_store/src/kvstore_common/kvstore_common.c b/kv_store/src/kvstore_common/kvstore_common.c index 2b713df56b95e9a9c9ab13ac7624b05323739881..202591f0175bbe1e5f9e08a862bad47924439439 100755 --- a/kv_store/src/kvstore_common/kvstore_common.c +++ b/kv_store/src/kvstore_common/kvstore_common.c @@ -186,9 +186,7 @@ int ClearKVCacheInner(void) } g_itemHeader = NULL; g_itemTail = NULL; - if (g_sum != 0) { - return EC_FAILURE; - } - return EC_SUCCESS; + + return (g_sum != 0) ? EC_FAILURE : EC_SUCCESS; } #endif \ No newline at end of file diff --git a/kv_store/src/kvstore_impl_hal/kv_store.c b/kv_store/src/kvstore_impl_hal/kv_store.c index c1bec9a32f5fe458bd5267c534bea9a0670b5efc..3d4985b3c201bbdd8c2a97123ce079b03584bf69 100755 --- a/kv_store/src/kvstore_impl_hal/kv_store.c +++ b/kv_store/src/kvstore_impl_hal/kv_store.c @@ -140,8 +140,8 @@ int UtilsSetValue(const char* key, const char* value) currentNum++; } } - ret = SetCurrentItem(currentNum); - return ret; + + return SetCurrentItem(currentNum); } int UtilsDeleteValue(const char* key) diff --git a/kv_store/src/kvstore_impl_posix/kv_store.c b/kv_store/src/kvstore_impl_posix/kv_store.c index dfe9015c1761b99767493c087db3911d15e9cd2c..24bc57c4e006742a6efd14985aae61b33b4b4ef2 100755 --- a/kv_store/src/kvstore_impl_posix/kv_store.c +++ b/kv_store/src/kvstore_impl_posix/kv_store.c @@ -301,9 +301,8 @@ int UtilsDeleteValue(const char* key) #ifdef FEATURE_KV_CACHE int ClearKVCache(void) { - int ret; pthread_mutex_lock(&g_kvGlobalMutex); - ret = ClearKVCacheInner(); + int ret = ClearKVCacheInner(); pthread_mutex_unlock(&g_kvGlobalMutex); return ret; } diff --git a/timer_task/src/nativeapi_timer_task.c b/timer_task/src/nativeapi_timer_task.c index a47f3c8ff875ef2dae7575a6e10ebdb7cb0b02cd..1622d731eeda737c4b510037b92732e51c0c4e5f 100755 --- a/timer_task/src/nativeapi_timer_task.c +++ b/timer_task/src/nativeapi_timer_task.c @@ -29,22 +29,19 @@ int StartTimerTask(bool isPeriodic, const unsigned int delay, void* userCallback if (userCallback == NULL) { return EC_FAILURE; } - KalTimerType timerType; - if (isPeriodic) { - timerType = KAL_TIMER_PERIODIC; - } else { - timerType = KAL_TIMER_ONCE; - } + + KalTimerType timerType = isPeriodic ? KAL_TIMER_PERIODIC : KAL_TIMER_ONCE; KalTimerId timerId = KalTimerCreate((KalTimerProc)userCallback, timerType, userContext, delay); if (timerId == NULL) { return EC_FAILURE; } - int ret = KalTimerStart(timerId); - if (ret != KAL_OK) { + + if (KalTimerStart(timerId) != KAL_OK) { StopTimerTask(timerId); return EC_FAILURE; } *timerHandle = timerId; + return EC_SUCCESS; } @@ -53,6 +50,5 @@ int StopTimerTask(const timerHandle_t timerHandle) if (timerHandle == NULL) { return EC_FAILURE; } - int ret = KalTimerDelete((KalTimerId)timerHandle); - return ret; + return KalTimerDelete((KalTimerId)timerHandle);; } \ No newline at end of file