--- cfg_grid.c 2002/11/09 16:55:23 1.3
+++ cfg_grid.c 2002/11/10 12:12:23 1.4
@@ -34,7 +34,7 @@
* size objects. Inside OSSP cfg 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 (cfg_grid_seg_t) of
* those fixed size objects (cfg_grid_tile_t) and linking them into
* a top-level grid structure (cfg_grid_t). The number of tiles in a
@@ -45,7 +45,7 @@
* arranged as a linear array after a heading 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
@@ -199,7 +199,7 @@
int g_tile_num_first; /* number of tiles in first segment */
};
-/*
+/*
* Align a size to the next larger or equal size which is likely to have the
* longest *relevant* CPU-specific memory word alignment restrictions.
*/
@@ -216,10 +216,10 @@
}
/* create a grid segment [INTERNAL] */
-static cfg_rc_t
+static cfg_rc_t
cfg_grid_seg_create(
- cfg_grid_seg_t **pseg,
- size_t tile_size,
+ cfg_grid_seg_t **pseg,
+ size_t tile_size,
int tile_num)
{
size_t seg_top_size;
@@ -275,7 +275,7 @@
return CFG_ERR_ARG;
if (tile_num < 1)
return CFG_ERR_ARG;
-
+
/* determine (aligned) sizes */
tile_size = cfg_mem_align(tile_size);
@@ -303,13 +303,13 @@
}
/* destroy a grid */
-cfg_rc_t
+cfg_rc_t
cfg_grid_destroy(
cfg_grid_t *grid)
{
cfg_grid_seg_t *seg;
cfg_grid_seg_t *seg_last;
-
+
/* consistency checks */
if (grid == NULL)
return CFG_ERR_ARG;
@@ -385,9 +385,9 @@
}
/* find grid segment where tile is stored [INTERNAL] */
-static cfg_rc_t
+static cfg_rc_t
cfg_grid_seg_find(
- cfg_grid_t *grid,
+ cfg_grid_t *grid,
cfg_grid_seg_t **pseg,
cfg_grid_tile_t *tile)
{
@@ -395,7 +395,7 @@
seg = CFG_RING_FIRST(&grid->g_seg);
while (seg != CFG_RING_SENTINEL(&grid->g_seg, cfg_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;
@@ -407,9 +407,9 @@
}
/* free a tile to a grid */
-cfg_rc_t
+cfg_rc_t
cfg_grid_free(
- cfg_grid_t *grid,
+ cfg_grid_t *grid,
void *_tile)
{
cfg_grid_seg_t *seg;
@@ -422,7 +422,7 @@
/* consistency checks */
if (grid == NULL || tile == NULL)
return CFG_ERR_ARG;
-
+
/* find segment of tile */
if ((rc = cfg_grid_seg_find(grid, &seg, tile)) != CFG_OK)
return rc;
@@ -443,13 +443,13 @@
}
/* test whether a tile is inside a grid */
-cfg_rc_t
+cfg_rc_t
cfg_grid_inside(
- cfg_grid_t *grid,
+ cfg_grid_t *grid,
void *_tile)
{
cfg_grid_tile_t *tile;
-
+
/* cast to internal structure */
tile = (cfg_grid_tile_t *)_tile;
@@ -462,11 +462,11 @@
}
/* determine grid statistics */
-cfg_rc_t
+cfg_rc_t
cfg_grid_stat(
- cfg_grid_t *grid,
- int *pchunks,
- int *pbytes_mgmt, int *pbytes_used, int *pbytes_free,
+ cfg_grid_t *grid,
+ int *pchunks,
+ int *pbytes_mgmt, int *pbytes_used, int *pbytes_free,
int *ptiles_used, int *ptiles_free)
{
cfg_grid_seg_t *seg;
|