aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-01-21 22:10:20 -0800
committerPaul Eggert2013-01-21 22:10:20 -0800
commitb41b8a7eff8382797d373dcd0ea91ae3ec5fa562 (patch)
tree29d3312a11fa9cf4455efcf3d48596fbe50fae76 /src
parentbb677ef7449aba3c2d5d7ede8cc4b87814f01ab3 (diff)
downloademacs-b41b8a7eff8382797d373dcd0ea91ae3ec5fa562.tar.gz
emacs-b41b8a7eff8382797d373dcd0ea91ae3ec5fa562.zip
* fileio.c (Finsert_file_contents): Simplify.
Remove unnecessary assignments and tests.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/fileio.c19
2 files changed, 10 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ca37bb3ea56..57e024757ec 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12013-01-22 Paul Eggert <eggert@cs.ucla.edu>
2
3 * fileio.c (Finsert_file_contents): Simplify.
4 Remove unnecessary assignments and tests.
5
12013-01-21 Eli Zaretskii <eliz@gnu.org> 62013-01-21 Eli Zaretskii <eliz@gnu.org>
2 7
3 * w32.c (acl_set_file): Don't test for errors unless 8 * w32.c (acl_set_file): Don't test for errors unless
diff --git a/src/fileio.c b/src/fileio.c
index 175f363ec92..a826ac1f94a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3573,7 +3573,6 @@ by calling `format-decode', which see. */)
3573 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 3573 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
3574 mtime = time_error_value (save_errno); 3574 mtime = time_error_value (save_errno);
3575 st.st_size = -1; 3575 st.st_size = -1;
3576 how_much = 0;
3577 if (!NILP (Vcoding_system_for_read)) 3576 if (!NILP (Vcoding_system_for_read))
3578 Fset (Qbuffer_file_coding_system, Vcoding_system_for_read); 3577 Fset (Qbuffer_file_coding_system, Vcoding_system_for_read);
3579 goto notfound; 3578 goto notfound;
@@ -4008,30 +4007,25 @@ by calling `format-decode', which see. */)
4008 report_file_error ("Setting file position", 4007 report_file_error ("Setting file position",
4009 Fcons (orig_filename, Qnil)); 4008 Fcons (orig_filename, Qnil));
4010 4009
4011 total = st.st_size; /* Total bytes in the file. */
4012 how_much = 0; /* Bytes read from file so far. */
4013 inserted = 0; /* Bytes put into CONVERSION_BUFFER so far. */ 4010 inserted = 0; /* Bytes put into CONVERSION_BUFFER so far. */
4014 unprocessed = 0; /* Bytes not processed in previous loop. */ 4011 unprocessed = 0; /* Bytes not processed in previous loop. */
4015 4012
4016 GCPRO1 (conversion_buffer); 4013 GCPRO1 (conversion_buffer);
4017 while (how_much < total) 4014 while (1)
4018 { 4015 {
4019 /* We read one bunch by one (READ_BUF_SIZE bytes) to allow 4016 /* Read at most READ_BUF_SIZE bytes at a time, to allow
4020 quitting while reading a huge while. */ 4017 quitting while reading a huge file. */
4021 /* `try'' is reserved in some compilers (Microsoft C). */
4022 int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed);
4023 4018
4024 /* Allow quitting out of the actual I/O. */ 4019 /* Allow quitting out of the actual I/O. */
4025 immediate_quit = 1; 4020 immediate_quit = 1;
4026 QUIT; 4021 QUIT;
4027 this = emacs_read (fd, read_buf + unprocessed, trytry); 4022 this = emacs_read (fd, read_buf + unprocessed,
4023 READ_BUF_SIZE - unprocessed);
4028 immediate_quit = 0; 4024 immediate_quit = 0;
4029 4025
4030 if (this <= 0) 4026 if (this <= 0)
4031 break; 4027 break;
4032 4028
4033 how_much += this;
4034
4035 BUF_TEMP_SET_PT (XBUFFER (conversion_buffer), 4029 BUF_TEMP_SET_PT (XBUFFER (conversion_buffer),
4036 BUF_Z (XBUFFER (conversion_buffer))); 4030 BUF_Z (XBUFFER (conversion_buffer)));
4037 decode_coding_c_string (&coding, (unsigned char *) read_buf, 4031 decode_coding_c_string (&coding, (unsigned char *) read_buf,
@@ -4048,9 +4042,6 @@ by calling `format-decode', which see. */)
4048 so defer the removal till we reach the `handled' label. */ 4042 so defer the removal till we reach the `handled' label. */
4049 deferred_remove_unwind_protect = 1; 4043 deferred_remove_unwind_protect = 1;
4050 4044
4051 /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0
4052 if we couldn't read the file. */
4053
4054 if (this < 0) 4045 if (this < 0)
4055 error ("IO error reading %s: %s", 4046 error ("IO error reading %s: %s",
4056 SDATA (orig_filename), emacs_strerror (errno)); 4047 SDATA (orig_filename), emacs_strerror (errno));