# HG changeset patch # User Matti Hamalainen # Date 1579282348 -7200 # Node ID d3aace9903fac979b00f0bb4447ec601de60ce04 # Parent b695eb769e30b53ced98cadaf12872601b91fa70 Doxygen improvements. diff -r b695eb769e30 -r d3aace9903fa th_datastruct.h --- a/th_datastruct.h Fri Jan 17 19:32:13 2020 +0200 +++ b/th_datastruct.h Fri Jan 17 19:32:28 2020 +0200 @@ -5,6 +5,8 @@ * * Please read file 'COPYING' for information on license and distribution. */ +/// @file +/// @brief Implementations of common data structures like linked lists, ring buffers, autogrowing buffers, etc. #ifndef TH_DATASTRUCT_H #define TH_DATASTRUCT_H @@ -15,13 +17,14 @@ #endif -/* Doubly linked list handling +/** @brief + * Doubly linked list structure. */ -typedef struct _th_llist_t +typedef struct th_llist_t { - size_t num; // Number of nodes in the list, meaningful ONLY in the current root node of the list - struct _th_llist_t *prev, *next; - void *data; // Pointer to data payload of this node + size_t num; ///< Number of nodes in the list, meaningful ONLY in the current root node of the list + struct th_llist_t *prev, *next; ///< Pointers to previous and next nodes. + void *data; ///< Pointer to data payload of this node, if any } th_llist_t; @@ -49,13 +52,15 @@ th_llist_t * th_llist_find_func(th_llist_t *list, const void *userdata, int (compare)(const void *, const void *)); -/* Ringbuffer implementation +/** @brief + * Ringbuffer data structure */ typedef struct { - size_t n, size; - void (*deallocator)(void *data); void **data; ///< Array of pointers to the data + size_t size; ///< Size of this ringbuffer in elements (aka pointers to data) + size_t n; ///< Number of elements currently in the ringbuffer (@p n <= @p size) + void (*deallocator)(void *data); ///< De-allocator function that frees one element. } th_ringbuf_t; diff -r b695eb769e30 -r d3aace9903fa th_string.c --- a/th_string.c Fri Jan 17 19:32:13 2020 +0200 +++ b/th_string.c Fri Jan 17 19:32:28 2020 +0200 @@ -67,7 +67,7 @@ /** * Helper function for th_strdup_trim() and friends. Copies @p len characters from - * given string, and trims whitespace from it according to specified @p flags. + * given string, and trims whitespace from it according to specified @p flags. * See TH_TRIM_* in th_string.h. If @p len or the resulting trimmed string would * be empty (length 0), no copy is allocated and a @c NULL pointer is returned. * @param[in] src source string (does not need to be NUL terminated, as length must be specified)