去除了 find_env_cb() 中修正 bug 后遗留的无用代码,同时修改了 max_len 的变量名和类型

This commit is contained in:
Wudi 2019-12-30 21:25:15 +08:00
parent 3babfbc970
commit 12f8f0864c

View File

@ -711,17 +711,13 @@ static bool find_env_cb(env_node_obj_t env, void *arg1, void *arg2)
{
const char *key = arg1;
bool *find_ok = arg2;
uint8_t max_len = strlen(key);
size_t key_len = strlen(key);
if (max_len != env->name_len) {
if (key_len != env->name_len) {
return false;
}
if (max_len < env->name_len) {
max_len = env->name_len;
}
/* check ENV */
if (env->crc_is_ok && env->status == ENV_WRITE && !strncmp(env->name, key, max_len)) {
if (env->crc_is_ok && env->status == ENV_WRITE && !strncmp(env->name, key, key_len)) {
*find_ok = true;
return true;
}