diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-07-04 02:29:43 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-07-04 02:29:43 +0000 |
commit | 003ecf68bbb0444adf5aee14613fd77422a5b07c (patch) | |
tree | ff6a518065974721889db1b12f3012728520fbd5 /epan/ftypes | |
parent | 456c6cab6646e37a028c7a8ec1bae3a8b6f07f5e (diff) |
Instead of using pointer casts in the slab allocator stuff, add a
"SLAB_ITEM_TYPE_DEFINE()" macro to define a union of the type of object
for the slab and a pointer to an object of that union type, and use that
type for items on the slab allocator free lists; that *should* avoid
having the compiler think two pointers to an item being added to or
removed from the free list don't point to the same object just because
they have different types.
svn path=/trunk/; revision=11306
Diffstat (limited to 'epan/ftypes')
-rw-r--r-- | epan/ftypes/ftypes.c | 4 | ||||
-rw-r--r-- | epan/ftypes/ftypes.h | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c index 8ec16bd6f7..211d33accf 100644 --- a/epan/ftypes/ftypes.c +++ b/epan/ftypes/ftypes.c @@ -1,5 +1,5 @@ /* - * $Id: ftypes.c,v 1.25 2004/07/04 00:28:11 guy Exp $ + * $Id: ftypes.c,v 1.26 2004/07/04 02:29:43 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -32,7 +32,7 @@ static ftype_t* type_list[FT_NUM_TYPES]; /* Space for quickly allocating/de-allocating fvalue_t's */ -SLAB_FREE_LIST_DECLARE(fvalue_t) +SLAB_FREE_LIST_DEFINE(fvalue_t) /* These are the ftype registration functions that need to be called. * This list and the initialization function could be produced diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h index 3c60b700bb..6796920790 100644 --- a/epan/ftypes/ftypes.h +++ b/epan/ftypes/ftypes.h @@ -1,7 +1,7 @@ /* ftypes.h * Definitions for field types * - * $Id: ftypes.h,v 1.34 2004/07/04 00:28:11 guy Exp $ + * $Id: ftypes.h,v 1.35 2004/07/04 02:29:43 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -231,6 +231,9 @@ void fvalue_init(fvalue_t *fv, ftenum_t ftype); +/* Define type needed for the fvalue_t free list. */ +SLAB_ITEM_TYPE_DEFINE(fvalue_t) + /* Free all memory used by an fvalue_t. With MSVC and a * libethereal.dll, we need a special declaration. */ |