Use strrchr only if the compiler supports __builtin_strrchr

master
nirenjan 2021-08-25 14:16:53 -07:00
parent 204aadead0
commit 0256807417
1 changed files with 7 additions and 1 deletions

View File

@ -98,7 +98,13 @@ static int test_setup(int level, int filter, const char *file, int line)
} }
if (PINELOG_SHOW_BACKTRACE) { if (PINELOG_SHOW_BACKTRACE) {
char * basename = strrchr(file, '/'); char * basename = NULL;
#if defined __has_builtin
#if __has_builtin(__builtin_strrchr)
basename = strrchr(file, '/');
#endif
#endif
if (basename != NULL) { if (basename != NULL) {
basename++; basename++;
} else { } else {