diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2005-04-19 09:55:06 +0000 |
---|---|---|
committer | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2005-04-19 09:55:06 +0000 |
commit | bae38db8e42b2d09b920d9430d18ee41bdcc0b17 (patch) | |
tree | 3e1ebb993c7c1979858d58dfd5a923e60a67ec5d /scripts/config/symbol.c | |
parent | 2bf88a891fb9359951bab83b74296ce036a50ae0 (diff) | |
download | busybox-w32-bae38db8e42b2d09b920d9430d18ee41bdcc0b17.tar.gz busybox-w32-bae38db8e42b2d09b920d9430d18ee41bdcc0b17.tar.bz2 busybox-w32-bae38db8e42b2d09b920d9430d18ee41bdcc0b17.zip |
Updated to match trunk/uClibc/extra/config as of r10132, and thus
Linux 2.6.11.
Diffstat (limited to 'scripts/config/symbol.c')
-rw-r--r-- | scripts/config/symbol.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/scripts/config/symbol.c b/scripts/config/symbol.c index a9fae9c13..ea629728a 100644 --- a/scripts/config/symbol.c +++ b/scripts/config/symbol.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <ctype.h> | 6 | #include <ctype.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <string.h> | 8 | #include <string.h> |
9 | #include <regex.h> | ||
9 | #include <sys/utsname.h> | 10 | #include <sys/utsname.h> |
10 | 11 | ||
11 | #define LKC_DIRECT_LINK | 12 | #define LKC_DIRECT_LINK |
@@ -414,7 +415,7 @@ tristate sym_toggle_tristate_value(struct symbol *sym) | |||
414 | 415 | ||
415 | bool sym_string_valid(struct symbol *sym, const char *str) | 416 | bool sym_string_valid(struct symbol *sym, const char *str) |
416 | { | 417 | { |
417 | char ch; | 418 | signed char ch; |
418 | 419 | ||
419 | switch (sym->type) { | 420 | switch (sym->type) { |
420 | case S_STRING: | 421 | case S_STRING: |
@@ -649,6 +650,43 @@ struct symbol *sym_find(const char *name) | |||
649 | return symbol; | 650 | return symbol; |
650 | } | 651 | } |
651 | 652 | ||
653 | struct symbol **sym_re_search(const char *pattern) | ||
654 | { | ||
655 | struct symbol *sym, **sym_arr = NULL; | ||
656 | int i, cnt, size; | ||
657 | regex_t re; | ||
658 | |||
659 | cnt = size = 0; | ||
660 | /* Skip if empty */ | ||
661 | if (strlen(pattern) == 0) | ||
662 | return NULL; | ||
663 | if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE)) | ||
664 | return NULL; | ||
665 | |||
666 | for_all_symbols(i, sym) { | ||
667 | if (sym->flags & SYMBOL_CONST || !sym->name) | ||
668 | continue; | ||
669 | if (regexec(&re, sym->name, 0, NULL, 0)) | ||
670 | continue; | ||
671 | if (cnt + 1 >= size) { | ||
672 | void *tmp = sym_arr; | ||
673 | size += 16; | ||
674 | sym_arr = realloc(sym_arr, size * sizeof(struct symbol *)); | ||
675 | if (!sym_arr) { | ||
676 | free(tmp); | ||
677 | return NULL; | ||
678 | } | ||
679 | } | ||
680 | sym_arr[cnt++] = sym; | ||
681 | } | ||
682 | if (sym_arr) | ||
683 | sym_arr[cnt] = NULL; | ||
684 | regfree(&re); | ||
685 | |||
686 | return sym_arr; | ||
687 | } | ||
688 | |||
689 | |||
652 | struct symbol *sym_check_deps(struct symbol *sym); | 690 | struct symbol *sym_check_deps(struct symbol *sym); |
653 | 691 | ||
654 | static struct symbol *sym_check_expr_deps(struct expr *e) | 692 | static struct symbol *sym_check_expr_deps(struct expr *e) |