Simplify redisplay-x/separate_textual_runs
Aidan Kehoe
kehoea at parhasard.net
Fri Mar 30 10:49:38 EDT 2007
Ar an triochadú lá de mí Márta, scríobh Olivier Galibert:
> separate_textual_runs was a nice, simple function ages ago, but not
> anymore. Now it's a not very readable ifdef mess. Building 4
> functions for the mule/nomule, xft/xlib cases allows for drastic
> simplifications for most of them.
>
> Please review (it's hairy code, another pair of eyes is no luxury) and
> apply if happy. It's probably easier in that specific case to check
> the result rather than the diff.
[...]
> @@ -297,11 +335,54 @@
> run_storage[runs_so_far - 1].len =
> text_storage - run_storage[runs_so_far - 1].ptr;
> /* Dimension retains the relevant value for the run before it. */
> - if (2 == dimension)
> + if (dimension == 2)
> run_storage[runs_so_far - 1].len >>= 1;
> }
For C, the CONSTANT == VARIABLE idiom has a clear advantage over the other
way around (that is, ‘2 = dimension’ doesn’t compile) and the more it’s
used, the more readable it gets. Please don’t change this idiom in future.
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
More information about the XEmacs-Patches
mailing list