bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug fixup for unneeded setlocale in getloadavg.c


From: address@hidden
Subject: Bug fixup for unneeded setlocale in getloadavg.c
Date: Mon, 26 Jan 2004 14:24:21 +0100 (CET)

  Hello.

  Firstly, I don't know exactly where I must send this bug correction. 
So I send it here, I hope it's the correct place.  And I havn't
subscribe at any list, so please, forward response at <fgeorges AT
fgeorges.org>, tks.

  The bug is about a recent modiffication of the file
<src/getloadavg.c>.  Between 1.45 and 1.46 

version (currently, it's the 1.47), the three following lines were
added (the two first, and the 

last one) (line 605 in the 1.47) :

    /* The following sscanf must use the C locale.  */
    setlocale (LC_NUMERIC, "C");
    count = sscanf (...);
    setlocale (LC_NUMERIC, "");

  But <src/emacs.c> says (line 2175 in 1.330) :

    /* Recover from setlocale (LC_ALL, "").  */
    void
    fixup_locale ()
    {
      /* The Emacs Lisp reader needs LC_NUMERIC to be "C",
         so that numbers are read and printed properly for Emacs Lisp. 
*/
      setlocale (LC_NUMERIC, "C");
    }

In `main´, we call `setlocale (LC_ALL, "") ;´, and then
`fixup_locale()´.

  So the code in gatloadavg.c set the locale for Emacs (and for the
Lisp Printer and the Lisp 

Reader) to the default one.  For example, at home, I have the `$LANG´
environnement variable set 

to "french".  BOOM !

  I think the fixup is trivial : emacs.c says explicitely that the
locale for `LC_NUMERIC´ is the 

"C" one, so removing the `setlocale()´ calls from getloadavg.c is all
we need.

  emacs.c says also, line 1000 in 1.330 :

    /* fixup_locale must wait until later, since it builds strings. */

  Why ?

  Hope it helps,

--
Florent Georges


_________________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]