preparing for release of 2.2.3a
[Samba.git] / source / include / talloc.h
blob06efbf6952a26581cc282ff9f257d1eeba6be43e
1 #ifndef _TALLOC_H_
2 #define _TALLOC_H_
3 /*
4 Unix SMB/Netbios implementation.
5 Version 3.0
6 Samba temporary memory allocation functions
7 Copyright (C) Andrew Tridgell 2000
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 struct talloc_chunk {
25 struct talloc_chunk *next;
26 size_t size;
27 void *ptr;
30 typedef struct {
31 struct talloc_chunk *list;
32 size_t total_alloc_size;
33 } TALLOC_CTX;
35 /* free memory if the pointer is valid and zero the pointer */
36 #ifndef SAFE_FREE
37 #define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0)
38 #endif
40 #endif