Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: src/ArduinoJson/Polyfills/safe_strcmp.hpp
- Revision:
- 0:18ba3960b5dd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ArduinoJson/Polyfills/safe_strcmp.hpp Fri Mar 19 19:30:50 2021 +0000
@@ -0,0 +1,32 @@
+// ArduinoJson - arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+#include <stdint.h> // int8_t
+
+namespace ARDUINOJSON_NAMESPACE {
+
+inline int safe_strcmp(const char* a, const char* b) {
+ if (a == b)
+ return 0;
+ if (!a)
+ return -1;
+ if (!b)
+ return 1;
+ return strcmp(a, b);
+}
+
+inline int safe_strncmp(const char* a, const char* b, size_t n) {
+ if (a == b)
+ return 0;
+ if (!a)
+ return -1;
+ if (!b)
+ return 1;
+ return strncmp(a, b, n);
+}
+} // namespace ARDUINOJSON_NAMESPACE