- xbt_dynar_foreach(elm->sub, i, child) {
- if (child)
- _cursor_push_keys(cursor, child);
+/**
+ * @brief Create the cursor if it does not exists. Rewind it in any case.
+ *
+ * @param dict on what to let the cursor iterate
+ * @param[out] cursor dest address
+ */
+XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict,
+ xbt_dict_cursor_t * cursor)
+{
+ DEBUG0("xbt_dict_cursor_first");
+ if (!*cursor) {
+ DEBUG0("Create the cursor on first use");
+ *cursor = xbt_dict_cursor_new(dict);
+ } else {
+ xbt_dict_cursor_rewind(*cursor);
+ }
+ if (dict != NULL && (*cursor)->current == NULL) {
+ xbt_dict_cursor_step(*cursor); /* find the first element */