summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2021-04-26 20:31:57 +0300
committermvglasow <michael -at- vonglasow.com>2021-04-26 20:31:57 +0300
commit37aa2df0eb7fcc878e3aeb5cea5a6fc7d873029c (patch)
tree095a5fefb4c818198d7984f9c01a05acce9ed843 /navit
parent1ae08e7eb052c833251547fcdabba709f5ee3616 (diff)
downloadnavit-37aa2df0eb7fcc878e3aeb5cea5a6fc7d873029c.tar.gz
Refactor:core:Document the need to rewind before retrieving attributes
Signed-off-by: mvglasow <michael -at- vonglasow.com>
Diffstat (limited to 'navit')
-rw-r--r--navit/item.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/navit/item.c b/navit/item.c
index ab590cb4e..120675339 100644
--- a/navit/item.c
+++ b/navit/item.c
@@ -394,6 +394,13 @@ void item_attr_rewind(struct item *it) {
* This function returns the next attribute matching `attr_type` from an item and advances the
* "attribute pointer" accordingly, so that at the next call the next attribute will be returned.
*
+ * IMPORTANT: Unless you are iterating over attributes, or operating on a “fresh” item (from which no
+ * other code has had a chance to retrieve an attribute), be sure to call
+ * {@link item_attr_rewind(struct item *)} before each call to this method. Not doing so may result in
+ * unpredictable behavior, i.e. attributes not being found if the attribute pointer is already past the
+ * requested attribute (which depends on the physical ordering of attributes and on the last attribute
+ * retrieved from the item).
+ *
* This function is not safe to call after destroying the item's map rect, and doing so may cause errors
* with some map implementations.
*