summaryrefslogtreecommitdiffstats
path: root/src/sat/satoko/utils/mem.h
blob: 5ff9873d432edf9b736be19e9d9322cfefe67f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//===--- mem.h --------------------------------------------------------------===
//
//                     satoko: Satisfiability solver
//
// This file is distributed under the BSD 2-Clause License.
// See LICENSE for details.
//
//===------------------------------------------------------------------------===
#ifndef satoko__utils__mem_h
#define satoko__utils__mem_h

#include <stdlib.h>

#include "misc/util/abc_global.h"
ABC_NAMESPACE_HEADER_START

#define satoko_alloc(type, n_elements) ((type *) malloc((n_elements) * sizeof(type)))
#define satoko_calloc(type, n_elements) ((type *) calloc((n_elements), sizeof(type)))
#define satoko_realloc(type, ptr, n_elements) ((type *) realloc(ptr, (n_elements) * sizeof(type)))
#define satoko_free(p) do { free(p); p = NULL; } while(0)

ABC_NAMESPACE_HEADER_END
#endif