Subject: Re: bug#9943: 24.0.91; Abort in check_glyph_memory

From: Eli Zaretskii <[email-masked]>
Date: Fri, 04 Nov 2011 11:12:13 +0200

> From: Stefan Monnier <[email-masked]>
> Cc: Glenn Morris <[email-masked]>,  [email-masked]
> Date: Thu, 03 Nov 2011 20:35:04 -0400
> 
> > Thanks, I installed the same fix in xfns.c.
> 
> All this code duplication is really a bore.  We should really create
> a new file (say "dispfns.c") where we can consolidate common code from
> xfns, nsfns, and w32fns.

I agree.  How about filing a wishlist bug for that?

> A good start would be that whenever we have to make the same fix at
> all 3 places, we rearrange the code locally to call a new function
> in dispfns.c which would receive the common part where the fix can
> then be applied.

The problem is that the code is similar, but different, with
platform-specific fragments sprinkled all over.  So refactoring it
into a single implementation is not a trivial job.  Making a function
out of every common fragment is not the best idea, since it will
typically depend on local and static variables and static functions.
Quite to the opposite: extracting platform-specific snippets into
functions with platform-specific implementation might be a better
idea.  Or not, it all depends on careful analysis that should be done
as a prerequisite to deciding which way is better.

So it's not an easy editing job, even if you want to approach this
incrementally.  I think it's rather a refactoring project that should
be taken as a whole, or maybe as a few large sub-jobs.