#350 COLLECTION - what is the right way to insert and extract items with index
Closed: Invalid Opened by dpal.

The original implementation of collection has the following comment in collection.h regarding the use of the COL_DSP_INDEX:

/* NOTE ABOUT USING: COL_DSP_INDEX. */
/* The COL_DSP_INDEX adds the item as N-th item after header in the list.
 * Index is zero based.
 * If there are less than N items in the list the item is added to the end.
 * The index value of 0 means that the item will be added immediately
 * after the header. Index of 1 will mean that it is added after first data item and so on.
 *
 * In case of extraction or deletion the N-th item of the collection
 * will be extracted or deleted.
 * Index is zero based.
 * If there are less than N+1 items in the list the function will return ENOENT.
 */
}}}
The code is implemented in the same way and matches the comment.
However it was suggested that the expectation would be that insertion of the N-th element should fail if the N-1 element does not exist rather than just append to the end.
I do not see a value in this change. I think it works Ok as implemented and acts exactly as advertised. Nowhere it is said to expect something else. The comments in header files will actually be the foundation for the auto-generated documentation for the interface and man pages will be provided so it is not clear why the original implementation is not correct.

Propose to close and won't fix and functions as designed.

Accepted.

resolution: => wontfix
status: new => closed

Fields changed

milestone: NEEDS_TRIAGE => void

Metadata Update from @dpal:
- Issue assigned to dpal
- Issue set to the milestone: void

Metadata