1
1

Clean up the opal_free_list code. We don't use the user_data flag in the

opal_free_list_item_t and everyone was just treating them as
opal_list_itme_t structures, which meant that they were overwriting the
user_data memory anyway.  So make an opal_free_lsit_item_t be just a
opal_list_item_t.

Also, opal_free_list_item_t wasn't a proper class, which made it slightly
less than nice to use, so fix that part up.  Also update the
opal_free_list_t to use the class macros, so that it is more obvious we
actually do the right thing.

This commit was SVN r10304.
Этот коммит содержится в:
Brian Barrett 2006-06-12 14:49:03 +00:00
родитель d3257f22d8
Коммит f0a690933f
2 изменённых файлов: 9 добавлений и 12 удалений

Просмотреть файл

@ -25,14 +25,13 @@
static void opal_free_list_construct(opal_free_list_t* fl);
static void opal_free_list_destruct(opal_free_list_t* fl);
opal_class_t opal_free_list_t_class = {
"opal_free_list_t",
OBJ_CLASS(opal_list_t),
(opal_construct_t)opal_free_list_construct,
(opal_destruct_t)opal_free_list_destruct
};
OBJ_CLASS_INSTANCE(opal_free_list_t,
opal_list_t,
opal_free_list_construct,
opal_free_list_destruct);
OBJ_CLASS_INSTANCE(opal_free_list_item_t,
opal_list_item_t,
NULL, NULL);
static void opal_free_list_construct(opal_free_list_t* fl)
{
@ -110,7 +109,6 @@ int opal_free_list_grow(opal_free_list_t* flist, size_t num_elements)
for(i=0; i<num_elements; i++) {
opal_free_list_item_t* item = (opal_free_list_item_t*)ptr;
item->user_data = NULL;
if (NULL != flist->fl_elem_class) {
OBJ_CONSTRUCT_INTERNAL(item, flist->fl_elem_class);
}

Просмотреть файл

@ -29,8 +29,6 @@
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
OMPI_DECLSPEC extern opal_class_t opal_free_list_t_class;
struct opal_free_list_t
{
@ -46,13 +44,14 @@ struct opal_free_list_t
opal_list_t fl_allocations;
};
typedef struct opal_free_list_t opal_free_list_t;
OBJ_CLASS_DECLARATION(opal_free_list_t);
struct opal_free_list_item_t
{
opal_list_item_t super;
void* user_data;
};
typedef struct opal_free_list_item_t opal_free_list_item_t;
OBJ_CLASS_DECLARATION(opal_free_list_item_t);
/**
* Initialize a free list.