]> icculus.org git repositories - icculus/xz.git/blob - src/lzma/alloc.h
Fixed the test that should have been fixed as part
[icculus/xz.git] / src / lzma / alloc.h
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       alloc.h
4 /// \brief      Memory allocation functions
5 //
6 //  Copyright (C) 2007 Lasse Collin
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Lesser General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2.1 of the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Lesser General Public License for more details.
17 //
18 ///////////////////////////////////////////////////////////////////////////////
19
20 #ifndef ALLOC_H
21 #define ALLOC_H
22
23 #include "private.h"
24
25
26 /// Safe malloc() that never returns NULL.
27 extern void *xmalloc(size_t size);
28
29 /// Safe realloc() that never returns NULL.
30 extern void *xrealloc(void *ptr, size_t size);
31
32 /// Safe strdup() that never returns NULL.
33 extern char *xstrdup(const char *src);
34
35 /// xrealloc()s *dest to the size needed by src, and copies src to *dest.
36 extern void xstrcpy(char **dest, const char *src);
37
38 /// Function for lzma_allocator.alloc. This uses xmalloc().
39 extern void *allocator(void *opaque lzma_attribute((unused)),
40                 size_t nmemb lzma_attribute((unused)), size_t size);
41
42 #endif