Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: libiberty/filename_cmp.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « libiberty/dwarfnames.c ('k') | libiberty/make-relative-prefix.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libiberty/filename_cmp.c
diff --git a/libiberty/filename_cmp.c b/libiberty/filename_cmp.c
index 5179f8dd14ff40b3ebcefc1c36d9ee9f278ed53c..9e16d242086d499a795f1d8f954fc4964c391b8e 100644
--- a/libiberty/filename_cmp.c
+++ b/libiberty/filename_cmp.c
@@ -141,3 +141,52 @@ filename_ncmp (const char *s1, const char *s2, size_t n)
return 0;
#endif
}
+
+/*
+
+@deftypefn Extension hashval_t filename_hash (const void *@var{s})
+
+Return the hash value for file name @var{s} that will be compared
+using filename_cmp.
+This function is for use with hashtab.c hash tables.
+
+@end deftypefn
+
+*/
+
+hashval_t
+filename_hash (const void *s)
+{
+ /* The cast is for -Wc++-compat. */
+ const unsigned char *str = (const unsigned char *) s;
+ hashval_t r = 0;
+ unsigned char c;
+
+ while ((c = *str++) != 0)
+ {
+ if (c == '\\')
+ c = '/';
+ c = TOLOWER (c);
+ r = r * 67 + c - 113;
+ }
+
+ return r;
+}
+
+/*
+
+@deftypefn Extension int filename_eq (const void *@var{s1}, const void *@var{s2})
+
+Return non-zero if file names @var{s1} and @var{s2} are equivalent.
+This function is for use with hashtab.c hash tables.
+
+@end deftypefn
+
+*/
+
+int
+filename_eq (const void *s1, const void *s2)
+{
+ /* The casts are for -Wc++-compat. */
+ return filename_cmp ((const char *) s1, (const char *) s2) == 0;
+}
« no previous file with comments | « libiberty/dwarfnames.c ('k') | libiberty/make-relative-prefix.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698