[PATCH] kconfig: make sym_change_count static, let it be altered by 2 functions only
authorKarsten Wiese <annabellesgarden@yahoo.de>
Wed, 13 Dec 2006 08:34:07 +0000 (00:34 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Wed, 13 Dec 2006 17:05:48 +0000 (09:05 -0800)
Those two functions are
void sym_set_change_count(int count)
and
void sym_add_change_count(int count)

All write accesses to sym_change_count are replaced by calls to above
functions.

Variable and changer-functions are moved to confdata.c.  IMO thats ok, as
sym_change_count is an attribute of the .config's change state.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
scripts/kconfig/confdata.c
scripts/kconfig/lkc.h
scripts/kconfig/lkc_proto.h
scripts/kconfig/symbol.c
scripts/kconfig/zconf.tab.c_shipped
scripts/kconfig/zconf.y

index 140742ebd73c9b959e779db0b14e75ba5837f6c1..4bbbb5b09c8d7b01a74000e4bea5b58cc5690aa7 100644 (file)
@@ -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;
 }
@@ -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;
 }
@@ -766,6 +766,18 @@ int conf_write_autoconf(void)
        return 0;
 }
 
+static int sym_change_count;
+
+void sym_set_change_count(int count)
+{
+       sym_change_count = count;
+}
+
+void sym_add_change_count(int count)
+{
+       sym_change_count += count;
+}
+
 bool conf_get_changed(void)
 {
        return sym_change_count;
index 2628023a1fe1d0b95ff99927b53e7652620aa6e8..9b2706a41548d3b5224caed652b2a4f74f68eed4 100644 (file)
@@ -65,6 +65,8 @@ char *zconf_curname(void);
 
 /* confdata.c */
 char *conf_get_default_confname(void);
+void sym_set_change_count(int count);
+void sym_add_change_count(int count);
 
 /* kconfig_load.c */
 void kconfig_load(void);
index 9f1823c88b7329190e7d334d8f62c72f8d6d4af9..84bb139789a0845c4398a64492a0adfdd8d9d204 100644 (file)
@@ -17,7 +17,6 @@ P(menu_get_parent_menu,struct menu *,(struct menu *menu));
 
 /* symbol.c */
 P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
-P(sym_change_count,int,);
 
 P(sym_lookup,struct symbol *,(const char *name, int isconst));
 P(sym_find,struct symbol *,(const char *name));
index ee225ced2ce450359a2d2c42c383ce36f0f20717..8f06c474d800fe8d6749c49e30f9dd365dc354ed 100644 (file)
@@ -30,7 +30,6 @@ struct symbol symbol_yes = {
        .flags = SYMBOL_VALID,
 };
 
-int sym_change_count;
 struct symbol *sym_defconfig_list;
 struct symbol *modules_sym;
 tristate modules_val;
@@ -379,7 +378,7 @@ void sym_clear_all_valid(void)
 
        for_all_symbols(i, sym)
                sym->flags &= ~SYMBOL_VALID;
-       sym_change_count++;
+       sym_add_change_count(1);
        if (modules_sym)
                sym_calc_value(modules_sym);
 }
index 2fb0a4fc61d01d04bb768a1afb6cd172b5e6643a..d777fe85627f0bc3a3d5ff7594ecbacb21452dbc 100644 (file)
@@ -2135,7 +2135,7 @@ void conf_parse(const char *name)
                sym_check_deps(sym);
         }
 
-       sym_change_count = 1;
+       sym_set_change_count(1);
 }
 
 const char *zconf_tokenname(int token)
index ab44feb3c600bec91062057803bc620fac176c88..04a5864c03b1b482653917b08c57a3b884d69fa9 100644 (file)
@@ -504,7 +504,7 @@ void conf_parse(const char *name)
                sym_check_deps(sym);
         }
 
-       sym_change_count = 1;
+       sym_set_change_count(1);
 }
 
 const char *zconf_tokenname(int token)