Remove mxs::Closer<json_t*>
As std::unique_ptr can now be used with a json_t, there's no need for the closer.
This commit is contained in:
@ -21,7 +21,6 @@
|
||||
#include <maxbase/jansson.h>
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/debug.h>
|
||||
#include <maxscale/utils.hh>
|
||||
|
||||
namespace std
|
||||
{
|
||||
@ -40,28 +39,6 @@ struct default_delete<json_t>
|
||||
namespace maxscale
|
||||
{
|
||||
|
||||
/**
|
||||
* @class CloserTraits<json_t*> jansson.hh <maxscale/jansson.hh>
|
||||
*
|
||||
* Specialization of @c CloserTraits for @c json_t*.
|
||||
*/
|
||||
template<>
|
||||
struct CloserTraits<json_t*>
|
||||
{
|
||||
static void close_if(json_t* pJson)
|
||||
{
|
||||
if (pJson)
|
||||
{
|
||||
json_decref(pJson);
|
||||
}
|
||||
}
|
||||
|
||||
static void reset(json_t*& pJson)
|
||||
{
|
||||
pJson = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Convenience function for dumping JSON into a string
|
||||
*
|
||||
@ -83,11 +60,6 @@ static inline std::string json_dump(const json_t* json, int flags = 0)
|
||||
return rval;
|
||||
}
|
||||
|
||||
static inline std::string json_dump(const Closer<json_t*>& json, int flags = 0)
|
||||
{
|
||||
return json_dump(json.get(), flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert JSON to string
|
||||
*
|
||||
|
@ -154,7 +154,10 @@ struct CloserTraits
|
||||
*
|
||||
* @param t Close the resource *if* it has not been closed already.
|
||||
*/
|
||||
static void close_if(T t);
|
||||
static void close_if(T t)
|
||||
{
|
||||
static_assert(sizeof(T) != sizeof(T), "The base closer should never be used");
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets a reference to a resource. After the call, the value of t should
|
||||
|
Reference in New Issue
Block a user