QUERY
Sorry for the late call! But....
Fair warning: I'm still planning to look at text.c later.
>>>> "Jerry" == Jerry James
<james(a)xemacs.org> writes:
Jerry> window.c: CURCHARSIZE expands to a call to either
Jerry> window_char_width or window_char_height, depending on the
Jerry> value of widthflag. Since the code visible in this patch
Jerry> is inside of a 'if (widthflag) { ... }' block, there is
Jerry> really no point in making that comparison.
I tend to disagree. The series of macros including CURCHARSIZE was
clearly designed to be optimized away in cases like this. You can
disagree with that design, but if so you should also expand and
simplify the immediately preceding call the CURSIZE. The CURSIZE
macro itself is rather bizarre; the storage pointed to is never used
as an lvalue, so why it is defined to resolve to an int* rather than a
int is really unclear to me.
(I wonder if catching CURCHARSIZE but not CURSIZE should be considered
a bug in the static checker?)
There are a number of places in XEmacs where macros depend on tests
whose result can be determined in advance; they are often defensive
programming against future extension (ie, tests that a buffer text
unit be 0 <= c < 256 when the unit is a char) or intended to be
optimized away (as here). If we're going to break the design, maybe
we should be consistent about it and eliminate such macros everywhere?
I think it would probably be best if you separate out changes that
require "looking inside" macro calls like this into a separate patch.
(Indeed I do get sick of trying to figure out this kind of pseudo-
generality when it's only used in one place!)
src/ChangeLog addition:
2006-06-16 Jerry James <james(a)xemacs.org>
* text.c (eicmp_1): Move assertions to before the point where they
must be true for correctness.
* window.c (change_window_height): Skip always true comparison in
the expansion of CURCHARSIZE.
--
School of Systems and Information Engineering
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.