Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig updates from Michal Marek: "This is the kconfig part of kbuild for v3.12-rc1: - post-3.11 search code fixes and micro-optimizations - CONFIG_MODULES is no longer a special case; this is needed to eventually fix the bug that using KCONFIG_ALLCONFIG breaks allmodconfig - long long is used to store hex and int values - make silentoldconfig no longer warns when a symbol changes from tristate to bool (it's a job for make oldconfig) - scripts/diffconfig updated to work with newer Pythons - scripts/config does not rely on GNU sed extensions" * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kconfig: do not allow more than one symbol to have 'option modules' kconfig: regenerate bison parser kconfig: do not special-case 'MODULES' symbol diffconfig: Update script to support python versions 2.5 through 3.3 diffconfig: Gracefully exit if the default config files are not present modules: do not depend on kconfig to set 'modules' option to symbol MODULES kconfig: silence warning when parsing auto.conf when a symbol has changed type scripts/config: use sed's POSIX interface kconfig: switch to "long long" for sanity kconfig: simplify symbol-search code kconfig: don't allocate n+1 elements in temporary array kconfig: minor style fixes in symbol-search code kconfig/[mn]conf: shorten title in search-box kconfig: avoid multiple calls to strlen Documentation/kconfig: more concise and straightforward search explanation
This commit is contained in:
@@ -147,6 +147,7 @@ applicable everywhere (see syntax).
|
|||||||
- "modules"
|
- "modules"
|
||||||
This declares the symbol to be used as the MODULES symbol, which
|
This declares the symbol to be used as the MODULES symbol, which
|
||||||
enables the third modular state for all config symbols.
|
enables the third modular state for all config symbols.
|
||||||
|
At most one symbol may have the "modules" option set.
|
||||||
|
|
||||||
- "env"=<value>
|
- "env"=<value>
|
||||||
This imports the environment variable into Kconfig. It behaves like
|
This imports the environment variable into Kconfig. It behaves like
|
||||||
|
@@ -175,11 +175,9 @@ Searching in menuconfig:
|
|||||||
/^hotplug
|
/^hotplug
|
||||||
|
|
||||||
When searching, symbols are sorted thus:
|
When searching, symbols are sorted thus:
|
||||||
- exact match first: an exact match is when the search matches
|
- first, exact matches, sorted alphabetically (an exact match
|
||||||
the complete symbol name;
|
is when the search matches the complete symbol name);
|
||||||
- alphabetical order: when two symbols do not match exactly,
|
- then, other matches, sorted alphabetically.
|
||||||
they are sorted in alphabetical order (in the user's current
|
|
||||||
locale).
|
|
||||||
For example: ^ATH.K matches:
|
For example: ^ATH.K matches:
|
||||||
ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG
|
ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG
|
||||||
[...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
|
[...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
|
||||||
|
@@ -1670,6 +1670,7 @@ config BASE_SMALL
|
|||||||
|
|
||||||
menuconfig MODULES
|
menuconfig MODULES
|
||||||
bool "Enable loadable module support"
|
bool "Enable loadable module support"
|
||||||
|
option modules
|
||||||
help
|
help
|
||||||
Kernel modules are small pieces of compiled code which can
|
Kernel modules are small pieces of compiled code which can
|
||||||
be inserted in the running kernel, rather than being
|
be inserted in the running kernel, rather than being
|
||||||
|
@@ -62,15 +62,52 @@ checkarg() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txt_append() {
|
||||||
|
local anchor="$1"
|
||||||
|
local insert="$2"
|
||||||
|
local infile="$3"
|
||||||
|
local tmpfile="$infile.swp"
|
||||||
|
|
||||||
|
# sed append cmd: 'a\' + newline + text + newline
|
||||||
|
cmd="$(printf "a\\%b$insert" "\n")"
|
||||||
|
|
||||||
|
sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
|
||||||
|
# replace original file with the edited one
|
||||||
|
mv "$tmpfile" "$infile"
|
||||||
|
}
|
||||||
|
|
||||||
|
txt_subst() {
|
||||||
|
local before="$1"
|
||||||
|
local after="$2"
|
||||||
|
local infile="$3"
|
||||||
|
local tmpfile="$infile.swp"
|
||||||
|
|
||||||
|
sed -e "s/$before/$after/" "$infile" >"$tmpfile"
|
||||||
|
# replace original file with the edited one
|
||||||
|
mv "$tmpfile" "$infile"
|
||||||
|
}
|
||||||
|
|
||||||
|
txt_delete() {
|
||||||
|
local text="$1"
|
||||||
|
local infile="$2"
|
||||||
|
local tmpfile="$infile.swp"
|
||||||
|
|
||||||
|
sed -e "/$text/d" "$infile" >"$tmpfile"
|
||||||
|
# replace original file with the edited one
|
||||||
|
mv "$tmpfile" "$infile"
|
||||||
|
}
|
||||||
|
|
||||||
set_var() {
|
set_var() {
|
||||||
local name=$1 new=$2 before=$3
|
local name=$1 new=$2 before=$3
|
||||||
|
|
||||||
name_re="^($name=|# $name is not set)"
|
name_re="^($name=|# $name is not set)"
|
||||||
before_re="^($before=|# $before is not set)"
|
before_re="^($before=|# $before is not set)"
|
||||||
if test -n "$before" && grep -Eq "$before_re" "$FN"; then
|
if test -n "$before" && grep -Eq "$before_re" "$FN"; then
|
||||||
sed -ri "/$before_re/a $new" "$FN"
|
txt_append "^$before=" "$new" "$FN"
|
||||||
|
txt_append "^# $before is not set" "$new" "$FN"
|
||||||
elif grep -Eq "$name_re" "$FN"; then
|
elif grep -Eq "$name_re" "$FN"; then
|
||||||
sed -ri "s:$name_re.*:$new:" "$FN"
|
txt_subst "^$name=.*" "$new" "$FN"
|
||||||
|
txt_subst "^# $name is not set" "$new" "$FN"
|
||||||
else
|
else
|
||||||
echo "$new" >>"$FN"
|
echo "$new" >>"$FN"
|
||||||
fi
|
fi
|
||||||
@@ -79,7 +116,8 @@ set_var() {
|
|||||||
undef_var() {
|
undef_var() {
|
||||||
local name=$1
|
local name=$1
|
||||||
|
|
||||||
sed -ri "/^($name=|# $name is not set)/d" "$FN"
|
txt_delete "^$name=" "$FN"
|
||||||
|
txt_delete "^# $name is not set" "$FN"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "--file" ]; then
|
if [ "$1" = "--file" ]; then
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
import sys, os
|
import sys, os
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print """Usage: diffconfig [-h] [-m] [<config1> <config2>]
|
print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
|
||||||
|
|
||||||
Diffconfig is a simple utility for comparing two .config files.
|
Diffconfig is a simple utility for comparing two .config files.
|
||||||
Using standard diff to compare .config files often includes extraneous and
|
Using standard diff to compare .config files often includes extraneous and
|
||||||
@@ -33,7 +33,7 @@ Example usage:
|
|||||||
EXT2_FS y -> n
|
EXT2_FS y -> n
|
||||||
LOG_BUF_SHIFT 14 -> 16
|
LOG_BUF_SHIFT 14 -> 16
|
||||||
PRINTK_TIME n -> y
|
PRINTK_TIME n -> y
|
||||||
"""
|
""")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# returns a dictionary of name/value pairs for config items in the file
|
# returns a dictionary of name/value pairs for config items in the file
|
||||||
@@ -54,23 +54,23 @@ def print_config(op, config, value, new_value):
|
|||||||
if merge_style:
|
if merge_style:
|
||||||
if new_value:
|
if new_value:
|
||||||
if new_value=="n":
|
if new_value=="n":
|
||||||
print "# CONFIG_%s is not set" % config
|
print("# CONFIG_%s is not set" % config)
|
||||||
else:
|
else:
|
||||||
print "CONFIG_%s=%s" % (config, new_value)
|
print("CONFIG_%s=%s" % (config, new_value))
|
||||||
else:
|
else:
|
||||||
if op=="-":
|
if op=="-":
|
||||||
print "-%s %s" % (config, value)
|
print("-%s %s" % (config, value))
|
||||||
elif op=="+":
|
elif op=="+":
|
||||||
print "+%s %s" % (config, new_value)
|
print("+%s %s" % (config, new_value))
|
||||||
else:
|
else:
|
||||||
print " %s %s -> %s" % (config, value, new_value)
|
print(" %s %s -> %s" % (config, value, new_value))
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global merge_style
|
global merge_style
|
||||||
|
|
||||||
# parse command line args
|
# parse command line args
|
||||||
if ("-h" in sys.argv or "--help" in sys.argv):
|
if ("-h" in sys.argv or "--help" in sys.argv):
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
merge_style = 0
|
merge_style = 0
|
||||||
if "-m" in sys.argv:
|
if "-m" in sys.argv:
|
||||||
@@ -79,23 +79,27 @@ def main():
|
|||||||
|
|
||||||
argc = len(sys.argv)
|
argc = len(sys.argv)
|
||||||
if not (argc==1 or argc == 3):
|
if not (argc==1 or argc == 3):
|
||||||
print "Error: incorrect number of arguments or unrecognized option"
|
print("Error: incorrect number of arguments or unrecognized option")
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
if argc == 1:
|
if argc == 1:
|
||||||
# if no filenames given, assume .config and .config.old
|
# if no filenames given, assume .config and .config.old
|
||||||
build_dir=""
|
build_dir=""
|
||||||
if os.environ.has_key("KBUILD_OUTPUT"):
|
if "KBUILD_OUTPUT" in os.environ:
|
||||||
build_dir = os.environ["KBUILD_OUTPUT"]+"/"
|
build_dir = os.environ["KBUILD_OUTPUT"]+"/"
|
||||||
|
|
||||||
configa_filename = build_dir + ".config.old"
|
configa_filename = build_dir + ".config.old"
|
||||||
configb_filename = build_dir + ".config"
|
configb_filename = build_dir + ".config"
|
||||||
else:
|
else:
|
||||||
configa_filename = sys.argv[1]
|
configa_filename = sys.argv[1]
|
||||||
configb_filename = sys.argv[2]
|
configb_filename = sys.argv[2]
|
||||||
|
|
||||||
a = readconfig(file(configa_filename))
|
try:
|
||||||
b = readconfig(file(configb_filename))
|
a = readconfig(open(configa_filename))
|
||||||
|
b = readconfig(open(configb_filename))
|
||||||
|
except (IOError):
|
||||||
|
e = sys.exc_info()[1]
|
||||||
|
print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
|
||||||
|
usage()
|
||||||
|
|
||||||
# print items in a but not b (accumulate, sort and print)
|
# print items in a but not b (accumulate, sort and print)
|
||||||
old = []
|
old = []
|
||||||
@@ -121,8 +125,7 @@ def main():
|
|||||||
|
|
||||||
# now print items in b but not in a
|
# now print items in b but not in a
|
||||||
# (items from b that were in a were removed above)
|
# (items from b that were in a were removed above)
|
||||||
new = b.keys()
|
new = sorted(b.keys())
|
||||||
new.sort()
|
|
||||||
for config in new:
|
for config in new:
|
||||||
print_config("+", config, None, b[config])
|
print_config("+", config, None, b[config])
|
||||||
|
|
||||||
|
@@ -140,7 +140,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
|
|||||||
sym->flags |= def_flags;
|
sym->flags |= def_flags;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
|
if (def != S_DEF_AUTO)
|
||||||
|
conf_warning("symbol value '%s' invalid for %s",
|
||||||
|
p, sym->name);
|
||||||
return 1;
|
return 1;
|
||||||
case S_OTHER:
|
case S_OTHER:
|
||||||
if (*p != '"') {
|
if (*p != '"') {
|
||||||
@@ -161,7 +163,8 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
|
|||||||
memmove(p2, p2 + 1, strlen(p2));
|
memmove(p2, p2 + 1, strlen(p2));
|
||||||
}
|
}
|
||||||
if (!p2) {
|
if (!p2) {
|
||||||
conf_warning("invalid string found");
|
if (def != S_DEF_AUTO)
|
||||||
|
conf_warning("invalid string found");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
@@ -172,7 +175,9 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
|
|||||||
sym->def[def].val = strdup(p);
|
sym->def[def].val = strdup(p);
|
||||||
sym->flags |= def_flags;
|
sym->flags |= def_flags;
|
||||||
} else {
|
} else {
|
||||||
conf_warning("symbol value '%s' invalid for %s", p, sym->name);
|
if (def != S_DEF_AUTO)
|
||||||
|
conf_warning("symbol value '%s' invalid for %s",
|
||||||
|
p, sym->name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -401,8 +401,8 @@ static void search_conf(void)
|
|||||||
struct subtitle_part stpart;
|
struct subtitle_part stpart;
|
||||||
|
|
||||||
title = str_new();
|
title = str_new();
|
||||||
str_printf( &title, _("Enter %s (sub)string or regexp to search for "
|
str_printf( &title, _("Enter (sub)string or regexp to search for "
|
||||||
"(with or without \"%s\")"), CONFIG_, CONFIG_);
|
"(with or without \"%s\")"), CONFIG_);
|
||||||
|
|
||||||
again:
|
again:
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
|
@@ -197,12 +197,15 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
|
|||||||
|
|
||||||
void menu_add_option(int token, char *arg)
|
void menu_add_option(int token, char *arg)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
|
||||||
|
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case T_OPT_MODULES:
|
case T_OPT_MODULES:
|
||||||
prop = prop_alloc(P_DEFAULT, modules_sym);
|
if (modules_sym)
|
||||||
prop->expr = expr_alloc_symbol(current_entry->sym);
|
zconf_error("symbol '%s' redefines option 'modules'"
|
||||||
|
" already defined by symbol '%s'",
|
||||||
|
current_entry->sym->name,
|
||||||
|
modules_sym->name
|
||||||
|
);
|
||||||
|
modules_sym = current_entry->sym;
|
||||||
break;
|
break;
|
||||||
case T_OPT_DEFCONFIG_LIST:
|
case T_OPT_DEFCONFIG_LIST:
|
||||||
if (!sym_defconfig_list)
|
if (!sym_defconfig_list)
|
||||||
|
@@ -695,8 +695,8 @@ static void search_conf(void)
|
|||||||
int dres;
|
int dres;
|
||||||
|
|
||||||
title = str_new();
|
title = str_new();
|
||||||
str_printf( &title, _("Enter %s (sub)string or regexp to search for "
|
str_printf( &title, _("Enter (sub)string or regexp to search for "
|
||||||
"(with or without \"%s\")"), CONFIG_, CONFIG_);
|
"(with or without \"%s\")"), CONFIG_);
|
||||||
|
|
||||||
again:
|
again:
|
||||||
dres = dialog_inputbox(main_window,
|
dres = dialog_inputbox(main_window,
|
||||||
|
@@ -136,7 +136,7 @@ static struct property *sym_get_range_prop(struct symbol *sym)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long sym_get_range_val(struct symbol *sym, int base)
|
static long long sym_get_range_val(struct symbol *sym, int base)
|
||||||
{
|
{
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
switch (sym->type) {
|
switch (sym->type) {
|
||||||
@@ -149,13 +149,14 @@ static long sym_get_range_val(struct symbol *sym, int base)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return strtol(sym->curr.val, NULL, base);
|
return strtoll(sym->curr.val, NULL, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sym_validate_range(struct symbol *sym)
|
static void sym_validate_range(struct symbol *sym)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
long base, val, val2;
|
int base;
|
||||||
|
long long val, val2;
|
||||||
char str[64];
|
char str[64];
|
||||||
|
|
||||||
switch (sym->type) {
|
switch (sym->type) {
|
||||||
@@ -171,7 +172,7 @@ static void sym_validate_range(struct symbol *sym)
|
|||||||
prop = sym_get_range_prop(sym);
|
prop = sym_get_range_prop(sym);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return;
|
return;
|
||||||
val = strtol(sym->curr.val, NULL, base);
|
val = strtoll(sym->curr.val, NULL, base);
|
||||||
val2 = sym_get_range_val(prop->expr->left.sym, base);
|
val2 = sym_get_range_val(prop->expr->left.sym, base);
|
||||||
if (val >= val2) {
|
if (val >= val2) {
|
||||||
val2 = sym_get_range_val(prop->expr->right.sym, base);
|
val2 = sym_get_range_val(prop->expr->right.sym, base);
|
||||||
@@ -179,9 +180,9 @@ static void sym_validate_range(struct symbol *sym)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sym->type == S_INT)
|
if (sym->type == S_INT)
|
||||||
sprintf(str, "%ld", val2);
|
sprintf(str, "%lld", val2);
|
||||||
else
|
else
|
||||||
sprintf(str, "0x%lx", val2);
|
sprintf(str, "0x%llx", val2);
|
||||||
sym->curr.val = strdup(str);
|
sym->curr.val = strdup(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +595,7 @@ bool sym_string_valid(struct symbol *sym, const char *str)
|
|||||||
bool sym_string_within_range(struct symbol *sym, const char *str)
|
bool sym_string_within_range(struct symbol *sym, const char *str)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
long val;
|
long long val;
|
||||||
|
|
||||||
switch (sym->type) {
|
switch (sym->type) {
|
||||||
case S_STRING:
|
case S_STRING:
|
||||||
@@ -605,7 +606,7 @@ bool sym_string_within_range(struct symbol *sym, const char *str)
|
|||||||
prop = sym_get_range_prop(sym);
|
prop = sym_get_range_prop(sym);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return true;
|
return true;
|
||||||
val = strtol(str, NULL, 10);
|
val = strtoll(str, NULL, 10);
|
||||||
return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
|
return val >= sym_get_range_val(prop->expr->left.sym, 10) &&
|
||||||
val <= sym_get_range_val(prop->expr->right.sym, 10);
|
val <= sym_get_range_val(prop->expr->right.sym, 10);
|
||||||
case S_HEX:
|
case S_HEX:
|
||||||
@@ -614,7 +615,7 @@ bool sym_string_within_range(struct symbol *sym, const char *str)
|
|||||||
prop = sym_get_range_prop(sym);
|
prop = sym_get_range_prop(sym);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return true;
|
return true;
|
||||||
val = strtol(str, NULL, 16);
|
val = strtoll(str, NULL, 16);
|
||||||
return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
|
return val >= sym_get_range_val(prop->expr->left.sym, 16) &&
|
||||||
val <= sym_get_range_val(prop->expr->right.sym, 16);
|
val <= sym_get_range_val(prop->expr->right.sym, 16);
|
||||||
case S_BOOLEAN:
|
case S_BOOLEAN:
|
||||||
@@ -963,11 +964,11 @@ struct sym_match {
|
|||||||
* - first, symbols that match exactly
|
* - first, symbols that match exactly
|
||||||
* - then, alphabetical sort
|
* - then, alphabetical sort
|
||||||
*/
|
*/
|
||||||
static int sym_rel_comp( const void *sym1, const void *sym2 )
|
static int sym_rel_comp(const void *sym1, const void *sym2)
|
||||||
{
|
{
|
||||||
struct sym_match *s1 = *(struct sym_match **)sym1;
|
const struct sym_match *s1 = sym1;
|
||||||
struct sym_match *s2 = *(struct sym_match **)sym2;
|
const struct sym_match *s2 = sym2;
|
||||||
int l1, l2;
|
int exact1, exact2;
|
||||||
|
|
||||||
/* Exact match:
|
/* Exact match:
|
||||||
* - if matched length on symbol s1 is the length of that symbol,
|
* - if matched length on symbol s1 is the length of that symbol,
|
||||||
@@ -978,11 +979,11 @@ static int sym_rel_comp( const void *sym1, const void *sym2 )
|
|||||||
* exactly; if this is the case, we can't decide which comes first,
|
* exactly; if this is the case, we can't decide which comes first,
|
||||||
* and we fallback to sorting alphabetically.
|
* and we fallback to sorting alphabetically.
|
||||||
*/
|
*/
|
||||||
l1 = s1->eo - s1->so;
|
exact1 = (s1->eo - s1->so) == strlen(s1->sym->name);
|
||||||
l2 = s2->eo - s2->so;
|
exact2 = (s2->eo - s2->so) == strlen(s2->sym->name);
|
||||||
if (l1 == strlen(s1->sym->name) && l2 != strlen(s2->sym->name))
|
if (exact1 && !exact2)
|
||||||
return -1;
|
return -1;
|
||||||
if (l1 != strlen(s1->sym->name) && l2 == strlen(s2->sym->name))
|
if (!exact1 && exact2)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* As a fallback, sort symbols alphabetically */
|
/* As a fallback, sort symbols alphabetically */
|
||||||
@@ -992,7 +993,7 @@ static int sym_rel_comp( const void *sym1, const void *sym2 )
|
|||||||
struct symbol **sym_re_search(const char *pattern)
|
struct symbol **sym_re_search(const char *pattern)
|
||||||
{
|
{
|
||||||
struct symbol *sym, **sym_arr = NULL;
|
struct symbol *sym, **sym_arr = NULL;
|
||||||
struct sym_match **sym_match_arr = NULL;
|
struct sym_match *sym_match_arr = NULL;
|
||||||
int i, cnt, size;
|
int i, cnt, size;
|
||||||
regex_t re;
|
regex_t re;
|
||||||
regmatch_t match[1];
|
regmatch_t match[1];
|
||||||
@@ -1005,47 +1006,38 @@ struct symbol **sym_re_search(const char *pattern)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for_all_symbols(i, sym) {
|
for_all_symbols(i, sym) {
|
||||||
struct sym_match *tmp_sym_match;
|
|
||||||
if (sym->flags & SYMBOL_CONST || !sym->name)
|
if (sym->flags & SYMBOL_CONST || !sym->name)
|
||||||
continue;
|
continue;
|
||||||
if (regexec(&re, sym->name, 1, match, 0))
|
if (regexec(&re, sym->name, 1, match, 0))
|
||||||
continue;
|
continue;
|
||||||
if (cnt + 1 >= size) {
|
if (cnt >= size) {
|
||||||
void *tmp;
|
void *tmp;
|
||||||
size += 16;
|
size += 16;
|
||||||
tmp = realloc(sym_match_arr, size * sizeof(struct sym_match *));
|
tmp = realloc(sym_match_arr, size * sizeof(struct sym_match));
|
||||||
if (!tmp) {
|
if (!tmp)
|
||||||
goto sym_re_search_free;
|
goto sym_re_search_free;
|
||||||
}
|
|
||||||
sym_match_arr = tmp;
|
sym_match_arr = tmp;
|
||||||
}
|
}
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
tmp_sym_match = (struct sym_match*)malloc(sizeof(struct sym_match));
|
/* As regexec returned 0, we know we have a match, so
|
||||||
if (!tmp_sym_match)
|
|
||||||
goto sym_re_search_free;
|
|
||||||
tmp_sym_match->sym = sym;
|
|
||||||
/* As regexec return 0, we know we have a match, so
|
|
||||||
* we can use match[0].rm_[se]o without further checks
|
* we can use match[0].rm_[se]o without further checks
|
||||||
*/
|
*/
|
||||||
tmp_sym_match->so = match[0].rm_so;
|
sym_match_arr[cnt].so = match[0].rm_so;
|
||||||
tmp_sym_match->eo = match[0].rm_eo;
|
sym_match_arr[cnt].eo = match[0].rm_eo;
|
||||||
sym_match_arr[cnt++] = tmp_sym_match;
|
sym_match_arr[cnt++].sym = sym;
|
||||||
}
|
}
|
||||||
if (sym_match_arr) {
|
if (sym_match_arr) {
|
||||||
qsort(sym_match_arr, cnt, sizeof(struct sym_match*), sym_rel_comp);
|
qsort(sym_match_arr, cnt, sizeof(struct sym_match), sym_rel_comp);
|
||||||
sym_arr = malloc((cnt+1) * sizeof(struct symbol));
|
sym_arr = malloc((cnt+1) * sizeof(struct symbol));
|
||||||
if (!sym_arr)
|
if (!sym_arr)
|
||||||
goto sym_re_search_free;
|
goto sym_re_search_free;
|
||||||
for (i = 0; i < cnt; i++)
|
for (i = 0; i < cnt; i++)
|
||||||
sym_arr[i] = sym_match_arr[i]->sym;
|
sym_arr[i] = sym_match_arr[i].sym;
|
||||||
sym_arr[cnt] = NULL;
|
sym_arr[cnt] = NULL;
|
||||||
}
|
}
|
||||||
sym_re_search_free:
|
sym_re_search_free:
|
||||||
if (sym_match_arr) {
|
/* sym_match_arr can be NULL if no match, but free(NULL) is OK */
|
||||||
for (i = 0; i < cnt; i++)
|
free(sym_match_arr);
|
||||||
free(sym_match_arr[i]);
|
|
||||||
free(sym_match_arr);
|
|
||||||
}
|
|
||||||
regfree(&re);
|
regfree(&re);
|
||||||
|
|
||||||
return sym_arr;
|
return sym_arr;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -493,9 +493,6 @@ void conf_parse(const char *name)
|
|||||||
|
|
||||||
sym_init();
|
sym_init();
|
||||||
_menu_init();
|
_menu_init();
|
||||||
modules_sym = sym_lookup(NULL, 0);
|
|
||||||
modules_sym->type = S_BOOLEAN;
|
|
||||||
modules_sym->flags |= SYMBOL_AUTO;
|
|
||||||
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
|
||||||
|
|
||||||
if (getenv("ZCONF_DEBUG"))
|
if (getenv("ZCONF_DEBUG"))
|
||||||
@@ -503,12 +500,8 @@ void conf_parse(const char *name)
|
|||||||
zconfparse();
|
zconfparse();
|
||||||
if (zconfnerrs)
|
if (zconfnerrs)
|
||||||
exit(1);
|
exit(1);
|
||||||
if (!modules_sym->prop) {
|
if (!modules_sym)
|
||||||
struct property *prop;
|
modules_sym = sym_find( "n" );
|
||||||
|
|
||||||
prop = prop_alloc(P_DEFAULT, modules_sym);
|
|
||||||
prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
rootmenu.prompt->text = _(rootmenu.prompt->text);
|
rootmenu.prompt->text = _(rootmenu.prompt->text);
|
||||||
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
|
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
|
||||||
|
Reference in New Issue
Block a user