--- act_grid.c 2002/01/19 13:28:55 1.9
+++ act_grid.c 2003/01/06 12:10:57 1.10
@@ -1,9 +1,10 @@
-/*
-** Act - Abstract Container Type Library
-** Copyright (c) 1999-2002 Ralf S. Engelschall <rse@engelschall.com>
+/*
+** OSSP act - Abstract Container Types
+** Copyright (c) 1999-2003 Ralf S. Engelschall <rse@engelschall.com>
+** Copyright (c) 1999-2003 The OSSP Project <http://www.ossp.org/>
**
-** This file is part of Act, a library for dealing with Abstract
-** Container Types which can be found at http://www.ossp.org/pkg/act/.
+** This file is part of OSSP act, an abstract container type library
+** which can be found at http://www.ossp.org/pkg/lib/act/.
**
** Permission to use, copy, modify, and distribute this software for
** any purpose with or without fee is hereby granted, provided that
@@ -32,7 +33,7 @@
* size objects. Inside OSSP act we have lots of those objects and
* if we would manage them directly through malloc(3) it would be to
* run-time expensive and waste too much total memory.
- *
+ *
* It works by collecting together larger segments (act_grid_seg_t) of
* those fixed size objects (act_grid_tile_t) and linking them into
* a top-level grid structure (act_grid_t). The number of tiles in a
@@ -43,7 +44,7 @@
* arranged as a linar array after a linkage structure. The free tiles
* are remembered in a single linked list. So the grid in memory looks
* like this:
- *
+ *
* -----BEGIN EMBEDDED OBJECT-----
* Content-type: application/fig
* Description: grid memory allocator memory architecture
@@ -115,11 +116,11 @@
};
/* create a grid segment [INTERNAL] */
-static act_rc_t
+static act_rc_t
act_grid_seg_create(
- act_ctx_t *ctx,
- act_grid_seg_t **pseg,
- size_t tile_size,
+ act_ctx_t *ctx,
+ act_grid_seg_t **pseg,
+ size_t tile_size,
int tile_num)
{
size_t seg_top_size;
@@ -163,7 +164,7 @@
act_rc_t
act_grid_create(
act_grid_t **pgrid,
- act_ctx_t *ctx,
+ act_ctx_t *ctx,
size_t tile_size,
int tile_num)
{
@@ -175,7 +176,7 @@
act_argcheck(ctx != NULL);
act_argcheck(tile_size >= 1);
act_argcheck(tile_num >= 1);
-
+
/* determine (aligned) sizes */
tile_size = act_mem_align(tile_size);
@@ -204,13 +205,13 @@
}
/* destroy a grid */
-act_rc_t
+act_rc_t
act_grid_destroy(
act_grid_t *grid)
{
act_grid_seg_t *seg;
act_grid_seg_t *seg_last;
-
+
/* consistency checks */
act_argcheck(grid != NULL);
@@ -284,9 +285,9 @@
}
/* find grid segment where tile is stored [INTERNAL] */
-static act_rc_t
+static act_rc_t
act_grid_seg_find(
- act_grid_t *grid,
+ act_grid_t *grid,
act_grid_seg_t **pseg,
act_grid_tile_t *tile)
{
@@ -294,7 +295,7 @@
seg = ACT_RING_FIRST(&grid->g_seg);
while (seg != ACT_RING_SENTINEL(&grid->g_seg, act_grid_seg_t, gs_link)) {
- if ( seg->gs_tile_base <= tile
+ if ( seg->gs_tile_base <= tile
&& tile < (seg->gs_tile_base+(grid->g_tile_size*seg->gs_tile_num))) {
if (pseg != NULL)
*pseg = seg;
@@ -306,9 +307,9 @@
}
/* free a tile to a grid */
-act_rc_t
+act_rc_t
act_grid_free(
- act_grid_t *grid,
+ act_grid_t *grid,
void *_tile)
{
act_grid_seg_t *seg;
@@ -321,7 +322,7 @@
/* consistency checks */
act_argcheck(grid != NULL);
act_argcheck(tile != NULL);
-
+
/* find segment of tile */
if ((rc = act_grid_seg_find(grid, &seg, tile)) != ACT_OK)
return rc;
@@ -342,13 +343,13 @@
}
/* test whether a tile is inside a grid */
-act_rc_t
+act_rc_t
act_grid_inside(
- act_grid_t *grid,
+ act_grid_t *grid,
void *_tile)
{
act_grid_tile_t *tile;
-
+
/* cast to internal structure */
tile = (act_grid_tile_t *)_tile;
@@ -361,11 +362,11 @@
}
/* determine grid statistics */
-act_rc_t
+act_rc_t
act_grid_stat(
- act_grid_t *grid,
- int *pchunks,
- int *pbytes_mgmt, int *pbytes_used, int *pbytes_free,
+ act_grid_t *grid,
+ int *pchunks,
+ int *pbytes_mgmt, int *pbytes_used, int *pbytes_free,
int *ptiles_used, int *ptiles_free)
{
act_grid_seg_t *seg;
|