1
1

Change the pointer array functions to return LAM_ERROR instead of -1

This commit was SVN r936.
Этот коммит содержится в:
Jeff Squyres 2004-03-19 14:15:16 +00:00
родитель 61f9cc7792
Коммит 5a1bc373a3
2 изменённых файлов: 13 добавлений и 13 удалений

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

@ -29,7 +29,7 @@ lam_group_t lam_mpi_group_empty = {
{ NULL, 0 }, /* base class */
0, /* number of processes in group */
MPI_PROC_NULL, /* rank in group */
-1, /* index in Fortran <-> C translation array */
LAM_ERROR, /* index in Fortran <-> C translation array */
(lam_proc_t **)NULL /* pointers to lam_proc_t structures */
};
@ -41,7 +41,7 @@ lam_group_t lam_mpi_group_null = {
{ NULL, 0 }, /* base class */
0, /* number of processes in group */
MPI_PROC_NULL, /* rank in group */
-1, /* index in Fortran <-> C translation array */
LAM_ERROR, /* index in Fortran <-> C translation array */
(lam_proc_t **)NULL /* pointers to lam_proc_t structures */
};
@ -57,11 +57,6 @@ lam_group_t *lam_group_allocate(int group_size)
/* create new group group element */
new_group=OBJ_NEW(lam_group_t);
if( -1 == new_group->grp_f_to_c_index){
OBJ_RELEASE(new_group);
new_group=NULL;
}
if( new_group ) {
/* allocate array of (lam_proc_t *)'s, one for each
* process in the group */
@ -80,6 +75,11 @@ lam_group_t *lam_group_allocate(int group_size)
new_group->grp_proc_count=group_size;
}
if( LAM_ERROR == new_group->grp_f_to_c_index){
OBJ_RELEASE(new_group);
new_group=NULL;
}
/* return */
return new_group;
}
@ -154,7 +154,7 @@ int lam_group_init(void)
/* add MPI_GROUP_NULL to table */
ret_val=lam_pointer_array_add(lam_group_f_to_c_table,&lam_mpi_group_null);
if( -1 == ret_val ){
if( LAM_ERROR == ret_val ){
return LAM_ERROR;
};
/* make sure that MPI_GROUP_NULL is in location in the table */
@ -165,7 +165,7 @@ int lam_group_init(void)
/* add MPI_GROUP_EMPTY to table */
ret_val=lam_pointer_array_add(lam_group_f_to_c_table,&lam_mpi_group_empty);
if( -1 == ret_val ){
if( LAM_ERROR == ret_val ){
return LAM_ERROR;
};
/* make sure that MPI_GROUP_NULL is in location in the table */

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

@ -57,7 +57,7 @@ void lam_pointer_array_destruct(lam_pointer_array_t *array){
* @param table Pointer to lam_pointer_array_t object (IN)
* @param ptr Pointer to be added to table (IN)
*
* @return Array index where ptr is inserted
* @return Array index where ptr is inserted or LAM_ERROR if it fails
*/
size_t lam_pointer_array_add(lam_pointer_array_t *table, void *ptr)
{
@ -90,7 +90,7 @@ size_t lam_pointer_array_add(lam_pointer_array_t *table, void *ptr)
p = malloc(TABLE_INIT * sizeof(void *));
if (p == NULL) {
THREAD_UNLOCK(&(table->lock));
return -1;
return LAM_ERROR;
}
table->lowest_free = 0;
table->number_free = TABLE_INIT;
@ -114,7 +114,7 @@ size_t lam_pointer_array_add(lam_pointer_array_t *table, void *ptr)
p = realloc(table->addr, TABLE_GROW * table->size * sizeof(void *));
if (p == NULL) {
THREAD_UNLOCK(&(table->lock));
return -1;
return LAM_ERROR;
}
table->lowest_free = table->size;
table->number_free = (TABLE_GROW - 1) * table->size;
@ -196,7 +196,7 @@ int lam_pointer_array_set_item(lam_pointer_array_t *table, size_t index,
void *p = realloc(table->addr, new_size * sizeof(void *));
if (p == NULL) {
THREAD_UNLOCK(&(table->lock));
return -1;
return LAM_ERROR;
}
table->number_free += new_size - table->size;
table->addr = p;