mirror of
https://xff.cz/git/u-boot/
synced 2025-10-21 01:51:11 +02:00
env: Refactor apply into change_ok
Move the read of the old value to inside the check function. In some cases it can be avoided all together and at the least the code is only called from one place. Also name the function and the callback to more clearly describe what it does. Pass the ENTRY instead of just the name for direct access to the whole data structure. Pass an enum to the callback that specifies the operation being approved. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
committed by
Tom Rini
parent
3d3b52f258
commit
7afcf3a55b
@@ -188,13 +188,12 @@ int set_default_vars(int nvars, char * const vars[]);
|
||||
int env_import(const char *buf, int check);
|
||||
|
||||
/*
|
||||
* Check if variable "name" can be changed from oldval to newval,
|
||||
* and if so, apply the changes (e.g. baudrate).
|
||||
* Check if variable "item" can be changed to newval
|
||||
* When (flag & H_FORCE) is set, it does not print out any error
|
||||
* message and forces overwriting of write-once variables.
|
||||
*/
|
||||
int env_check_apply(const char *name, const char *oldval,
|
||||
const char *newval, int flag);
|
||||
int env_change_ok(const ENTRY *item, const char *newval, enum env_op op,
|
||||
int flag);
|
||||
|
||||
#endif /* DO_DEPS_ONLY */
|
||||
|
||||
|
Reference in New Issue
Block a user