|
|
|
@ -478,7 +478,7 @@ static EfErrCode del_env(const char *key){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Set an ENV. If it value is empty, delete it.
|
|
|
|
* Set an ENV.If it value is NULL, delete it.
|
|
|
|
* If not find it in ENV table, then create it.
|
|
|
|
* If not find it in ENV table, then create it.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param key ENV name
|
|
|
|
* @param key ENV name
|
|
|
|
@ -498,8 +498,8 @@ EfErrCode ef_set_env(const char *key, const char *value) {
|
|
|
|
/* lock the ENV cache */
|
|
|
|
/* lock the ENV cache */
|
|
|
|
ef_port_env_lock();
|
|
|
|
ef_port_env_lock();
|
|
|
|
|
|
|
|
|
|
|
|
/* if ENV value is empty, delete it */
|
|
|
|
/* if ENV value is NULL, delete it */
|
|
|
|
if ((value == NULL) || *value == '\0') {
|
|
|
|
if (value == NULL) {
|
|
|
|
result = del_env(key);
|
|
|
|
result = del_env(key);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
old_env = find_env(key);
|
|
|
|
old_env = find_env(key);
|
|
|
|
@ -519,6 +519,33 @@ EfErrCode ef_set_env(const char *key, const char *value) {
|
|
|
|
result = create_env(key, value);
|
|
|
|
result = create_env(key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* unlock the ENV cache */
|
|
|
|
|
|
|
|
ef_port_env_unlock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Del an ENV.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param key ENV name
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return result
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
EfErrCode ef_del_env(const char *key) {
|
|
|
|
|
|
|
|
EfErrCode result = EF_NO_ERR;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!init_ok) {
|
|
|
|
|
|
|
|
EF_INFO("ENV isn't initialize OK.\n");
|
|
|
|
|
|
|
|
return EF_ENV_INIT_FAILED;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* lock the ENV cache */
|
|
|
|
|
|
|
|
ef_port_env_lock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = del_env(key);
|
|
|
|
|
|
|
|
|
|
|
|
/* unlock the ENV cache */
|
|
|
|
/* unlock the ENV cache */
|
|
|
|
ef_port_env_unlock();
|
|
|
|
ef_port_env_unlock();
|
|
|
|
|
|
|
|
|
|
|
|
@ -828,6 +855,25 @@ EfErrCode ef_set_and_save_env(const char *key, const char *value) {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Del and save an ENV. If del ENV is success then will save it.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param key ENV name
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return result
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
EfErrCode ef_del_and_save_env(const char *key) {
|
|
|
|
|
|
|
|
EfErrCode result = EF_NO_ERR;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = ef_del_env(key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result == EF_NO_ERR) {
|
|
|
|
|
|
|
|
result = ef_save_env();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef EF_ENV_AUTO_UPDATE
|
|
|
|
#ifdef EF_ENV_AUTO_UPDATE
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Auto update ENV to latest default when current EF_ENV_VER is changed.
|
|
|
|
* Auto update ENV to latest default when current EF_ENV_VER is changed.
|
|
|
|
|