- gras_dynar_foreach(p_elm->sub, i, p_child) {
- if (p_child)
- TRY(_cursor_push_keys(p_cursor, p_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
+ */
+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 */