aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-12-20 20:09:05 +0400
committerDmitry Antipov2012-12-20 20:09:05 +0400
commit13002885275be0499d0131d4d1823d5e5a6a1be6 (patch)
tree533c02f80d9a86b08aef35c2499e948ef0236f17 /src/process.c
parent99e9311c311ec85dfb8a56d560e3d2f27abc430d (diff)
downloademacs-13002885275be0499d0131d4d1823d5e5a6a1be6.tar.gz
emacs-13002885275be0499d0131d4d1823d5e5a6a1be6.zip
Avoid calls to CHAR_TO_BYTE if byte position is known.
* editfns.c (make_buffer_string_both): Use move_gap_both. (Fbuffer_string): Use make_buffer_string_both. * marker.c (buf_charpos_to_bytepos): Convert to eassert. Adjust comment. (buf_bytepos_to_charpos): Likewise. (charpos_to_bytepos): Remove. * fileio.c (Finsert_file_contents): Use move_gap_both. * search.c (Freplace_match): Likewise. * process.c (process_send_region): Likewise. Use convenient names for byte positions. * lisp.h (charpos_to_bytepos): Remove prototype. * indent.c (scan_for_column): Use CHAR_TO_BYTE. * insdel.c (move_gap): Likewise.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c
index 92d5e692d0b..7ab651a2376 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5556,19 +5556,19 @@ it is sent in several bunches. This may happen even for shorter regions.
5556Output from processes can arrive in between bunches. */) 5556Output from processes can arrive in between bunches. */)
5557 (Lisp_Object process, Lisp_Object start, Lisp_Object end) 5557 (Lisp_Object process, Lisp_Object start, Lisp_Object end)
5558{ 5558{
5559 Lisp_Object proc; 5559 Lisp_Object proc = get_process (process);
5560 ptrdiff_t start1, end1; 5560 ptrdiff_t start_byte, end_byte;
5561 5561
5562 proc = get_process (process);
5563 validate_region (&start, &end); 5562 validate_region (&start, &end);
5564 5563
5564 start_byte = CHAR_TO_BYTE (XINT (start));
5565 end_byte = CHAR_TO_BYTE (XINT (end));
5566
5565 if (XINT (start) < GPT && XINT (end) > GPT) 5567 if (XINT (start) < GPT && XINT (end) > GPT)
5566 move_gap (XINT (start)); 5568 move_gap_both (XINT (start), start_byte);
5567 5569
5568 start1 = CHAR_TO_BYTE (XINT (start)); 5570 send_process (proc, (char *) BYTE_POS_ADDR (start_byte),
5569 end1 = CHAR_TO_BYTE (XINT (end)); 5571 end_byte - start_byte, Fcurrent_buffer ());
5570 send_process (proc, (char *) BYTE_POS_ADDR (start1), end1 - start1,
5571 Fcurrent_buffer ());
5572 5572
5573 return Qnil; 5573 return Qnil;
5574} 5574}