[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111580: * fileio.c (Finsert_file_con
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111580: * fileio.c (Finsert_file_contents): Simplify. |
Date: |
Mon, 21 Jan 2013 22:10:20 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111580
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2013-01-21 22:10:20 -0800
message:
* fileio.c (Finsert_file_contents): Simplify.
Remove unnecessary assignments and tests.
modified:
src/ChangeLog
src/fileio.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-01-21 18:00:19 +0000
+++ b/src/ChangeLog 2013-01-22 06:10:20 +0000
@@ -1,3 +1,8 @@
+2013-01-22 Paul Eggert <address@hidden>
+
+ * fileio.c (Finsert_file_contents): Simplify.
+ Remove unnecessary assignments and tests.
+
2013-01-21 Eli Zaretskii <address@hidden>
* w32.c (acl_set_file): Don't test for errors unless
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2013-01-21 17:01:09 +0000
+++ b/src/fileio.c 2013-01-22 06:10:20 +0000
@@ -3573,7 +3573,6 @@
report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
mtime = time_error_value (save_errno);
st.st_size = -1;
- how_much = 0;
if (!NILP (Vcoding_system_for_read))
Fset (Qbuffer_file_coding_system, Vcoding_system_for_read);
goto notfound;
@@ -4008,30 +4007,25 @@
report_file_error ("Setting file position",
Fcons (orig_filename, Qnil));
- total = st.st_size; /* Total bytes in the file. */
- how_much = 0; /* Bytes read from file so far. */
inserted = 0; /* Bytes put into CONVERSION_BUFFER so far. */
unprocessed = 0; /* Bytes not processed in previous loop. */
GCPRO1 (conversion_buffer);
- while (how_much < total)
+ while (1)
{
- /* We read one bunch by one (READ_BUF_SIZE bytes) to allow
- quitting while reading a huge while. */
- /* `try'' is reserved in some compilers (Microsoft C). */
- int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed);
+ /* Read at most READ_BUF_SIZE bytes at a time, to allow
+ quitting while reading a huge file. */
/* Allow quitting out of the actual I/O. */
immediate_quit = 1;
QUIT;
- this = emacs_read (fd, read_buf + unprocessed, trytry);
+ this = emacs_read (fd, read_buf + unprocessed,
+ READ_BUF_SIZE - unprocessed);
immediate_quit = 0;
if (this <= 0)
break;
- how_much += this;
-
BUF_TEMP_SET_PT (XBUFFER (conversion_buffer),
BUF_Z (XBUFFER (conversion_buffer)));
decode_coding_c_string (&coding, (unsigned char *) read_buf,
@@ -4048,9 +4042,6 @@
so defer the removal till we reach the `handled' label. */
deferred_remove_unwind_protect = 1;
- /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0
- if we couldn't read the file. */
-
if (this < 0)
error ("IO error reading %s: %s",
SDATA (orig_filename), emacs_strerror (errno));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111580: * fileio.c (Finsert_file_contents): Simplify.,
Paul Eggert <=