1
1

correct data types - index is not size_t - add comments.

This commit was SVN r668.
Этот коммит содержится в:
Rich Graham 2004-02-09 23:27:43 +00:00
родитель c8a7c96ea8
Коммит 568d047222
2 изменённых файлов: 41 добавлений и 7 удалений

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

@ -21,10 +21,11 @@
*
* @return Array index where ptr is inserted
*/
int lam_pointer_array_add(lam_pointer_array_t *table, void *ptr)
size_t lam_pointer_array_add(lam_pointer_array_t *table, void *ptr)
{
void **p;
int index, i;
int i;
size_t index;
enum { TABLE_INIT = 1, TABLE_GROW = 2 };
if (LAM_ENABLE_DEBUG) {
@ -180,7 +181,7 @@ int lam_pointer_array_set_item(lam_pointer_array_t *table, size_t index,
*
* @return Pointer
*/
void *lam_pointer_array_get_item(lam_pointer_array_t *table, int index)
void *lam_pointer_array_get_item(lam_pointer_array_t *table, size_t index)
{
void *p;

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

@ -14,19 +14,52 @@
typedef struct lam_pointer_array lam_pointer_array_t;
/*
* dynamic pointer table (used for MPI requests, dataytypes and ops)
* dynamic pointer array
*/
struct lam_pointer_array {
/* synchronization object */
lam_mutex_t lock;
/* index of lowest free element */
size_t lowest_free;
/* number of fee elements in the list */
size_t number_free;
/* size of list, i.e. number of elements in addr */
size_t size;
/* pointer to array of pointers */
void **addr;
};
int lam_pointer_array_add(lam_pointer_array_t *table, void *ptr);
int lam_pointer_array_set_item(lam_pointer_array_t *table,
/**
* Add a pointer to the array (Grow the array, if need be)
*
* @param array Pointer to array (IN)
* @param ptr Pointer value (IN)
*
* @return Index of inserted array element. Return value of
* (size_t)(-1) indicates an error.
*/
size_t lam_pointer_array_add(lam_pointer_array_t *array, void *ptr);
/**
* Set the value of an element in array
*
* @param array Pointer to array (IN)
* @param index Index of element to be reset (IN)
* @param value New value to be set at element index (IN)
*
* @return Error code. (-1) indicates an error.
*/
int lam_pointer_array_set_item(lam_pointer_array_t *array,
size_t index, void *value);
void *lam_pointer_array_get_item(lam_pointer_array_t *table, int index);
/**
* Get the value of an element in array
*
* @param array Pointer to array (IN)
* @param index Index of element to be returned (IN)
*
* @return Error code. NULL indicates an error.
*/
void *lam_pointer_array_get_item(lam_pointer_array_t *array, size_t index);
#endif /* _MPI_F2C_TABLE */