ofed: use ANSI C functions definitions in opensm/sm.c

Sponsored by:	NVidia networking
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2023-12-26 21:16:49 +02:00
parent c1b12377a6
commit bf7830d79d

View file

@ -174,7 +174,7 @@ static int new_size(int size)
static int collision = 0;
static int init_st = 0;
static void stat_col()
static void stat_col(void)
{
FILE *f = fopen("/var/log/osm_st_col", "w");
fprintf(f, "collision: %d\n", collision);
@ -182,9 +182,7 @@ static void stat_col()
}
#endif
st_table *st_init_table_with_size(type, size)
struct st_hash_type *type;
size_t size;
st_table *st_init_table_with_size(struct st_hash_type *type, size_t size)
{
st_table *tbl;
@ -208,8 +206,7 @@ size_t size;
return tbl;
}
st_table *st_init_table(type)
struct st_hash_type *type;
st_table *st_init_table(struct st_hash_type *type)
{
return st_init_table_with_size(type, 0);
}
@ -219,8 +216,7 @@ st_table *st_init_numtable(void)
return st_init_table(&type_numhash);
}
st_table *st_init_numtable_with_size(size)
size_t size;
st_table *st_init_numtable_with_size(size_t size)
{
return st_init_table_with_size(&type_numhash, size);
}
@ -230,14 +226,12 @@ st_table *st_init_strtable(void)
return st_init_table(&type_strhash);
}
st_table *st_init_strtable_with_size(size)
size_t size;
st_table *st_init_strtable_with_size(size_t size)
{
return st_init_table_with_size(&type_strhash, size);
}
void st_free_table(table)
st_table *table;
void st_free_table(st_table *table)
{
register st_table_entry *ptr, *next;
int i;
@ -276,10 +270,7 @@ st_table *table;
}\
} while (0)
int st_lookup(table, key, value)
st_table *table;
register st_data_t key;
st_data_t *value;
int st_lookup(st_table *table, st_data_t key, st_data_t *value)
{
unsigned int hash_val, bin_pos;
register st_table_entry *ptr;
@ -315,10 +306,7 @@ do {\
table->num_entries++;\
} while (0);
int st_insert(table, key, value)
register st_table *table;
register st_data_t key;
st_data_t value;
int st_insert(st_table *table, st_data_t key, st_data_t value)
{
unsigned int hash_val, bin_pos;
register st_table_entry *ptr;
@ -335,10 +323,7 @@ st_data_t value;
}
}
void st_add_direct(table, key, value)
st_table *table;
st_data_t key;
st_data_t value;
void st_add_direct(st_table *table, st_data_t key, st_data_t value)
{
unsigned int hash_val, bin_pos;
@ -347,8 +332,7 @@ st_data_t value;
ADD_DIRECT(table, key, value, hash_val, bin_pos);
}
static void rehash(table)
register st_table *table;
static void rehash(st_table *table)
{
register st_table_entry *ptr, *next, **new_bins;
int i, old_num_bins = table->num_bins, new_num_bins;
@ -376,8 +360,7 @@ register st_table *table;
table->bins = new_bins;
}
st_table *st_copy(old_table)
st_table *old_table;
st_table *st_copy(st_table *old_table)
{
st_table *new_table;
st_table_entry *ptr, *entry;
@ -416,10 +399,7 @@ st_table *old_table;
return new_table;
}
int st_delete(table, key, value)
register st_table *table;
register st_data_t *key;
st_data_t *value;
int st_delete(st_table *table, st_data_t *key, st_data_t *value)
{
unsigned int hash_val;
st_table_entry *tmp;
@ -460,11 +440,8 @@ st_data_t *value;
return 0;
}
int st_delete_safe(table, key, value, never)
register st_table *table;
register st_data_t *key;
st_data_t *value;
st_data_t never;
int st_delete_safe(st_table *table, st_data_t *key, st_data_t *value,
st_data_t never)
{
unsigned int hash_val;
register st_table_entry *ptr;
@ -499,9 +476,7 @@ static int delete_never(st_data_t key, st_data_t value, st_data_t never)
return ST_CONTINUE;
}
void st_cleanup_safe(table, never)
st_table *table;
st_data_t never;
void st_cleanup_safe(st_table *table, st_data_t never)
{
int num_entries = table->num_entries;
@ -509,10 +484,9 @@ st_data_t never;
table->num_entries = num_entries;
}
void st_foreach(table, func, arg)
st_table *table;
int (*func) (st_data_t key, st_data_t val, st_data_t arg);
st_data_t arg;
void st_foreach(st_table *table,
int (*func)(st_data_t key, st_data_t val, st_data_t arg),
st_data_t arg)
{
st_table_entry *ptr, *last, *tmp;
enum st_retval retval;
@ -544,8 +518,7 @@ st_data_t arg;
}
}
static int strhash(string)
register const char *string;
static int strhash(const char *string)
{
register int c;
@ -578,14 +551,12 @@ register const char *string;
#endif
}
static int numcmp(x, y)
void *x, *y;
static int numcmp(void *x, void *y)
{
return (st_ptr_t) x != (st_ptr_t) y;
}
static st_ptr_t numhash(n)
void *n;
static st_ptr_t numhash(void *n)
{
return (st_ptr_t) n;
}