OSDN Git Service
(root)
/
uclinux-h8
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
modpost: expand pattern matching to support substring matches
[uclinux-h8/linux.git]
/
scripts
/
mod
/
modpost.c
diff --git
a/scripts/mod/modpost.c
b/scripts/mod/modpost.c
index
45e4027
..
1c2101b
100644
(file)
--- a/
scripts/mod/modpost.c
+++ b/
scripts/mod/modpost.c
@@
-776,6
+776,7
@@
static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr)
* "foo" will match an exact string equal to "foo"
* "*foo" will match a string that ends with "foo"
* "foo*" will match a string that begins with "foo"
* "foo" will match an exact string equal to "foo"
* "*foo" will match a string that ends with "foo"
* "foo*" will match a string that begins with "foo"
+ * "*foo*" will match a string that contains "foo"
*/
static int match(const char *sym, const char * const pat[])
{
*/
static int match(const char *sym, const char * const pat[])
{
@@
-784,8
+785,17
@@
static int match(const char *sym, const char * const pat[])
p = *pat++;
const char *endp = p + strlen(p) - 1;
p = *pat++;
const char *endp = p + strlen(p) - 1;
+ /* "*foo*" */
+ if (*p == '*' && *endp == '*') {
+ char *here, *bare = strndup(p + 1, strlen(p) - 2);
+
+ here = strstr(sym, bare);
+ free(bare);
+ if (here != NULL)
+ return 1;
+ }
/* "*foo" */
/* "*foo" */
- if (*p == '*') {
+
else
if (*p == '*') {
if (strrcmp(sym, p + 1) == 0)
return 1;
}
if (strrcmp(sym, p + 1) == 0)
return 1;
}