1 /* PSPP - computes sample statistics.
2 Copyright (C) 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program 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
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 /* Records the state of a pool for later restoration. */
28 /* Current block and offset into it. */
29 struct pool_block *block;
32 /* Current serial number to allow freeing of gizmos. */
36 /* General routines. */
37 struct pool *pool_create (void);
38 void pool_destroy (struct pool *);
39 void pool_clear (struct pool *);
41 /* Suballocation routines. */
42 void *pool_alloc (struct pool *, size_t) MALLOC_LIKE;
43 void *pool_clone (struct pool *, const void *, size_t) MALLOC_LIKE;
44 char *pool_strdup (struct pool *, const char *) MALLOC_LIKE;
45 char *pool_strndup (struct pool *, const char *, size_t) MALLOC_LIKE;
46 char *pool_strcat (struct pool *, const char *, ...) MALLOC_LIKE;
48 /* Standard allocation routines. */
49 void *pool_malloc (struct pool *, size_t) MALLOC_LIKE;
50 void *pool_realloc (struct pool *, void *, size_t);
51 void pool_free (struct pool *, void *);
53 /* Gizmo allocations. */
54 struct pool *pool_create_subpool (struct pool *);
55 FILE *pool_fopen (struct pool *, const char *, const char *);
56 int pool_fclose (struct pool *, FILE *);
58 /* Custom allocations. */
59 void pool_register (struct pool *, void (*free) (void *), void *p);
60 int pool_unregister (struct pool *, void *);
62 /* Partial freeing. */
63 void pool_mark (struct pool *, struct pool_mark *);
64 void pool_release (struct pool *, const struct pool_mark *);
67 void pool_dump (const struct pool *, const char *title);