MCPcopy Create free account
hub / github.com/bblanchon/ArduinoJson / stringCompare

Function stringCompare

src/ArduinoJson/Strings/Adapters/FlashString.hpp:46–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 friend int stringCompare(FlashString a, RamString b) {
47 ARDUINOJSON_ASSERT(a.typeSortKey < b.typeSortKey);
48 ARDUINOJSON_ASSERT(!a.isNull());
49 ARDUINOJSON_ASSERT(!b.isNull());
50 size_t minsize = a.size() < b.size() ? a.size() : b.size();
51 int res = ::memcmp_P(b.data(), a.str_, minsize);
52 if (res)
53 return -res;
54 if (a.size() < b.size())
55 return -1;
56 if (a.size() > b.size())
57 return 1;
58 return 0;
59 }
60
61 friend void stringGetChars(FlashString s, char* p, size_t n) {
62 ARDUINOJSON_ASSERT(s.size() <= n);

Callers

nothing calls this directly

Calls 4

memcmp_PFunction · 0.85
isNullMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected