Add docs, move tests and free struct storage as llist doesn't anymore
This commit is contained in:
parent
282d643347
commit
e32ee3adca
|
@ -92,7 +92,7 @@ if(BUILD_DOCS)
|
||||||
endif()
|
endif()
|
||||||
if (BUILD_TESTS)
|
if (BUILD_TESTS)
|
||||||
message(STATUS "Tests are going to be built.")
|
message(STATUS "Tests are going to be built.")
|
||||||
add_subdirectory(tests)
|
add_subdirectory(src/tests)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(NAME "FullLoop" COMMAND "fullloop")
|
add_test(NAME "FullLoop" COMMAND "fullloop")
|
||||||
add_test(NAME "EarlyTrail" COMMAND "earlytrail")
|
add_test(NAME "EarlyTrail" COMMAND "earlytrail")
|
||||||
|
|
|
@ -30,10 +30,17 @@
|
||||||
/*!
|
/*!
|
||||||
* \brief Tokenize IRCv3 tags
|
* \brief Tokenize IRCv3 tags
|
||||||
*
|
*
|
||||||
* This function parses IRCv3 tags according to the specification at
|
* This function parses IRCv3 tags according to the specification at https://ircv3.net/specs/extensions/message-tags
|
||||||
* \param[in] str String containing a IRC source with or without the ':' prefix
|
*
|
||||||
|
* \param[in] str String containing list of tags
|
||||||
*/
|
*/
|
||||||
llist_t* uirc_tokenizer_tag_list(const char* str);
|
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);
|
IRC_Tag* uirc_tokenizer_tag(const char* str);
|
||||||
#endif /* UIRC_FEATURE_IRCV3 */
|
#endif /* UIRC_FEATURE_IRCV3 */
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,38 @@
|
||||||
/// ***************************************************************************
|
/// ***************************************************************************
|
||||||
/// @mainpage MicroIRC library
|
/// @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
|
||||||
|
///
|
||||||
|
/// ***************************************************************************
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <assert.h> // assert()
|
#include <assert.h> // assert()
|
||||||
#include <corelibs/llist.h> // llist_t
|
#include <corelibs/llist.h> // llist_t
|
||||||
#include <stddef.h> // ptrdiff_t
|
#include <stddef.h> // ptrdiff_t
|
||||||
|
#include <stdlib.h> // free()
|
||||||
|
|
||||||
void*
|
void*
|
||||||
uirc_list_append(llist_t* anchor, void* content)
|
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;
|
llist_t* const save = list;
|
||||||
list = list->next;
|
list = list->next;
|
||||||
if (save->content != NULL) uirc_struct_free(save->content, type);
|
if (save->content != NULL) uirc_struct_free(save->content, type);
|
||||||
|
free(save->content);
|
||||||
llist_elem_rm(save);
|
llist_elem_rm(save);
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
|
|
Reference in New Issue