APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1506161926 -3600
# Sat Sep 23 11:18:46 2017 +0100
# Node ID d3e0eec3a5082a28cdff11a9e5629b076abd4a17
# Parent 8dea4d0549ac0a49456d01bba96171399456c227
Return a Bytecount, read_process_output(), no need for bytecount_to_charcount()
src/ChangeLog addition:
2017-09-23 Aidan Kehoe <kehoea(a)parhasard.net>
* process.c (read_process_output): Have this return a Bytecount,
not a Charcount; the precise number of characters wasn't used by
our callers, so we were usually calling bytecount_to_charcount()
for no reason.
* process.h: Update the declaration of this function.
diff -r 8dea4d0549ac -r d3e0eec3a508 src/ChangeLog
--- a/src/ChangeLog Thu Sep 07 09:19:50 2017 +0100
+++ b/src/ChangeLog Sat Sep 23 11:18:46 2017 +0100
@@ -1,3 +1,11 @@
+2017-09-23 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * process.c (read_process_output): Have this return a Bytecount,
+ not a Charcount; the precise number of characters wasn't used by
+ our callers, so we were usually calling bytecount_to_charcount()
+ for no reason.
+ * process.h: Update the declaration of this function.
+
2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
* text.c (Fchar_width):
diff -r 8dea4d0549ac -r d3e0eec3a508 src/process.c
--- a/src/process.c Thu Sep 07 09:19:50 2017 +0100
+++ b/src/process.c Sat Sep 23 11:18:46 2017 +0100
@@ -1079,17 +1079,16 @@
/* Read pending output from the process channel,
starting with our buffered-ahead character if we have one.
- Yield number of characters read.
+ Yield number of bytes read.
This function reads at most 1024 bytes.
If you want to read all available subprocess output,
you must call it repeatedly until it returns zero. */
-
-Charcount
+Bytecount
read_process_output (Lisp_Object process, int read_stderr)
{
/* This function can GC */
- Bytecount nbytes, nchars;
+ Bytecount nbytes;
Ibyte chars[1025];
Lisp_Object outstream;
Lisp_Process *p = XPROCESS (process);
@@ -1139,16 +1138,16 @@
/* !!#### if the coding system changed as a result of reading, we
need to change the output coding system accordingly. */
- nchars = bytecount_to_charcount (chars, nbytes);
outstream = filter;
if (!NILP (outstream))
{
/* Some FSF junk with running_asynch_code, to preserve the match
data. Not necessary because we don't call process filters
asynchronously (i.e. from within QUIT). */
- /* Don't catch errors here; we're not in any critical code. */
+ /* Don't catch errors here; we're not in any critical code. call2() will
+ GCPRO() the string argument. */
call2 (outstream, process, make_string (chars, nbytes));
- return nchars;
+ return nbytes;
}
/* If no filter, write into buffer if it isn't dead. */
@@ -1177,7 +1176,8 @@
unbind_to (spec);
UNGCPRO;
}
- return nchars;
+
+ return nbytes;
}
int
diff -r 8dea4d0549ac -r d3e0eec3a508 src/process.h
--- a/src/process.h Thu Sep 07 09:19:50 2017 +0100
+++ b/src/process.h Sat Sep 23 11:18:46 2017 +0100
@@ -99,7 +99,7 @@
void status_notify (void);
void kick_status_notify (void);
void deactivate_process (Lisp_Object proc);
-Charcount read_process_output (Lisp_Object proc, int read_stderr);
+Bytecount read_process_output (Lisp_Object proc, int read_stderr);
int process_has_separate_stderr (Lisp_Object proc);
const char *signal_name (int signum);
Lisp_Object canonicalize_host_name (Lisp_Object host);
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
Show replies by thread