From abdef8eb901ce829fdc9fbe7eb89c8327c262f07 Mon Sep 17 00:00:00 2001 From: Jan-Benedict Glaw Date: Mon, 17 Nov 2014 03:30:13 +0100 Subject: Sync libiberty from GCC --- libiberty/filename_cmp.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'libiberty/filename_cmp.c') diff --git a/libiberty/filename_cmp.c b/libiberty/filename_cmp.c index 9e16d24..150488c 100644 --- a/libiberty/filename_cmp.c +++ b/libiberty/filename_cmp.c @@ -24,8 +24,13 @@ #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif + #include "filenames.h" #include "safe-ctype.h" +#include "libiberty.h" /* @@ -190,3 +195,27 @@ filename_eq (const void *s1, const void *s2) /* The casts are for -Wc++-compat. */ return filename_cmp ((const char *) s1, (const char *) s2) == 0; } + +/* + +@deftypefn Extension int canonical_filename_eq (const char *@var{a}, const char *@var{b}) + +Return non-zero if file names @var{a} and @var{b} are equivalent. +This function compares the canonical versions of the filenames as returned by +@code{lrealpath()}, so that so that different file names pointing to the same +underlying file are treated as being identical. + +@end deftypefn + +*/ + +int +canonical_filename_eq (const char * a, const char * b) +{ + char * ca = lrealpath(a); + char * cb = lrealpath(b); + int res = filename_eq (ca, cb); + free (ca); + free (cb); + return res; +} -- cgit v1.1