diff options
author | Xinliang David Li <davidxl@google.com> | 2016-07-19 20:48:00 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2016-07-19 20:48:00 +0000 |
commit | d9a4e3bb666e094620540b1132938c99dfdec1cd (patch) | |
tree | 95ca371c5018e5c18cd17f7e3680830ac53287b7 /lib/profile/InstrProfilingUtil.c | |
parent | cb081e1fa6099e26db36319d52fdfc1e47568341 (diff) |
[Profile] introduce reusable internal interfaces to find dir separator \NFC
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfilingUtil.c')
-rw-r--r-- | lib/profile/InstrProfilingUtil.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/profile/InstrProfilingUtil.c b/lib/profile/InstrProfilingUtil.c index a9c935087..ead537df9 100644 --- a/lib/profile/InstrProfilingUtil.c +++ b/lib/profile/InstrProfilingUtil.c @@ -184,3 +184,26 @@ lprofApplyPathPrefix(char *Dest, const char *PathStr, const char *Prefix, memcpy(Dest + PrefixLen, StrippedPathStr, strlen(StrippedPathStr) + 1); } + +COMPILER_RT_VISIBILITY const char * +lprofFindFirstDirSeparator(const char *Path) { + const char *Sep; + Sep = strchr(Path, DIR_SEPARATOR); + if (Sep) + return Sep; +#if defined(DIR_SEPARATOR_2) + Sep = strchr(Path, DIR_SEPARATOR_2); +#endif + return Sep; +} + +COMPILER_RT_VISIBILITY const char *lprofFindLastDirSeparator(const char *Path) { + const char *Sep; + Sep = strrchr(Path, DIR_SEPARATOR); + if (Sep) + return Sep; +#if defined(DIR_SEPARATOR_2) + Sep = strrchr(Path, DIR_SEPARATOR_2); +#endif + return Sep; +} |