Some static

This commit is contained in:
Dale Weiler 2013-06-02 05:32:37 +00:00
parent 1ce8d2ea6e
commit ec7bf4767a

8
util.c
View file

@ -182,24 +182,24 @@ typedef struct {
typedef size_entry_t **size_table_t; typedef size_entry_t **size_table_t;
size_table_t util_st_new() { static size_table_t util_st_new() {
return (size_table_t)memset( return (size_table_t)memset(
mem_a(sizeof(size_entry_t*) * ST_SIZE), mem_a(sizeof(size_entry_t*) * ST_SIZE),
0, ST_SIZE * sizeof(size_entry_t*) 0, ST_SIZE * sizeof(size_entry_t*)
); );
} }
void util_st_del(size_table_t table) { static void util_st_del(size_table_t table) {
size_t i = 0; size_t i = 0;
for (; i < ST_SIZE; i++) if(table[i]) mem_d(table[i]); for (; i < ST_SIZE; i++) if(table[i]) mem_d(table[i]);
mem_d(table); mem_d(table);
} }
size_entry_t *util_st_get(size_table_t table, size_t key) { static size_entry_t *util_st_get(size_table_t table, size_t key) {
size_t hash = (key % ST_SIZE); size_t hash = (key % ST_SIZE);
while (table[hash] && table[hash]->key != key) while (table[hash] && table[hash]->key != key)
hash = (hash + 1) % ST_SIZE; hash = (hash + 1) % ST_SIZE;
return table[hash]; return table[hash];
} }
void util_st_put(size_table_t table, size_t key, size_t value) { static void util_st_put(size_table_t table, size_t key, size_t value) {
size_t hash = (key % ST_SIZE); size_t hash = (key % ST_SIZE);
while (table[hash] && table[hash]->key != key) while (table[hash] && table[hash]->key != key)
hash = (hash + 1) % ST_SIZE; hash = (hash + 1) % ST_SIZE;