* Type that defines a table entry
*/
typedef struct {
- char key[FRSH_HASH_TABLE_MAX_CHARS]; // array where the key is stored
- int value; // integer value (assumed non negative)
- frsh_hash_entry_status_t status; // indicates the entry status
+ char key[FRSH_HASH_TABLE_MAX_CHARS]; // array where the key is stored
+ unsigned int value; // unsigned integer value
+ frsh_hash_entry_status_t status; // indicates the entry status
} frsh_hash_entry_t;
/**
* FRSH_ERR_NO_SPACE if the maximum number of keys would be exceeded
*/
int frsh_hash_table_put (frsh_hash_table_t *table,
- const char * key, int value);
+ const char * key, unsigned int value);
/**
* Get the value assigned to a key.
- * Returns -1 if the key is not present
+ * Returns 0 if successful or -1 if the key is not present
*/
-int frsh_hash_table_get (frsh_hash_table_t *table, const char * key);
+int frsh_hash_table_get (frsh_hash_table_t *table,
+ const char * key, unsigned int * value);
/**
* Indicate whether or not the specified key is contained in the table
bool frsh_hash_table_contains_key (frsh_hash_table_t *table, const char * key);
/**
- * Remove an entry from the table
+ * Remove an entry from the table given a key
* Returns 0 if successful, or -1 if the key is not contained in the table
*/
int frsh_hash_table_remove (frsh_hash_table_t *table, const char * key);
-
#endif // FRSH_HASH_TABLE