ext/fast_jsonparser/simdjson.h in fast_jsonparser-0.4.0 vs ext/fast_jsonparser/simdjson.h in fast_jsonparser-0.5.0
- old
+ new
@@ -2306,11 +2306,11 @@
/**
* @deprecated Error codes should be stored and returned as `error_code`, use `error_message()` instead.
*/
[[deprecated("Error codes should be stored and returned as `error_code`, use `error_message()` instead.")]]
-inline const std::string &error_message(int error) noexcept;
+inline const std::string error_message(int error) noexcept;
} // namespace simdjson
#endif // SIMDJSON_ERROR_H
/* end file include/simdjson/error.h */
@@ -6365,22 +6365,22 @@
namespace simdjson {
namespace internal {
// We store the error code so we can validate the error message is associated with the right code
struct error_code_info {
error_code code;
- std::string message;
+ const char* message;
};
// These MUST match the codes in error_code. We check this constraint in basictests.
extern SIMDJSON_DLLIMPORTEXPORT const error_code_info error_codes[];
} // namespace internal
inline const char *error_message(error_code error) noexcept {
// If you're using error_code, we're trusting you got it from the enum.
- return internal::error_codes[int(error)].message.c_str();
+ return internal::error_codes[int(error)].message;
}
-inline const std::string &error_message(int error) noexcept {
+inline const std::string error_message(int error) noexcept {
if (error < 0 || error >= error_code::NUM_ERROR_CODES) {
return internal::error_codes[UNEXPECTED_ERROR].message;
}
return internal::error_codes[error].message;
}
\ No newline at end of file