1
1

change the pointers in the lam item to be volatile.

Add some to the list unit test.

This commit was SVN r547.
Этот коммит содержится в:
Rich Graham 2004-01-26 20:32:19 +00:00
родитель d78ddd7cf2
Коммит d5ae55fdcc
4 изменённых файлов: 40 добавлений и 10 удалений

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

@ -30,8 +30,8 @@ typedef struct lam_list_item
{
lam_object_t super;
lam_list_type_t lam_list_type;
struct lam_list_item *lam_list_next;
struct lam_list_item *lam_list_prev;
volatile struct lam_list_item *lam_list_next;
volatile struct lam_list_item *lam_list_prev;
} lam_list_item_t;
#if defined(c_plusplus) || defined(__cplusplus)
@ -103,7 +103,7 @@ static inline void lam_list_set_size(lam_list_t* list, size_t size)
*/
static inline lam_list_item_t* lam_list_get_first(lam_list_t* list)
{
return list->lam_list_head.lam_list_next;
return (lam_list_item_t *)list->lam_list_head.lam_list_next;
}
/*
@ -111,7 +111,7 @@ static inline lam_list_item_t* lam_list_get_first(lam_list_t* list)
*/
static inline lam_list_item_t* lam_list_get_last(lam_list_t* list)
{
return list->lam_list_tail.lam_list_prev;
return (lam_list_item_t *)list->lam_list_tail.lam_list_prev;
}
/*
@ -151,8 +151,8 @@ static inline lam_list_item_t *lam_list_remove_item
/* check to see that the item is in the list */
for (item_ptr = lam_list_get_first(list);
item_ptr != lam_list_get_end(list);
item_ptr = item_ptr->lam_list_next) {
if (item_ptr == item) {
item_ptr = (lam_list_item_t *)(item_ptr->lam_list_next)) {
if (item_ptr == (lam_list_item_t *) item) {
found = true;
break;
}
@ -169,7 +169,7 @@ static inline lam_list_item_t *lam_list_remove_item
/* reset previous pointer of next element */
item->lam_list_next->lam_list_prev=item->lam_list_prev;
return item->lam_list_prev;
return (lam_list_item_t *)item->lam_list_prev;
}
#if defined(c_plusplus) || defined(__cplusplus)

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

@ -150,8 +150,8 @@ static void show_module_version(const string& type_name,
modules = module_map[type_name];
for (item = lam_list_get_first(modules);
lam_list_get_end(modules) != item;
item = lam_list_get_next(item)) {
lam_list_get_last(modules) != item;
item = (lam_list_item *) lam_list_get_next(item)) {
module = (mca_base_module_t *) item;
if (want_all_modules || module->mca_module_name == module_name) {
show_mca_version(module, scope, ver_type);

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

@ -7,7 +7,36 @@
int main(int argc, char **argv)
{
/* local variables */
lam_list_t list;
lam_list_type_t list_type,list_type_out;
size_t list_size;
test_init("List");
/* initialize list */
lam_list_init(&list);
/* check length of list */
list_size=lam_list_get_size(&list);
if( 0 == list_size ) {
test_success();
} else {
test_failure(" lam_list_get_size");
}
/* check list type */
list_type=2;
lam_list_set_type(&list,list_type);
list_type_out=0;
list_type_out=lam_list_get_type(&list);
if( list_type_out == list_type ) {
test_success();
} else {
test_failure(" lam_list_set/get_type");
}
test_finalize();
return 0;
}

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

@ -84,7 +84,8 @@ int test_finalize(void)
return_value=1;
if( lam_n_tests == lam_n_success) {
fprintf(stderr," SUPPORT :: LAM Test Passed :: %s \n",lam_description);
fprintf(stderr," SUPPORT :: LAM Test Passed :: %s %d tests \n",
lam_description,lam_n_tests);
fflush(stderr);
} else {
fprintf(stderr," SUPPORT :: LAM Test failed :: %s :: %d of %d failed\n"