Fix off-by-one in source_file_line_basename()

This commit is contained in:
Ralf W. Grosse-Kunstleve 2022-06-21 17:58:43 -07:00
parent 1bf2577e1f
commit cfd98a7de2

View File

@ -68,13 +68,13 @@ inline const char *cpp_version_in_use() {
}
inline const char *source_file_line_basename(const char *sfl) {
unsigned i_sep = 0;
unsigned i_base = 0;
for (unsigned i = 0; sfl[i] != '\0'; i++) {
if (sfl[i] == '/' || sfl[i] == '\\') {
i_sep = i;
i_base = i + 1;
}
}
return sfl + i_sep;
return sfl + i_base;
}
namespace {