]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Remove unneeded cases from match_lib.
authorNicholas Nethercote <njn@valgrind.org>
Sat, 25 Jun 2005 20:13:05 +0000 (20:13 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sat, 25 Jun 2005 20:13:05 +0000 (20:13 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4023

coregrind/m_redir.c

index e7870220360a58eadcb3e22d2942442226524b2d..960aa7ff99277ed4413aa486fed9c88efd4681f9 100644 (file)
@@ -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)(patternname);
+   return VG_(string_match)(pattern + 7, si->soname);
 }
 
 static inline Bool from_resolved(const CodeRedirect *redir)