all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug fixup for unneeded setlocale in getloadavg.c
@ 2004-01-26 13:24 fgeorges@fgeorges.org
  0 siblings, 0 replies; only message in thread
From: fgeorges@fgeorges.org @ 2004-01-26 13:24 UTC (permalink / raw)


  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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-26 13:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-26 13:24 Bug fixup for unneeded setlocale in getloadavg.c fgeorges@fgeorges.org

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.