mirror of
				https://github.com/theoludwig/libcproject.git
				synced 2025-05-21 23:21:15 +02:00 
			
		
		
		
	refactor: usage of hash_map instead of dictionary
				
					
				
			This commit is contained in:
		| @@ -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 string_get_has_unique_characters(const string_t string_value) { | ||||||
|   bool has_unique = true; |   bool has_unique = true; | ||||||
|   size_t string_length = string_get_length(string_value); |   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++) { |   for (size_t index = 0; index < string_length && has_unique; index++) { | ||||||
|     char character = string_value[index]; |     char character = string_value[index]; | ||||||
|     string_t key = convert_character_to_string(character); |     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; |       has_unique = false; | ||||||
|     } else { |     } else { | ||||||
|       dictionary_add(characters_already_seen, key, (void*)true); |       hash_map_add(characters_already_seen, key, (void*)true); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   return has_unique; |   return has_unique; | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include "character.h" | #include "character.h" | ||||||
| #include "convert.h" | #include "convert.h" | ||||||
| #include "dictionary.h" | #include "hash_map.h" | ||||||
| #include "types.h" | #include "types.h" | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user