diff options
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r-- | scripts/kconfig/confdata.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 66b15ef..664fe29 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -100,7 +100,7 @@ int conf_read_simple(const char *name, int def) in = zconf_fopen(name); if (in) goto load; - sym_change_count++; + sym_add_change_count(1); if (!sym_defconfig_list) return 1; @@ -312,7 +312,7 @@ int conf_read(const char *name) struct expr *e; int i, flags; - sym_change_count = 0; + sym_set_change_count(0); if (conf_read_simple(name, S_DEF_USER)) return 1; @@ -364,7 +364,7 @@ int conf_read(const char *name) sym->flags &= flags | ~SYMBOL_DEF_USER; } - sym_change_count += conf_warnings || conf_unsaved; + sym_add_change_count(conf_warnings || conf_unsaved); return 0; } @@ -432,7 +432,7 @@ int conf_write(const char *name) use_timestamp ? "# " : "", use_timestamp ? ctime(&now) : ""); - if (!sym_change_count) + if (!conf_get_changed()) sym_clear_all_valid(); menu = rootmenu.list; @@ -528,7 +528,7 @@ int conf_write(const char *name) "# configuration written to %s\n" "#\n"), newname); - sym_change_count = 0; + sym_set_change_count(0); return 0; } @@ -765,3 +765,30 @@ int conf_write_autoconf(void) return 0; } + +static int sym_change_count; +static void (*conf_changed_callback)(void); + +void sym_set_change_count(int count) +{ + int _sym_change_count = sym_change_count; + sym_change_count = count; + if (conf_changed_callback && + (bool)_sym_change_count != (bool)count) + conf_changed_callback(); +} + +void sym_add_change_count(int count) +{ + sym_set_change_count(count + sym_change_count); +} + +bool conf_get_changed(void) +{ + return sym_change_count; +} + +void conf_set_changed_callback(void (*fn)(void)) +{ + conf_changed_callback = fn; +} |