38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
/*
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
* the terms of the GNU Lesser General Public License as published by the Free
|
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
|
* later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
* details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <cjson/cJSON.h>
|
|
#include <mastodont_hooks.h>
|
|
|
|
struct mstdnt_hooks _mstdnt_hooks_def = {
|
|
.malloc = malloc,
|
|
.free = free,
|
|
.calloc = calloc,
|
|
.realloc = realloc,
|
|
};
|
|
|
|
void mstdnt_set_hooks(struct mstdnt_hooks* hooks)
|
|
{
|
|
cJSON_Hooks cjson_hooks = {
|
|
.malloc_fn = hooks->malloc,
|
|
.free_fn = hooks->free,
|
|
};
|
|
cJSON_InitHooks(&hooks);
|
|
|
|
_mstdnt_hooks_def = *hooks;
|
|
}
|
|
|