mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-30 05:32:08 +00:00
I thought git would be smart enough to understand all the whitespace changes but even with all the flags I know to make it ignore theses it still blows up if there are identical changes on both sides.
I have a solution but it require creating a new commit at the merge base for each conflicting PR and merging it into develop.
I don't think blowing up all PRs is worth for now, maybe if we can coordinate this for V3 let's say.
This reverts commit 0d11331d18.
This commit is contained in:
@@ -37,68 +37,73 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
char *strnstr(const char *s, const char *find, size_t slen) {
|
||||
char c;
|
||||
if ((c = *find++) != '\0') {
|
||||
char sc;
|
||||
size_t len;
|
||||
char *strnstr(const char *s, const char *find, size_t slen)
|
||||
{
|
||||
char c;
|
||||
if ((c = *find++) != '\0') {
|
||||
char sc;
|
||||
size_t len;
|
||||
|
||||
len = strlen(find);
|
||||
do {
|
||||
do {
|
||||
if (slen-- < 1 || (sc = *s++) == '\0')
|
||||
return (NULL);
|
||||
} while (sc != c);
|
||||
if (len > slen)
|
||||
return (NULL);
|
||||
} while (strncmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
return ((char *)s);
|
||||
}
|
||||
|
||||
void printBytes(const char *label, const uint8_t *p, size_t numbytes) {
|
||||
int labelSize = strlen(label);
|
||||
char *messageBuffer = new char[labelSize + (numbytes * 3) + 2];
|
||||
strncpy(messageBuffer, label, labelSize);
|
||||
for (size_t i = 0; i < numbytes; i++)
|
||||
snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]);
|
||||
strcpy(messageBuffer + labelSize + numbytes * 3, "\n");
|
||||
LOG_DEBUG(messageBuffer);
|
||||
delete[] messageBuffer;
|
||||
}
|
||||
|
||||
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes) {
|
||||
for (uint8_t i = 0; i < numbytes; i++) {
|
||||
if (mem[i] != find)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isOneOf(int item, int count, ...) {
|
||||
va_list args;
|
||||
va_start(args, count);
|
||||
bool found = false;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (item == va_arg(args, int)) {
|
||||
found = true;
|
||||
break;
|
||||
len = strlen(find);
|
||||
do {
|
||||
do {
|
||||
if (slen-- < 1 || (sc = *s++) == '\0')
|
||||
return (NULL);
|
||||
} while (sc != c);
|
||||
if (len > slen)
|
||||
return (NULL);
|
||||
} while (strncmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
return found;
|
||||
return ((char *)s);
|
||||
}
|
||||
|
||||
const std::string vformat(const char *const zcFormat, ...) {
|
||||
va_list vaArgs;
|
||||
va_start(vaArgs, zcFormat);
|
||||
va_list vaArgsCopy;
|
||||
va_copy(vaArgsCopy, vaArgs);
|
||||
const int iLen = std::vsnprintf(NULL, 0, zcFormat, vaArgsCopy);
|
||||
va_end(vaArgsCopy);
|
||||
std::vector<char> zc(iLen + 1);
|
||||
std::vsnprintf(zc.data(), zc.size(), zcFormat, vaArgs);
|
||||
va_end(vaArgs);
|
||||
return std::string(zc.data(), iLen);
|
||||
void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
||||
{
|
||||
int labelSize = strlen(label);
|
||||
char *messageBuffer = new char[labelSize + (numbytes * 3) + 2];
|
||||
strncpy(messageBuffer, label, labelSize);
|
||||
for (size_t i = 0; i < numbytes; i++)
|
||||
snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]);
|
||||
strcpy(messageBuffer + labelSize + numbytes * 3, "\n");
|
||||
LOG_DEBUG(messageBuffer);
|
||||
delete[] messageBuffer;
|
||||
}
|
||||
|
||||
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)
|
||||
{
|
||||
for (uint8_t i = 0; i < numbytes; i++) {
|
||||
if (mem[i] != find)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isOneOf(int item, int count, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, count);
|
||||
bool found = false;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (item == va_arg(args, int)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
return found;
|
||||
}
|
||||
|
||||
const std::string vformat(const char *const zcFormat, ...)
|
||||
{
|
||||
va_list vaArgs;
|
||||
va_start(vaArgs, zcFormat);
|
||||
va_list vaArgsCopy;
|
||||
va_copy(vaArgsCopy, vaArgs);
|
||||
const int iLen = std::vsnprintf(NULL, 0, zcFormat, vaArgsCopy);
|
||||
va_end(vaArgsCopy);
|
||||
std::vector<char> zc(iLen + 1);
|
||||
std::vsnprintf(zc.data(), zc.size(), zcFormat, vaArgs);
|
||||
va_end(vaArgs);
|
||||
return std::string(zc.data(), iLen);
|
||||
}
|
||||
Reference in New Issue
Block a user