mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-08 20:50:52 -08:00
(Finsert_file_contents): Declare buffer as unsigned
char. When comparing with file size convert same_at_start to distance to buffer start. If the file matches the buffer contents truncate the buffer to the size of the file.
This commit is contained in:
parent
2d2eeace3b
commit
1051b3b3ef
1 changed files with 3 additions and 1 deletions
|
|
@ -2694,10 +2694,12 @@ and (2) it puts less data in the undo list.")
|
|||
immediate_quit = 0;
|
||||
/* If the file matches the buffer completely,
|
||||
there's no need to replace anything. */
|
||||
if (same_at_start == st.st_size)
|
||||
if (same_at_start - BEGV == st.st_size)
|
||||
{
|
||||
close (fd);
|
||||
specpdl_ptr--;
|
||||
/* Truncate the buffer to the size of the file. */
|
||||
del_range_1 (same_at_start, same_at_end, 0);
|
||||
goto handled;
|
||||
}
|
||||
immediate_quit = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue