Add Closer, partial RAII class
Closer is a template using which C-style resources can be managed in a C++ context where exceptions can occur. By placing a C resource in a Closer instance, it is certain the resource will be freed when the closing scope is exited irrespective of whether that occurs due to the normal control flow, due to a return statement or an exception having been thrown. To be used with Closer, the CloserTraits template must be specialized for the type in question. With this change specializations are provided for FILE*, json_t*, pcre_code* and pcre2_match_data*.
This commit is contained in:
16
include/maxscale/jansson.h
Normal file
16
include/maxscale/jansson.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <jansson.h>
|
Reference in New Issue
Block a user