summaryrefslogtreecommitdiff
path: root/navit/attr.c
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2018-04-18 13:49:16 +0200
committermvglasow <michael -at- vonglasow.com>2018-04-18 13:49:16 +0200
commit13d7e9b30e79b1ce8eca1393144e370c2fe1442a (patch)
tree6b7f38102415ca1e3dd07c870d40390d652dd814 /navit/attr.c
parentd9dd2eb5e844118180ada05d954b533bb305e523 (diff)
downloadnavit-13d7e9b30e79b1ce8eca1393144e370c2fe1442a.tar.gz
Refactor:core:Refine documentation of attr.c
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Diffstat (limited to 'navit/attr.c')
-rw-r--r--navit/attr.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/navit/attr.c b/navit/attr.c
index 86bc29489..18ad79f64 100644
--- a/navit/attr.c
+++ b/navit/attr.c
@@ -605,7 +605,8 @@ attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_ty
* contain an attribute whose type matches that of the new one, the new
* attribute is inserted into the list.
*
- * @param attrs Points to the array of attribute pointers to be updated
+ * @param attrs Points to the array of attribute pointers to be updated (if NULL, this function will
+ * create a new list containing only the new attribute)
* @param attr The new attribute.
* @return Pointer to the updated attribute list
*/
@@ -902,6 +903,15 @@ attr_dup(struct attr *attr)
return ret;
}
+/**
+ * @brief Frees a list of attributes.
+ *
+ * This frees the pointer array as well as the attributes referenced by the pointers.
+ *
+ * It is safe to call this function with a NULL argument; doing so is a no-op.
+ *
+ * @param attrs The attribute list to free
+ */
void
attr_list_free(struct attr **attrs)
{
@@ -912,6 +922,17 @@ attr_list_free(struct attr **attrs)
g_free(attrs);
}
+/**
+ * @brief Duplicates a list of attributes.
+ *
+ * This creates a deep copy, i.e. the attributes in the list are copied as well.
+ *
+ * It is safe to call this function with a NULL argument; in this case, NULL will be returned.
+ *
+ * @param attrs The attribute list to copy
+ *
+ * @return The copy of the attribute list
+ */
struct attr **
attr_list_dup(struct attr **attrs)
{