diff options
author | Colin Watson <cjwatson@debian.org> | 2022-01-01 02:33:27 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2022-01-01 02:33:27 +0000 |
commit | 9740c56b311f863f295b84cf93aee84379d0740b (patch) | |
tree | 06c879f650250f30902e70508ffa021cbd122bf8 /README.md | |
parent | 5c28907556920624e6a257b1aeaaa91501306ed8 (diff) |
Simplify interface to container iterator macros
The Gnulib container iterator macros (GL_LIST_FOREACH_* and
GL_MAP_FOREACH_*) have to run code both before and after a chunk of
user-supplied code. This previously required a START/END macro pair
used something like this:
GL_LIST_FOREACH_START (names, name) {
...
} GL_LIST_FOREACH_END (names);
This doesn't look natural in C, and so it was easy to get it wrong.
It's possible to do better, at the cost of some tricky macros.
Fortunately, Simon Tatham has already done the hard work in
https://www.chiark.greenend.org.uk/~sgtatham/mp/, and the necessary
header file is MIT-licensed, so we can incorporate it. Now these
iterator macros are used more like this, which is a much more natural C
style:
GL_LIST_FOREACH (names, name) {
...
}
* lib/mp.h: New file.
* lib/Makefile.am (libman_la_SOURCES): Add mp.h.
* lib/README: Add mp.h. Rephrase introductory text about licensing to
account for an MIT-licensed file.
* lib/glcontainers.h (GL_LIST_FOREACH_START, GL_LIST_FOREACH_END):
Rewrite as ...
(GL_LIST_FOREACH): ... this. Update all callers.
(GL_MAP_FOREACH_START, GL_MAP_FOREACH_END): Rewrite as ...
(GL_MAP_FOREACH): ... this. Update all callers.
* NEWS, README.md, docs/HACKING: Document C99 compiler requirement.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -13,7 +13,7 @@ Check manual/README for details of the formatters required. * Read ChangeLog for details of recent source code changes. * Read docs/TODO for future plans. -The C source requires an ANSI C compiler. +The C source requires an C99 compiler. ## Copyright and licensing |