summaryrefslogtreecommitdiff
path: root/src/sstv.c
blob: e91ae2bbfb25b13dd9a074f0ecca0d37237519a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>
 *
 * libsstv is free software; you can redistribute it and/or modify
 * it under the terms of the MIT license. See LICENSE for details.
 */

#include "libsstv.h"

sstv_malloc_t sstv_malloc_user = NULL;
sstv_free_t sstv_free_user = NULL;

sstv_error_t
sstv_init(sstv_malloc_t alloc_func, sstv_free_t dealloc_func)
{
    /* Check that either both or none of the functions are provided */
    if ((!alloc_func && dealloc_func) || (alloc_func && !dealloc_func)) {
        return SSTV_BAD_INITIALIZERS;
    }

    /* Keep user functions for allocation/deallocation */
    sstv_malloc_user = alloc_func;
    sstv_free_user = dealloc_func;
    return SSTV_OK;
}