From: Nicholas Nethercote Date: Sat, 25 Jun 2005 20:13:05 +0000 (+0000) Subject: Remove unneeded cases from match_lib. X-Git-Tag: svn/VALGRIND_3_0_0~295 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59b976a10e5a3f10e543262abbd44fb100dc346b;p=thirdparty%2Fvalgrind.git Remove unneeded cases from match_lib. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4023 --- diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index e787022036..960aa7ff99 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -91,37 +91,22 @@ static Char *straddr(void *p) return buf; } -static SkipList sk_resolved_redir = VG_SKIPLIST_INIT(CodeRedirect, from_addr, - VG_(cmp_Addr), straddr, VG_AR_SYMTAB); +static SkipList sk_resolved_redir = + VG_SKIPLIST_INIT(CodeRedirect, from_addr, VG_(cmp_Addr), + straddr, VG_AR_SYMTAB); + static CodeRedirect *unresolved_redir = NULL; static Bool match_lib(const Char *pattern, const SegInfo *si) { - /* pattern == NULL matches everything, otherwise use globbing - - If the pattern starts with: - file:, then match filename - soname:, then match soname - something else, match filename - */ - const Char *name = si->filename; - - if (pattern == NULL) - return True; - - if (VG_(strncmp)(pattern, "file:", 5) == 0) { - pattern += 5; - name = si->filename; - } - if (VG_(strncmp)(pattern, "soname:", 7) == 0) { - pattern += 7; - name = si->soname; - } + // pattern must start with "soname:" + vg_assert(NULL != pattern); + vg_assert(0 == VG_(strncmp)(pattern, "soname:", 7)); - if (name == NULL) + if (si->soname == NULL) return False; - return VG_(string_match)(pattern, name); + return VG_(string_match)(pattern + 7, si->soname); } static inline Bool from_resolved(const CodeRedirect *redir)