diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e184b1..b7cc965 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ if(BUILD_DOCS) endif() if (BUILD_TESTS) message(STATUS "Tests are going to be built.") - add_subdirectory(tests) + add_subdirectory(src/tests) enable_testing() add_test(NAME "FullLoop" COMMAND "fullloop") add_test(NAME "EarlyTrail" COMMAND "earlytrail") diff --git a/include/tokenizers.h b/include/tokenizers.h index 19256b3..af27230 100644 --- a/include/tokenizers.h +++ b/include/tokenizers.h @@ -30,10 +30,17 @@ /*! * \brief Tokenize IRCv3 tags * - * This function parses IRCv3 tags according to the specification at - * \param[in] str String containing a IRC source with or without the ':' prefix + * This function parses IRCv3 tags according to the specification at https://ircv3.net/specs/extensions/message-tags + * + * \param[in] str String containing list of tags */ llist_t* uirc_tokenizer_tag_list(const char* str); +/*! + * \brief Tokenize IRCv3 tag + * + * This function tokenizes a individual tag in format key=value + * \param[in] str String containing the key and optionally it's value + */ IRC_Tag* uirc_tokenizer_tag(const char* str); #endif /* UIRC_FEATURE_IRCV3 */ diff --git a/src/doc/main.doc b/src/doc/main.doc index caf4631..c968956 100644 --- a/src/doc/main.doc +++ b/src/doc/main.doc @@ -1,2 +1,38 @@ /// *************************************************************************** /// @mainpage MicroIRC library +/// +/// Simple and lightweight IRC protocol helper +/// +/// # Getting started +/// The core functionality of the library is in the assembers and tokenizers +/// +/// ## Tokenizers +/// - \ref uirc_tokenizer_message +/// - \ref uirc_tokenizer_user +/// - \ref uirc_tokenizer_tag +/// - \ref uirc_tokenizer_tag_list +/// +/// ## Assemblers +/// - \ref uirc_assembler_message +/// - \ref uirc_assembler_user +/// - \ref uirc_assembler_tag +/// - \ref uirc_assembler_tag_list +/// +/// # Going deeper +/// This library manages memory mostly by itself but still requires you to +/// clean up after it. Here are the memory management functions +/// +/// ## Struct memory management +/// - \ref uirc_struct_free +/// - \ref uirc_struct_assm_message +/// - \ref uirc_struct_assm_user +/// - \ref uirc_struct_assm_tag +/// - \ref uirc_struct_assm_capability +/// - \ref uirc_struct_assm_buffer +/// - \ref uirc_struct_assm_network +/// +/// ## List memory management +/// - \ref uirc_list_append +/// - \ref uirc_list_free +/// +/// *************************************************************************** diff --git a/src/memory/list.c b/src/memory/list.c index 156ab27..0122b63 100644 --- a/src/memory/list.c +++ b/src/memory/list.c @@ -22,6 +22,7 @@ #include // assert() #include // llist_t #include // ptrdiff_t +#include // free() void* uirc_list_append(llist_t* anchor, void* content) @@ -43,6 +44,7 @@ uirc_list_free(llist_t* list, IRC_Struct_Type type) llist_t* const save = list; list = list->next; if (save->content != NULL) uirc_struct_free(save->content, type); + free(save->content); llist_elem_rm(save); } return cnt; diff --git a/tests/CMakeLists.txt b/src/tests/CMakeLists.txt similarity index 100% rename from tests/CMakeLists.txt rename to src/tests/CMakeLists.txt diff --git a/tests/allocs.c b/src/tests/allocs.c similarity index 100% rename from tests/allocs.c rename to src/tests/allocs.c diff --git a/tests/common.c b/src/tests/common.c similarity index 100% rename from tests/common.c rename to src/tests/common.c diff --git a/tests/common.h b/src/tests/common.h similarity index 100% rename from tests/common.h rename to src/tests/common.h diff --git a/tests/earlytrail.c b/src/tests/earlytrail.c similarity index 100% rename from tests/earlytrail.c rename to src/tests/earlytrail.c diff --git a/tests/errno.c b/src/tests/errno.c similarity index 100% rename from tests/errno.c rename to src/tests/errno.c diff --git a/tests/fullloop.c b/src/tests/fullloop.c similarity index 100% rename from tests/fullloop.c rename to src/tests/fullloop.c diff --git a/tests/manassm.c b/src/tests/manassm.c similarity index 100% rename from tests/manassm.c rename to src/tests/manassm.c diff --git a/tests/optcrlf.c b/src/tests/optcrlf.c similarity index 100% rename from tests/optcrlf.c rename to src/tests/optcrlf.c