summaryrefslogtreecommitdiffhomepage
path: root/scripts/config/symbol.c
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2005-04-19 09:55:06 +0000
committerPeter Kjellerstedt <peter.kjellerstedt@axis.com>2005-04-19 09:55:06 +0000
commitbae38db8e42b2d09b920d9430d18ee41bdcc0b17 (patch)
tree3e1ebb993c7c1979858d58dfd5a923e60a67ec5d /scripts/config/symbol.c
parent2bf88a891fb9359951bab83b74296ce036a50ae0 (diff)
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.c40
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 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <regex.h>
#include <sys/utsname.h>
#define LKC_DIRECT_LINK
@@ -414,7 +415,7 @@ tristate sym_toggle_tristate_value(struct symbol *sym)
bool sym_string_valid(struct symbol *sym, const char *str)
{
- char ch;
+ signed char ch;
switch (sym->type) {
case S_STRING:
@@ -649,6 +650,43 @@ struct symbol *sym_find(const char *name)
return symbol;
}
+struct symbol **sym_re_search(const char *pattern)
+{
+ struct symbol *sym, **sym_arr = NULL;
+ int i, cnt, size;
+ regex_t re;
+
+ cnt = size = 0;
+ /* Skip if empty */
+ if (strlen(pattern) == 0)
+ return NULL;
+ if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE))
+ return NULL;
+
+ for_all_symbols(i, sym) {
+ if (sym->flags & SYMBOL_CONST || !sym->name)
+ continue;
+ if (regexec(&re, sym->name, 0, NULL, 0))
+ continue;
+ if (cnt + 1 >= size) {
+ void *tmp = sym_arr;
+ size += 16;
+ sym_arr = realloc(sym_arr, size * sizeof(struct symbol *));
+ if (!sym_arr) {
+ free(tmp);
+ return NULL;
+ }
+ }
+ sym_arr[cnt++] = sym;
+ }
+ if (sym_arr)
+ sym_arr[cnt] = NULL;
+ regfree(&re);
+
+ return sym_arr;
+}
+
+
struct symbol *sym_check_deps(struct symbol *sym);
static struct symbol *sym_check_expr_deps(struct expr *e)