bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] Re: Bug in getloadavg


From: Dave Love
Subject: Re: [Bug-gnulib] Re: Bug in getloadavg
Date: Wed, 31 Mar 2004 16:57:14 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

Ah, I hadn't noticed what the dummy definition of setlocale was.

For Emacs, the `free' in this hunk should be `xfree', but as far as I
remember, gnulib wouldn't accept my xfree, so Emacs will need to
maintain a separate copy.

[The stuff Emacs has at the end of files like this

/* arch-tag: 2b37a242-6289-41f4-8cd5-0e73fd615db1
   (do not change this comment) */

presumably also prevents merging with gnulib, whatever it's there for.]

@@ -602,10 +606,12 @@ getloadavg (double loadavg[], int nelem)
     return -1;
 
   /* The following sscanf must use the C locale.  */
+  old_locale = xstrdup (setlocale (LC_NUMERIC, NULL));
   setlocale (LC_NUMERIC, "C");
   count = sscanf (ldavgbuf, "%lf %lf %lf",
                  &load_ave[0], &load_ave[1], &load_ave[2]);
-  setlocale (LC_NUMERIC, "");
+  setlocale (LC_NUMERIC, old_locale);
+  free (old_locale);
   if (count < 1)
     return -1;
 




reply via email to

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