aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorJoakim Verona2013-01-16 00:03:29 +0100
committerJoakim Verona2013-01-16 00:03:29 +0100
commit29901a24475c9dd0e7e7bc73adb0fabf7d0a7ddd (patch)
treeacbf658794aeff0bae865da7fc1e88733cb2b397 /src/fileio.c
parentbc4f7ac4ec3ee942171b9fef6eec6b1a61cc5b8b (diff)
parent963ea40fe96634a01b24aef4fc39acf9a4236eb7 (diff)
downloademacs-29901a24475c9dd0e7e7bc73adb0fabf7d0a7ddd.tar.gz
emacs-29901a24475c9dd0e7e7bc73adb0fabf7d0a7ddd.zip
auto upstream
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/fileio.c b/src/fileio.c
index d468576d639..87d945c1e5e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3408,30 +3408,22 @@ decide_coding_unwind (Lisp_Object unwind_data)
3408 return Qnil; 3408 return Qnil;
3409} 3409}
3410 3410
3411 3411/* Read from a non-regular file. STATE is a Lisp_Save_Value
3412/* Used to pass values from insert-file-contents to read_non_regular. */ 3412 object where slot 0 is the file descriptor, slot 1 specifies
3413 3413 an offset to put the read bytes, and slot 2 is the maximum
3414static int non_regular_fd; 3414 amount of bytes to read. Value is the number of bytes read. */
3415static ptrdiff_t non_regular_inserted;
3416static int non_regular_nbytes;
3417
3418
3419/* Read from a non-regular file.
3420 Read non_regular_nbytes bytes max from non_regular_fd.
3421 Non_regular_inserted specifies where to put the read bytes.
3422 Value is the number of bytes read. */
3423 3415
3424static Lisp_Object 3416static Lisp_Object
3425read_non_regular (Lisp_Object ignore) 3417read_non_regular (Lisp_Object state)
3426{ 3418{
3427 int nbytes; 3419 int nbytes;
3428 3420
3429 immediate_quit = 1; 3421 immediate_quit = 1;
3430 QUIT; 3422 QUIT;
3431 nbytes = emacs_read (non_regular_fd, 3423 nbytes = emacs_read (XSAVE_INTEGER (state, 0),
3432 ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE 3424 ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
3433 + non_regular_inserted), 3425 + XSAVE_INTEGER (state, 1)),
3434 non_regular_nbytes); 3426 XSAVE_INTEGER (state, 2));
3435 immediate_quit = 0; 3427 immediate_quit = 0;
3436 return make_number (nbytes); 3428 return make_number (nbytes);
3437} 3429}
@@ -4238,7 +4230,7 @@ by calling `format-decode', which see. */)
4238 while (how_much < total) 4230 while (how_much < total)
4239 { 4231 {
4240 /* try is reserved in some compilers (Microsoft C) */ 4232 /* try is reserved in some compilers (Microsoft C) */
4241 int trytry = min (total - how_much, READ_BUF_SIZE); 4233 ptrdiff_t trytry = min (total - how_much, READ_BUF_SIZE);
4242 ptrdiff_t this; 4234 ptrdiff_t this;
4243 4235
4244 if (not_regular) 4236 if (not_regular)
@@ -4255,12 +4247,11 @@ by calling `format-decode', which see. */)
4255 /* Read from the file, capturing `quit'. When an 4247 /* Read from the file, capturing `quit'. When an
4256 error occurs, end the loop, and arrange for a quit 4248 error occurs, end the loop, and arrange for a quit
4257 to be signaled after decoding the text we read. */ 4249 to be signaled after decoding the text we read. */
4258 non_regular_fd = fd; 4250 nbytes = internal_condition_case_1
4259 non_regular_inserted = inserted; 4251 (read_non_regular,
4260 non_regular_nbytes = trytry; 4252 format_save_value ("iii", (ptrdiff_t) fd, inserted, trytry),
4261 nbytes = internal_condition_case_1 (read_non_regular, 4253 Qerror, read_non_regular_quit);
4262 Qnil, Qerror, 4254
4263 read_non_regular_quit);
4264 if (NILP (nbytes)) 4255 if (NILP (nbytes))
4265 { 4256 {
4266 read_quit = 1; 4257 read_quit = 1;
@@ -5507,7 +5498,7 @@ static Lisp_Object
5507do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */ 5498do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */
5508 5499
5509{ 5500{
5510 FILE *stream = XSAVE_POINTER (arg); 5501 FILE *stream = XSAVE_POINTER (arg, 0);
5511 auto_saving = 0; 5502 auto_saving = 0;
5512 if (stream != NULL) 5503 if (stream != NULL)
5513 { 5504 {