- if (!*cursor) {
- DEBUG0("Create the cursor on first use");
- errcode = gras_dict_cursor_new(dict,cursor);
- gras_assert1(errcode == no_error, "Unable to create the cursor, got error %s",
- gras_error_name(errcode));
+ if (current != NULL) {
+ DEBUG0("current is not null, take the next element");
+ current = current->next;
+ DEBUG1("next element: %p", current);
+ }
+
+ while (current == NULL && ++line < cursor->dict->table_size) {
+ DEBUG0("current is NULL, take the next line");
+ current = cursor->dict->table[line];
+ DEBUG1("element in the next line: %p", current);
+ }
+ DEBUG2("search finished, current = %p, line = %d", current, line);
+
+ cursor->current = current;
+ cursor->line = line;