diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 13:50:22 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 13:50:22 -0500 |
| commit | 660f6a360be399f4ebdd6572a3d24afe54e9bb1c (patch) | |
| tree | 9c16463c495a656e34577d59c97b58997b61d242 /tools/perf/util/string.c | |
| parent | 586fac13f8685bf9dfb32e1ee98bfb14f0dd0061 (diff) | |
| parent | e5a11016643d1ab7172193591506d33a844734cc (diff) | |
Merge branch 'perf-probes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-probes-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: Issue at least one memory barrier in stop_machine_text_poke()
perf probe: Correct probe syntax on command line help
perf probe: Add lazy line matching support
perf probe: Show more lines after last line
perf probe: Check function address range strictly in line finder
perf probe: Use libdw callback routines
perf probe: Use elfutils-libdw for analyzing debuginfo
perf probe: Rename probe finder functions
perf probe: Fix bugs in line range finder
perf probe: Update perf probe document
perf probe: Do not show --line option without dwarf support
kprobes: Add documents of jump optimization
kprobes/x86: Support kprobes jump optimization on x86
x86: Add text_poke_smp for SMP cross modifying code
kprobes/x86: Cleanup save/restore registers
kprobes/x86: Boost probes when reentering
kprobes: Jump optimization sysctl interface
kprobes: Introduce kprobes jump optimization
kprobes: Introduce generic insn_slot framework
kprobes/x86: Cleanup RELATIVEJUMP_INSTRUCTION to RELATIVEJUMP_OPCODE
Diffstat (limited to 'tools/perf/util/string.c')
| -rw-r--r-- | tools/perf/util/string.c | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index c397d4f6f748..a175949ed216 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c | |||
| @@ -265,21 +265,21 @@ error: | |||
| 265 | return false; | 265 | return false; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | /** | 268 | /* Glob/lazy pattern matching */ |
| 269 | * strglobmatch - glob expression pattern matching | 269 | static bool __match_glob(const char *str, const char *pat, bool ignore_space) |
| 270 | * @str: the target string to match | ||
| 271 | * @pat: the pattern string to match | ||
| 272 | * | ||
| 273 | * This returns true if the @str matches @pat. @pat can includes wildcards | ||
| 274 | * ('*','?') and character classes ([CHARS], complementation and ranges are | ||
| 275 | * also supported). Also, this supports escape character ('\') to use special | ||
| 276 | * characters as normal character. | ||
| 277 | * | ||
| 278 | * Note: if @pat syntax is broken, this always returns false. | ||
| 279 | */ | ||
| 280 | bool strglobmatch(const char *str, const char *pat) | ||
| 281 | { | 270 | { |
| 282 | while (*str && *pat && *pat != '*') { | 271 | while (*str && *pat && *pat != '*') { |
| 272 | if (ignore_space) { | ||
| 273 | /* Ignore spaces for lazy matching */ | ||
| 274 | if (isspace(*str)) { | ||
| 275 | str++; | ||
| 276 | continue; | ||
| 277 | } | ||
| 278 | if (isspace(*pat)) { | ||
| 279 | pat++; | ||
| 280 | continue; | ||
| 281 | } | ||
| 282 | } | ||
| 283 | if (*pat == '?') { /* Matches any single character */ | 283 | if (*pat == '?') { /* Matches any single character */ |
| 284 | str++; | 284 | str++; |
| 285 | pat++; | 285 | pat++; |
| @@ -308,3 +308,32 @@ bool strglobmatch(const char *str, const char *pat) | |||
| 308 | return !*str && !*pat; | 308 | return !*str && !*pat; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | /** | ||
| 312 | * strglobmatch - glob expression pattern matching | ||
| 313 | * @str: the target string to match | ||
| 314 | * @pat: the pattern string to match | ||
| 315 | * | ||
| 316 | * This returns true if the @str matches @pat. @pat can includes wildcards | ||
| 317 | * ('*','?') and character classes ([CHARS], complementation and ranges are | ||
| 318 | * also supported). Also, this supports escape character ('\') to use special | ||
| 319 | * characters as normal character. | ||
| 320 | * | ||
| 321 | * Note: if @pat syntax is broken, this always returns false. | ||
| 322 | */ | ||
| 323 | bool strglobmatch(const char *str, const char *pat) | ||
| 324 | { | ||
| 325 | return __match_glob(str, pat, false); | ||
| 326 | } | ||
| 327 | |||
| 328 | /** | ||
| 329 | * strlazymatch - matching pattern strings lazily with glob pattern | ||
| 330 | * @str: the target string to match | ||
| 331 | * @pat: the pattern string to match | ||
| 332 | * | ||
| 333 | * This is similar to strglobmatch, except this ignores spaces in | ||
| 334 | * the target string. | ||
| 335 | */ | ||
| 336 | bool strlazymatch(const char *str, const char *pat) | ||
| 337 | { | ||
| 338 | return __match_glob(str, pat, true); | ||
| 339 | } | ||
