File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 15
15
* LOGS: Screen log, no LOG_LEVEL
16
16
*/
17
17
18
- #define __FILENAME__ (strrchr(__FILE__, ' /' ) ? strrchr(__FILE__, ' /' ) + 1 : __FILE__)
18
+ // #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
19
+ // From: https://blog.galowicz.de/2016/02/20/short_file_macro/
20
+ static constexpr const char * past_last_slash (const char * const str, const char * const last_slash) {
21
+ return *str == ' \0 ' ? last_slash :
22
+ *str == ' /' ? past_last_slash (str + 1 , str + 1 ) :
23
+ past_last_slash (str + 1 , last_slash);
24
+ }
25
+
26
+ static constexpr const char * past_last_slash (const char * const str) {
27
+ return past_last_slash (str, str);
28
+ }
29
+
30
+ #define __FILENAME__ ({constexpr const char * const sf__ {past_last_slash (__FILE__)}; sf__;})
31
+
19
32
#define TANGRAM_MAX_BUFFER_LOG_SIZE 99999
20
33
21
34
#if LOG_LEVEL >= 3
You can’t perform that action at this time.
0 commit comments