Use the new idiom for looping through occupied code points

Issue #31 new
Barry Schwartz created an issue

Where there is code like ‘for (i = 0; i < fv->map->enc_limit; ++i)’ try to replace it with something more like ‘for (enc_iter_t p = enc_iter (fv->map); !enc_done (p); p = enc_next (p))’. See for example the definition of FVCopyFgtoBg().

The main goal here is to clarify what the code is doing. The old code is simply the low-level specifics of the desired operation, which is to return the code points. The ‘i’ values for which there is no occupied code point are irrelevant and should not be mentioned.

There are so many instances, however, that just changing them all at once is a bigger job than I desire. It is something to do on lazy days or when one is working on the code anyway.

Comments (1)

  1. Barry Schwartz reporter

    I do apologize that the new idiom looks so awful, but it is difficult to do such a thing nicely in C.

  2. Log in to comment