changeset 630:d3aace9903fa

Doxygen improvements.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 17 Jan 2020 19:32:28 +0200
parents b695eb769e30
children d5221299656a
files th_datastruct.h th_string.c
diffstat 2 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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;
 
 
--- 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)