Opened 13 years ago
Closed 12 years ago
#529 closed enhancement (fixed)
Simplify list_foreach iteration
| Reported by: | Jiri Svoboda | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | helenos/unspecified | Version: | mainline |
| Keywords: | Cc: | ||
| Blocker for: | Depends on: | ||
| See also: |
Description
Currently list_foreach presents a link_t * as an iterator. This leads to almost any list_foreach loop over a list of foo_t to look like this:
list_foreach(list, link) {
foo_t *foo = list_get_instance(link, foo_t, link_field);
... use foo ...
}
therefore it would make sense to simplify the syntax to either:
list_foreach(list, foo_t, foo, link_field) {
... use foo ...
}
or
list_foreach(list, link_field, foo_t, foo) {
... use foo ...
}
the only downside being, one has to remember the correct order of four arguments.
Please let me know your comments on this proposal.
Note:
See TracTickets
for help on using tickets.

Implemented in mainline,1946 (the latter variant).