| 342 | } |
| 343 | |
| 344 | static const char* GetFileBasename(const char* file) { |
| 345 | // We can't use basename(3) even on Unix because the Mac doesn't |
| 346 | // have a non-modifying basename. |
| 347 | const char* last_slash = strrchr(file, '/'); |
| 348 | if (last_slash != nullptr) { |
| 349 | return last_slash + 1; |
| 350 | } |
| 351 | #if defined(_WIN32) |
| 352 | const char* last_backslash = strrchr(file, '\\'); |
| 353 | if (last_backslash != nullptr) { |
| 354 | return last_backslash + 1; |
| 355 | } |
| 356 | #endif |
| 357 | return file; |
| 358 | } |
| 359 | |
| 360 | // This indirection greatly reduces the stack impact of having lots of |
| 361 | // checks/logging in a function. |