Skip to content

Commit

Permalink
refactor: usage of hash_map instead of dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
theoludwig committed Jun 25, 2023
1 parent 4a11a09 commit 256e9cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ string_t string_concatenate(string_t string1, string_t string2) {
bool string_get_has_unique_characters(const string_t string_value) {
bool has_unique = true;
size_t string_length = string_get_length(string_value);
struct dictionary* characters_already_seen = dictionary_initialization();
struct hash_map* characters_already_seen = hash_map_initialization();
for (size_t index = 0; index < string_length && has_unique; index++) {
char character = string_value[index];
string_t key = convert_character_to_string(character);
if (dictionary_contains_key(characters_already_seen, key)) {
if (hash_map_contains_key(characters_already_seen, key)) {
has_unique = false;
} else {
dictionary_add(characters_already_seen, key, (void*)true);
hash_map_add(characters_already_seen, key, (void*)true);
}
}
return has_unique;
Expand Down
2 changes: 1 addition & 1 deletion lib/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "character.h"
#include "convert.h"
#include "dictionary.h"
#include "hash_map.h"
#include "types.h"

/**
Expand Down

0 comments on commit 256e9cb

Please sign in to comment.