sox.1: fix example for mcompand
[sox.git] / src / xmalloc.h
blob21ff6630919dcb265644b5f883804f5167a25387
1 /* libSoX Memory allocation functions
3 * Copyright (c) 2005-2006 Reuben Thomas. All rights reserved.
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation; either version 2.1 of the License, or (at
8 * your option) any later version.
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
13 * General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef LSX_MALLOC_H
21 #define LSX_MALLOC_H
23 #include <stddef.h>
24 #include <string.h>
26 LSX_RETURN_VALID void *lsx_malloc(size_t size);
27 LSX_RETURN_VALID void *lsx_calloc(size_t n, size_t size);
28 LSX_RETURN_VALID void *lsx_realloc_array(void *p, size_t n, size_t size);
29 LSX_RETURN_VALID char *lsx_strdup(const char *s);
31 #define lsx_Calloc(v,n) v = lsx_calloc(n,sizeof(*(v)))
32 #define lsx_memdup(p,s) ((p)? memcpy(lsx_malloc(s), p, s) : NULL)
33 #define lsx_valloc(v,n) v = lsx_realloc_array(NULL, n, sizeof(*(v)))
34 #define lsx_revalloc(v,n) v = lsx_realloc_array(v, n, sizeof(*(v)))
36 #endif