From f82d6e91bd3fe346cb806a97fe2db0fa138acb44 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 Mar 2018 10:35:25 -0700 Subject: [PATCH] Revert overenthusiastic procfs fixup Also, be more systematic in calls to string_to_number. * src/sysdep.c (list_system_processes) [HAVE_PROCFS]: Allow pids to be floating-point if they exceed fixnum range. This partially reverts my patch 2018-03-09T20:06:05Z!eggert@cs.ucla.edu, which went too far in fixing string-to-number mishandling. --- src/data.c | 2 +- src/lread.c | 4 ++-- src/process.c | 2 +- src/sysdep.c | 6 +----- src/xfaces.c | 2 +- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/data.c b/src/data.c index 62b3fcfeb24..06308c62c49 100644 --- a/src/data.c +++ b/src/data.c @@ -2754,7 +2754,7 @@ If the base used is not 10, STRING is always parsed as an integer. */) while (*p == ' ' || *p == '\t') p++; - val = string_to_number (p, b, 1); + val = string_to_number (p, b, true); return NILP (val) ? make_number (0) : val; } diff --git a/src/lread.c b/src/lread.c index 0ea7677300b..381f9cf20c5 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2693,7 +2693,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) invalid_syntax (buf); } - return string_to_number (buf, radix, 0); + return string_to_number (buf, radix, false); } @@ -3502,7 +3502,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) if (!quoted && !uninterned_symbol) { - Lisp_Object result = string_to_number (read_buffer, 10, 0); + Lisp_Object result = string_to_number (read_buffer, 10, false); if (! NILP (result)) return unbind_to (count, result); } diff --git a/src/process.c b/src/process.c index 9b9b9f35503..11d914aab24 100644 --- a/src/process.c +++ b/src/process.c @@ -6844,7 +6844,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) if (NILP (tem)) { Lisp_Object process_number - = string_to_number (SSDATA (process), 10, 1); + = string_to_number (SSDATA (process), 10, true); if (NUMBERP (process_number)) tem = process_number; } diff --git a/src/sysdep.c b/src/sysdep.c index 1eaf648ea78..c59034ce5c3 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -3006,11 +3006,7 @@ list_system_processes (void) for (tail = proclist; CONSP (tail); tail = next) { next = XCDR (tail); - Lisp_Object pidstring = XCAR (tail); - Lisp_Object pid = Fstring_to_number (pidstring, Qnil); - if (!INTEGERP (pid) || XINT (pid) <= 0) - xsignal1 (Qoverflow_error, pidstring); - XSETCAR (tail, pid); + XSETCAR (tail, Fstring_to_number (XCAR (tail), Qnil)); } /* directory_files_internal returns the files in reverse order; undo diff --git a/src/xfaces.c b/src/xfaces.c index 56df06574a7..a9c2f37e9f2 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3392,7 +3392,7 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", value = Qunspecified; else if (EQ (attr, QCheight)) { - value = Fstring_to_number (value, make_number (10)); + value = Fstring_to_number (value, Qnil); if (!INTEGERP (value) || XINT (value) <= 0) signal_error ("Invalid face height from X resource", value); } -- 2.39.2