diff --git a/interfaces/innerkits/syspara/param_comm.c b/interfaces/innerkits/syspara/param_comm.c index 822eea3b7c875efe1f8712b9aecdae50f043d675..017708a69bba7492d52b44972d01951db85ae896 100644 --- a/interfaces/innerkits/syspara/param_comm.c +++ b/interfaces/innerkits/syspara/param_comm.c @@ -118,39 +118,6 @@ INIT_LOCAL_API const char *GetProperty(const char *key, const char **paramHolder return *paramHolder; } -INIT_LOCAL_API const char *GetPropertyAtomic(const char *key, const char **paramHolder) -{ - BEGET_CHECK(paramHolder != NULL, return NULL); - const char *_Atomic *atomicParam = (const char *_Atomic *)paramHolder; - const char *cached = atomic_load(atomicParam); - if (cached != NULL) { - return cached; - } - - uint32_t len = 0; - int ret = SystemGetParameter(key, NULL, &len); - if (ret == 0 && len > 0) { - char *res = (char *)calloc(1, len + 1); - BEGET_CHECK(res != NULL, return NULL); - - ret = SystemGetParameter(key, res, &len); - if (ret != 0) { - free(res); - return NULL; - } - - if (g_propertyGetProcessor != NULL) { - res = g_propertyGetProcessor(key, res); - } - - const char *expected = NULL; - if (!atomic_compare_exchange_strong(atomicParam, &expected, res)) { - free(res); - } - } - return atomic_load(atomicParam); -} - INIT_LOCAL_API PropertyValueProcessor SetPropertyGetProcessor(PropertyValueProcessor processor) { PropertyValueProcessor prev = g_propertyGetProcessor; diff --git a/interfaces/innerkits/syspara/param_comm.h b/interfaces/innerkits/syspara/param_comm.h index 6551f91dc49e320858cd9c536b598b1a07853d2d..2a7b033bf5385cfcc4e22226fe45f08ba3899bbe 100755 --- a/interfaces/innerkits/syspara/param_comm.h +++ b/interfaces/innerkits/syspara/param_comm.h @@ -16,7 +16,6 @@ #ifndef INIT_PARAM_COMM_H #define INIT_PARAM_COMM_H #include -#include #include "beget_ext.h" #ifdef __cplusplus @@ -36,7 +35,6 @@ extern "C" { typedef char *(*PropertyValueProcessor)(const char *key, char *value); INIT_LOCAL_API const char *GetProperty(const char *key, const char **paramHolder); -INIT_LOCAL_API const char *GetPropertyAtomic(const char *key, const char **paramHolder); INIT_LOCAL_API PropertyValueProcessor SetPropertyGetProcessor(PropertyValueProcessor processor); INIT_LOCAL_API int GetParameter_(const char *key, const char *def, char *value, uint32_t len); diff --git a/interfaces/innerkits/syspara/parameter.c b/interfaces/innerkits/syspara/parameter.c index c5246ba11fdbe126454077cf67b7d6b491f1861c..d4d8da6f1b7fe6bf0d8a5c22f887590f9f33dbbb 100644 --- a/interfaces/innerkits/syspara/parameter.c +++ b/interfaces/innerkits/syspara/parameter.c @@ -17,7 +17,6 @@ #include #include -#include #include "param_comm.h" #include "init_param.h" @@ -109,11 +108,11 @@ int SaveParameters(void) const char *GetDeviceType(void) { static const char *productType = NULL; - const char *deviceType = GetPropertyAtomic("const.product.devicetype", &productType); + const char *deviceType = GetProperty("const.product.devicetype", &productType); if (deviceType != NULL) { return deviceType; } - return GetPropertyAtomic("const.build.characteristics", &productType); + return GetProperty("const.build.characteristics", &productType); } const char *GetProductModel(void)