xref: /openbsd-src/lib/libexpat/tests/memcheck.h (revision 08819b4170fcd59bf2520ff6a2d2af47b8c56234)
12e724bc9Sbluhm /* Interface to allocation functions that will track what has or has
22e724bc9Sbluhm    not been freed.
32e724bc9Sbluhm                             __  __            _
42e724bc9Sbluhm                          ___\ \/ /_ __   __ _| |_
52e724bc9Sbluhm                         / _ \\  /| '_ \ / _` | __|
62e724bc9Sbluhm                        |  __//  \| |_) | (_| | |_
72e724bc9Sbluhm                         \___/_/\_\ .__/ \__,_|\__|
82e724bc9Sbluhm                                  |_| XML parser
92e724bc9Sbluhm 
10*08819b41Sbluhm    Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
11*08819b41Sbluhm    Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
122e724bc9Sbluhm    Licensed under the MIT license:
132e724bc9Sbluhm 
142e724bc9Sbluhm    Permission is  hereby granted,  free of charge,  to any  person obtaining
152e724bc9Sbluhm    a  copy  of  this  software   and  associated  documentation  files  (the
162e724bc9Sbluhm    "Software"),  to  deal in  the  Software  without restriction,  including
172e724bc9Sbluhm    without  limitation the  rights  to use,  copy,  modify, merge,  publish,
182e724bc9Sbluhm    distribute, sublicense, and/or sell copies of the Software, and to permit
192e724bc9Sbluhm    persons  to whom  the Software  is  furnished to  do so,  subject to  the
202e724bc9Sbluhm    following conditions:
212e724bc9Sbluhm 
222e724bc9Sbluhm    The above copyright  notice and this permission notice  shall be included
232e724bc9Sbluhm    in all copies or substantial portions of the Software.
242e724bc9Sbluhm 
252e724bc9Sbluhm    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
262e724bc9Sbluhm    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
272e724bc9Sbluhm    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
282e724bc9Sbluhm    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
292e724bc9Sbluhm    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
302e724bc9Sbluhm    OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
312e724bc9Sbluhm    USE OR OTHER DEALINGS IN THE SOFTWARE.
3233ab7b2bSbluhm */
3333ab7b2bSbluhm 
3433ab7b2bSbluhm #ifdef __cplusplus
3533ab7b2bSbluhm extern "C" {
3633ab7b2bSbluhm #endif
3733ab7b2bSbluhm 
3833ab7b2bSbluhm #ifndef XML_MEMCHECK_H
3933ab7b2bSbluhm #  define XML_MEMCHECK_H 1
4033ab7b2bSbluhm 
4133ab7b2bSbluhm /* Allocation declarations */
4233ab7b2bSbluhm 
4333ab7b2bSbluhm void *tracking_malloc(size_t size);
4433ab7b2bSbluhm void tracking_free(void *ptr);
4533ab7b2bSbluhm void *tracking_realloc(void *ptr, size_t size);
4633ab7b2bSbluhm 
4733ab7b2bSbluhm /* End-of-test check to see if unfreed allocations remain. Returns
4833ab7b2bSbluhm  * TRUE (1) if there is nothing, otherwise prints a report of the
4933ab7b2bSbluhm  * remaining allocations and returns FALSE (0).
5033ab7b2bSbluhm  */
5133ab7b2bSbluhm int tracking_report(void);
5233ab7b2bSbluhm 
5333ab7b2bSbluhm #endif /* XML_MEMCHECK_H */
5433ab7b2bSbluhm 
5533ab7b2bSbluhm #ifdef __cplusplus
5633ab7b2bSbluhm }
5733ab7b2bSbluhm #endif
58