lib/hashtable: remove superfluous check
[pandora-u-boot.git] / lib / hashtable.c
index 7b6781b..7c08f5c 100644 (file)
@@ -324,8 +324,7 @@ int hsearch_r(struct env_entry item, enum env_action action,
                 */
                unsigned hval2;
 
-               if (htab->table[idx].used == USED_DELETED
-                   && !first_deleted)
+               if (htab->table[idx].used == USED_DELETED)
                        first_deleted = idx;
 
                ret = _compare_and_overwrite_entry(item, action, retval, htab,
@@ -826,6 +825,10 @@ int himport_r(struct hsearch_data *htab,
        if (nvars)
                memcpy(localvars, vars, sizeof(vars[0]) * nvars);
 
+#if CONFIG_IS_ENABLED(ENV_APPEND)
+       flag |= H_NOCLEAR;
+#endif
+
        if ((flag & H_NOCLEAR) == 0 && !nvars) {
                /* Destroy old hash table if one exists */
                debug("Destroy Hash Table: %p table = %p\n", htab,
@@ -946,9 +949,12 @@ int himport_r(struct hsearch_data *htab,
                e.data = value;
 
                hsearch_r(e, ENV_ENTER, &rv, htab, flag);
-               if (rv == NULL)
+#if !CONFIG_IS_ENABLED(ENV_WRITEABLE_LIST)
+               if (rv == NULL) {
                        printf("himport_r: can't insert \"%s=%s\" into hash table\n",
                                name, value);
+               }
+#endif
 
                debug("INSERT: table %p, filled %d/%d rv %p ==> name=\"%s\" value=\"%s\"\n",
                        htab, htab->filled, htab->size,