From 5730d6c04258e192195bfbbbed76d68fd78ed458 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Wed, 12 Jan 2022 20:26:08 +0800 Subject: Implement a simple hash table. It is a very basic and simple hash table. It is so simple that I hesitate to call it a hash table. Anyways, I think it suffices for my purposes here. * Makefile.am: Add necessary files. * grammar.c (new_tnt_string): Formatting. * ht.c (new_ht): Constructor (destroy_ht): Destructor (ht_expand): Rehash (ht_insert, ht_delete, ht_find): Main functions. * list.c (add_to_list, list_assure_size): Modify the use of realloc. * test/check_ht.c: Ensure this is working correctly. * util.c (read_entire_file): Modify the use of realloc. --- src/grammar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/grammar.c') diff --git a/src/grammar.c b/src/grammar.c index 508c8d8..692e858 100644 --- a/src/grammar.c +++ b/src/grammar.c @@ -322,7 +322,7 @@ print_grammar(const Grammar * const g) List * new_tnt_string(char *format, int format_len, ...) { - /* FORMAT_LEN does not include the terminating null byte, so it + /* FORMAT_LEN does not include the terminating null byte, and it should be > 0. */ if (format_len <= 0) return NULL; -- cgit v1.2.3-18-g5258