Skip to content

Commit 0fb1676

Browse files
committed
Removing unnecessary returning of nullptr in json error_code parsing paths.
1 parent 3acb3b9 commit 0fb1676

File tree

4 files changed

+169
-197
lines changed

4 files changed

+169
-197
lines changed

Release/include/cpprest/json.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ namespace json
398398
/// <param name="errorCode">If parsing fails, the error code is greater than 0</param>
399399
/// <returns>The parsed object. Returns web::json::value::null if failed</returns>
400400
_ASYNCRTIMP static value parse(const utility::string_t&, std::error_code&);
401-
401+
402402
/// <summary>
403403
/// Serializes the current JSON value to a C++ string.
404404
/// </summary>
@@ -678,12 +678,12 @@ namespace json
678678
class json_error_category_impl : public std::error_category
679679
{
680680
public:
681-
virtual const char* json_error_category_impl::name() const
681+
virtual const char* json_error_category_impl::name() const override
682682
{
683683
return "json";
684684
}
685685

686-
virtual std::string json_error_category_impl::message(int ev) const
686+
virtual std::string json_error_category_impl::message(int ev) const override
687687
{
688688
switch (ev)
689689
{
@@ -715,11 +715,7 @@ namespace json
715715
}
716716
};
717717

718-
inline const json_error_category_impl& json_error_category()
719-
{
720-
static json_error_category_impl instance;
721-
return instance;
722-
}
718+
_ASYNCRTIMP const json_error_category_impl& json_error_category();
723719
}
724720

725721
/// <summary>

Release/src/json/json.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,3 +456,9 @@ web::json::value& web::json::value::operator[](size_t index)
456456
}
457457
return m_value->index(index);
458458
}
459+
460+
const web::json::details::json_error_category_impl& web::json::details::json_error_category()
461+
{
462+
static web::json::details::json_error_category_impl instance;
463+
return instance;
464+
}

0 commit comments

Comments
 (0)