Cleanup and improvements (#194)

- Lots of changes for migrating C code to C++
- Improved `Lockable` in several ways like adding `withLock()` (+ tests)
- Improved `Semaphore` a bit for improved readability, and also added some tests
- Upgrade Linux machine in GitHub Actions so that we can compile with a newer GCC
- Simplification of WiFi connection
- Updated funding options
- (and more)
This commit is contained in:
Ken Van Hoeylandt
2025-01-28 17:39:58 +01:00
committed by GitHub
parent 1bb1260ea0
commit 6c67845645
54 changed files with 518 additions and 531 deletions
+3 -11
View File
@@ -1,21 +1,13 @@
#include "StringUtils.h"
#include <cstring>
#include <sstream>
#include <string>
namespace tt::string {
int findLastIndex(const char* text, size_t from_index, char find) {
for (int i = (int)from_index; i >= 0; i--) {
if (text[i] == find) {
return (int)i;
}
}
return -1;
}
bool getPathParent(const std::string& path, std::string& output) {
int index = findLastIndex(path.c_str(), path.length() - 1, '/');
if (index == -1) {
auto index = path.find_last_of('/');
if (index == std::string::npos) {
return false;
} else if (index == 0) {
output = "/";