chiark / gitweb /
Commit as 2.1.0.
[mLib] / pool-sub.c
CommitLineData
d94be366 1/* -*-c-*-
2 *
8656dc50 3 * $Id: pool-sub.c,v 1.2 2004/04/08 01:36:13 mdw Exp $
d94be366 4 *
5 * Subarenas in resource pools
6 *
7 * (c) 2000 Straylight/Edgeware
8 */
9
d4efbcd9 10/*----- Licensing notice --------------------------------------------------*
d94be366 11 *
12 * This file is part of the mLib utilities library.
13 *
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
d4efbcd9 18 *
d94be366 19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
d4efbcd9 23 *
d94be366 24 * You should have received a copy of the GNU Library General Public
25 * License along with mLib; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
d94be366 30/*----- Header files ------------------------------------------------------*/
31
32#include "pool.h"
33#include "sub.h"
34
35/*----- Main code ---------------------------------------------------------*/
36
37/* --- @pool_subarena@ --- *
38 *
39 * Arguments: @pool *p@ = pointer to the pool
40 *
41 * Returns: A subarena built from the pool's memory allocator.
42 *
43 * Use: Creates a suballocation arena attached to a pool. The arena
44 * and all of its memory will be freed when the pool is
45 * destroyed.
46 */
47
48subarena *pool_subarena(pool *p)
49{
50 subarena *sa = pool_alloc(p, sizeof(subarena));
51 subarena_create(sa, &p->a);
52 return (sa);
53}
54
55/*----- That's all, folks -------------------------------------------------*/