Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ void* get_string_map_element(string_map* map, const char* key)
void* get_string_map_element_with_hashed_key(string_map* map, unsigned long hashed_key)
{
void* return_value;
if(map == NULL)
{
return NULL;
}
/* printk("doing lookup for key = %lu\n", hashed_key); */
return_value = get_long_map_element( &(map->lm), hashed_key);
if(return_value != NULL && map->store_keys)
Expand Down Expand Up @@ -278,6 +282,16 @@ void* remove_string_map_element(string_map* map, const char* key)
char** get_string_map_keys(string_map* map, unsigned long* num_keys_returned)
{
char** str_keys;
if(map == NULL)
{
*num_keys_returned = 0;
str_keys = (char**)malloc(sizeof(char*));
if(str_keys != NULL)
{
str_keys[0] = NULL;
}
return str_keys;
}
str_keys = (char**)malloc((map->num_elements+1)*sizeof(char*));
if(str_keys == NULL) /* deal with malloc failure */
{
Expand Down Expand Up @@ -1079,6 +1093,11 @@ static unsigned long sdbm_string_hash(const char *key)
{
unsigned long hashed_key = 0;

if(key == NULL)
{
return hashed_key;
}

int index = 0;
unsigned int nextch;
while(key[index] != '\0')
Expand Down