1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 08:43:40 -07:00

Add public interface for mfs pool class.

Correct the documentation for MFS: constructor takes extend_by and unit_size in that order.

Copied from Perforce
 Change: 180372
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2012-11-06 17:08:58 +00:00
parent d743f8b510
commit 6b89b020c5
3 changed files with 71 additions and 8 deletions

56
mps/code/mpscmfs.h Normal file
View file

@ -0,0 +1,56 @@
/* mpscamfs.h: MEMORY POOL SYSTEM CLASS "MFS"
*
* $Id$
* Copyright (c) 2001-2012 Ravenbrook Limited. See end of file for license.
*/
#ifndef mpscmfs_h
#define mpscmfs_h
#include "mps.h"
extern mps_class_t mps_class_mfs(void);
#endif /* mpscmfs_h */
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2012 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Redistributions in any form must be accompanied by information on how
* to obtain complete source code for this software and any accompanying
* software that uses this software. The source code must either be
* included in the distribution or be available for no more than the cost
* of distribution plus a nominal fee, and must be freely redistributable
* under reasonable conditions. For an executable file, complete source
* code means the source code for all modules it contains. It does not
* include source code for modules or files that typically accompany the
* major components of the operating system on which the executable file
* runs.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

View file

@ -1,7 +1,7 @@
/* poolmfs.c: MANUAL FIXED SMALL UNIT POOL
*
* $Id$
* Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
* Copyright (c) 2001-2012 Ravenbrook Limited. See end of file for license.
*
* This is the implementation of the MFS pool class.
*
@ -32,6 +32,7 @@
*/
#include "mpscmfs.h"
#include "poolmfs.h"
#include "mpm.h"
@ -282,6 +283,12 @@ PoolClass PoolClassMFS(void)
}
mps_class_t mps_class_mfs(void)
{
return (mps_class_t)PoolClassMFS();
}
Bool MFSCheck(MFS mfs)
{
Arena arena;
@ -305,7 +312,7 @@ Bool MFSCheck(MFS mfs)
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
* Copyright (C) 2001-2012 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*

View file

@ -82,14 +82,14 @@ MFS interface
mps_res_t mps_pool_create(mps_pool_t *pool_o, mps_arena_t arena,
mps_class_t mps_class_mfs(),
mps_size_t unit_size,
mps_size_t extend_size)
``unit_size`` is the :term:`size` of blocks that will be allocated
from this pool, in :term:`bytes (1)`. It must be at least one
:term:`word`.
mps_size_t extend_size,
mps_size_t unit_size)
``extend_size`` is the :term:`size` of segment that the pool will
request from the :term:`arena`. It must be at least as big as
``unit_size``. If this is not a multiple of ``unit_size``, there
will be wasted space in each segment.
``unit_size`` is the :term:`size` of blocks that will be allocated
from this pool, in :term:`bytes (1)`. It must be at least one
:term:`word`.