1
1

Convert to use an accessor function (lam_pointer_array_get_size()) so

that we hide the internal member field

This commit was SVN r949.
Этот коммит содержится в:
Jeff Squyres 2004-03-20 01:54:18 +00:00
родитель f31f7fc207
Коммит cfe2bd2427
4 изменённых файлов: 23 добавлений и 9 удалений

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

@ -1,5 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; /*
*
* $HEADER$ * $HEADER$
*/ */

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

@ -2,9 +2,8 @@
* $HEADER$ * $HEADER$
*/ */
#ifndef _LAM_POINTER_ARRAY #ifndef LAM_POINTER_ARRAY_H
#define _LAM_POINTER_ARRAY #define LAM_POINTER_ARRAY_H
#include "threads/mutex.h" #include "threads/mutex.h"
#include "lfc/lam_object.h" #include "lfc/lam_object.h"
@ -23,7 +22,7 @@ struct lam_pointer_array_t {
lam_object_t super; lam_object_t super;
/* synchronization object */ /* synchronization object */
lam_mutex_t lock; lam_mutex_t lock;
/* inde_ of lowest free element */ /* index of lowest free element */
size_t lowest_free; size_t lowest_free;
/* number of fee elements in the list */ /* number of fee elements in the list */
size_t number_free; size_t number_free;
@ -67,4 +66,19 @@ int lam_pointer_array_set_item(lam_pointer_array_t *array,
*/ */
void *lam_pointer_array_get_item(lam_pointer_array_t *array, size_t index); void *lam_pointer_array_get_item(lam_pointer_array_t *array, size_t index);
#endif /* _LAM_POINTER_ARRAY*/ /**
* Get the size of the pointer array
*
* @param array Pointer to array (IN)
*
* @returns size Size of the array
*
* Simple inline function to return the size of the array in order to
* hide the member field from external users.
*/
static inline size_t lam_pointer_array_get_size(lam_pointer_array_t *array)
{
return array->size;
}
#endif /* LAM_POINTER_ARRAY_H */

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

@ -21,7 +21,8 @@ MPI_Errhandler MPI_Errhandler_f2c(MPI_Fint errhandler_f)
/* Error checking */ /* Error checking */
if (MPI_PARAM_CHECK) { if (MPI_PARAM_CHECK) {
if (0 > eh_index || eh_index >= lam_errhandler_f_to_c_table->size) { if (0 > eh_index ||
eh_index >= lam_pointer_array_get_size(lam_errhandler_f_to_c_table)) {
return MPI_ERRHANDLER_NULL; return MPI_ERRHANDLER_NULL;
} }
} }

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

@ -25,7 +25,7 @@ MPI_Group MPI_Group_f2c(MPI_Fint group_f)
if (0 > group_index) { if (0 > group_index) {
return MPI_GROUP_NULL; return MPI_GROUP_NULL;
} }
if (group_index >= lam_group_f_to_c_table->size) { if (group_index >= lam_pointer_array_get_size(lam_group_f_to_c_table)) {
return MPI_GROUP_NULL; return MPI_GROUP_NULL;
} }
} }