Browse Source

gpio: short source file paths

leave only the filename itself
pull/2584/head
Maxim Prokhorov 1 year ago
parent
commit
6e3baf3061
2 changed files with 11 additions and 1 deletions
  1. +1
    -1
      code/espurna/gpio.h
  2. +10
    -0
      code/espurna/types.h

+ 1
- 1
code/espurna/gpio.h View File

@ -89,7 +89,7 @@ inline bool gpioLock(GpioBase& base, unsigned char pin, bool value,
.base = base.id(),
.pin = pin,
.lock = value,
.location = source_location
.location = trim_source_location(source_location)
});
bool old = base.lock(pin);


+ 10
- 0
code/espurna/types.h View File

@ -171,6 +171,16 @@ struct SourceLocation {
const char* func;
};
inline SourceLocation trim_source_location(SourceLocation value) {
for (auto* ptr = value.file; *ptr != '\0'; ++ptr) {
if ((*ptr == '/') || (*ptr == '\\')) {
value.file = ptr + 1;
}
}
return value;
}
inline constexpr SourceLocation make_source_location(
int line = __builtin_LINE(),
const char* file = __builtin_FILE(),


Loading…
Cancel
Save