Problem compiling font-mgr.c

Aidan Kehoe kehoea at parhasard.net
Fri Nov 26 05:39:34 EST 2010


 Ar an tríú lá is fiche de mí na Samhain, scríobh Stephen J. Turnbull: 

 > diff -r c096d8051f89 src/font-mgr.c
 > --- a/src/font-mgr.c	Sat Nov 20 16:49:11 2010 +0000
 > +++ b/src/font-mgr.c	Tue Nov 23 14:12:26 2010 +0900
 > @@ -440,7 +440,7 @@
 >      {
 >  #ifdef HAVE_BIGNUM
 >        check_integer_range (id, Qzero, make_integer (INT_MAX));
 > -      int_id = BIGNUMP (id) ? bignum_to_int (id) : XINT (id);
 > +      int_id = BIGNUMP (id) ? bignum_to_int ((mpz_srcptr) XBIGNUM(id)) : XINT (id);
 >  #else
 >        check_integer_range (id, Qzero, make_integer (EMACS_INT_MAX));
 >        int_id = XINT (id);      
 > 
 > Aidan, Jerry, please review.  I *will not* apply because I do not
 > understand why the cast to mpz_srcptr is needed to avoid warnings
 > about the result type of XBIGNUM, so I'm probably doing something
 > wrong. 

Right; the Lisp_Bignum object has a header before the associated
library-specific bignum object, so the library-specific functions will end
up rummaging through data intended for our garbage collector.

 > But maybe that cast will clue you in to what I'm doing
 > wrong....
 > 
 > Also, *in principle*[1] shouldn't it be possible to write this code as
 > 
 >     check_integer_range (id, Qzero, make_integer (INT_MAX))
 >     int_id = BIGNUMP (id) ? bignum_to_int (id) : XINT (id)
 > 
 > where
 > 
 > #ifndef HAVE_BIGNUM
 > #define INT_MAX (EMACS_INT_MAX)

INT_MAX is a standard C90 constant, and changing it is something I didn’t
want to do. We could have changed the code to something like you suggest,
but it’s much of a muchness.

-- 
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
  -- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research



More information about the XEmacs-Beta mailing list