Skip to content

Commit

Permalink
feat!: remove dictionary data structure
Browse files Browse the repository at this point in the history
Replaced by `hash_map`
  • Loading branch information
theoludwig committed Jun 25, 2023
1 parent 256e9cb commit baea00f
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 168 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

C is a low-level programming language and we often end up reinventing the wheel as the C standard library (`libc`) is quite small and in my humble opinion, not well designed.

**libcproject** solve this by providing common functions or data structures (`dictionary`, `linked_list`, `queue`, `stack`, etc.) we might need in our C projects.
**libcproject** solve this by providing common functions or data structures (`hash_map`, `array_list`, `linked_list`, `queue`, `stack`, etc.) we might need in our C projects.

[Online documentation](https://libcproject.vercel.app/).

Expand Down
64 changes: 0 additions & 64 deletions lib/dictionary.c

This file was deleted.

35 changes: 0 additions & 35 deletions lib/dictionary.h

This file was deleted.

16 changes: 0 additions & 16 deletions lib/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,6 @@ void terminal_print_linked_list(struct linked_list* linked_list, void (*print_el
printf("NULL\n");
}

void terminal_print_dictionary(struct dictionary* dictionary, void (*print_element)(void*)) {
if (dictionary == NULL) {
exit(EXIT_FAILURE);
}
printf("{\n");
for (size_t index = 0; index < dictionary->length; index++) {
struct dictionary_item* item = dictionary->items[index];
printf("\t\"");
terminal_print_string(item->key);
printf("\" -> ");
print_element(&item->data);
printf("\n");
}
printf("}\n");
}

void terminal_print_hash_map(struct hash_map* hash_map, void (*print_element)(void*)) {
if (hash_map == NULL) {
exit(EXIT_FAILURE);
Expand Down
10 changes: 0 additions & 10 deletions lib/terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <stdlib.h>

#include "character.h"
#include "dictionary.h"
#include "hash_map.h"
#include "linked_list.h"
#include "queue.h"
Expand Down Expand Up @@ -98,15 +97,6 @@ void terminal_print_queue(struct queue* queue, void (*print_element)(void*));
*/
void terminal_print_linked_list(struct linked_list* linked_list, void (*print_element)(void*));

/**
* @brief Print a dictionary.
*
* @param dictionary
* @param print_element
* @since v1.0.0
*/
void terminal_print_dictionary(struct dictionary* dictionary, void (*print_element)(void*));

/**
* @brief Print a hash map.
*
Expand Down
1 change: 0 additions & 1 deletion libcproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "lib/array_list.h"
#include "lib/character.h"
#include "lib/convert.h"
#include "lib/dictionary.h"
#include "lib/filesystem.h"
#include "lib/hash_map.h"
#include "lib/linked_list.h"
Expand Down
27 changes: 0 additions & 27 deletions test/dictionary_test.c

This file was deleted.

12 changes: 0 additions & 12 deletions test/dictionary_test.h

This file was deleted.

2 changes: 0 additions & 2 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "array_list_test.h"
#include "character_test.h"
#include "convert_test.h"
#include "dictionary_test.h"
#include "hash_map_test.h"
#include "linked_list_test.h"
#include "mathematics_test.h"
Expand All @@ -16,7 +15,6 @@ int main() {
array_list_test();
character_test();
convert_test();
dictionary_test();
hash_map_test();
linked_list_test();
mathematics_test();
Expand Down

0 comments on commit baea00f

Please sign in to comment.