aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-08-24 00:35:51 +0000
committerKarl Heuer1994-08-24 00:35:51 +0000
commit1a04498e876c94cfc644d6fd6bf40d73230ff497 (patch)
treeea433bf4164c1f25dce459b14a982742b8d220b3
parent3d94e94328f4a83af28465687c7531a12a6fb53e (diff)
downloademacs-1a04498e876c94cfc644d6fd6bf40d73230ff497.tar.gz
emacs-1a04498e876c94cfc644d6fd6bf40d73230ff497.zip
(Fmake_symbolic_link, Ffile_accessible_directory_p, Finsert_file_contents,
auto_save_error, Fwrite_region): Fix gcpro problems.
-rw-r--r--src/fileio.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/fileio.c b/src/fileio.c
index e13bcc61f67..ed8492ce5c1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2076,7 +2076,10 @@ This happens for interactive use with M-x.")
2076 { 2076 {
2077 unlink (XSTRING (linkname)->data); 2077 unlink (XSTRING (linkname)->data);
2078 if (0 <= symlink (XSTRING (filename)->data, XSTRING (linkname)->data)) 2078 if (0 <= symlink (XSTRING (filename)->data, XSTRING (linkname)->data))
2079 return Qnil; 2079 {
2080 UNGCPRO;
2081 return Qnil;
2082 }
2080 } 2083 }
2081 2084
2082#ifdef NO_ARG_ARRAY 2085#ifdef NO_ARG_ARRAY
@@ -2380,6 +2383,8 @@ searchable directory.")
2380 Lisp_Object filename; 2383 Lisp_Object filename;
2381{ 2384{
2382 Lisp_Object handler; 2385 Lisp_Object handler;
2386 int tem;
2387 struct gcpro gcpro1;
2383 2388
2384 /* If the file name has special constructs in it, 2389 /* If the file name has special constructs in it,
2385 call the corresponding file handler. */ 2390 call the corresponding file handler. */
@@ -2387,11 +2392,13 @@ searchable directory.")
2387 if (!NILP (handler)) 2392 if (!NILP (handler))
2388 return call2 (handler, Qfile_accessible_directory_p, filename); 2393 return call2 (handler, Qfile_accessible_directory_p, filename);
2389 2394
2390 if (NILP (Ffile_directory_p (filename)) 2395 /* Need to gcpro in case the first function call has a handler that
2391 || NILP (Ffile_executable_p (filename))) 2396 causes filename to be relocated. */
2392 return Qnil; 2397 GCPRO1 (filename);
2393 else 2398 tem = (NILP (Ffile_directory_p (filename))
2394 return Qt; 2399 || NILP (Ffile_executable_p (filename)));
2400 UNGCPRO;
2401 return tem ? Qnil : Qt;
2395} 2402}
2396 2403
2397DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, 2404DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
@@ -2591,7 +2598,7 @@ and (2) it puts less data in the undo list.")
2591 register int inserted = 0; 2598 register int inserted = 0;
2592 register int how_much; 2599 register int how_much;
2593 int count = specpdl_ptr - specpdl; 2600 int count = specpdl_ptr - specpdl;
2594 struct gcpro gcpro1, gcpro2; 2601 struct gcpro gcpro1, gcpro2, gcpro3;
2595 Lisp_Object handler, val, insval; 2602 Lisp_Object handler, val, insval;
2596 Lisp_Object p; 2603 Lisp_Object p;
2597 int total; 2604 int total;
@@ -2599,7 +2606,7 @@ and (2) it puts less data in the undo list.")
2599 val = Qnil; 2606 val = Qnil;
2600 p = Qnil; 2607 p = Qnil;
2601 2608
2602 GCPRO2 (filename, p); 2609 GCPRO3 (filename, val, p);
2603 if (!NILP (current_buffer->read_only)) 2610 if (!NILP (current_buffer->read_only))
2604 Fbarf_if_buffer_read_only(); 2611 Fbarf_if_buffer_read_only();
2605 2612
@@ -3006,11 +3013,13 @@ to the file, instead of any buffer contents, and END is ignored.")
3006 if (!NILP (start) && !STRINGP (start)) 3013 if (!NILP (start) && !STRINGP (start))
3007 validate_region (&start, &end); 3014 validate_region (&start, &end);
3008 3015
3016 GCPRO2 (filename, visit);
3009 filename = Fexpand_file_name (filename, Qnil); 3017 filename = Fexpand_file_name (filename, Qnil);
3010 if (STRINGP (visit)) 3018 if (STRINGP (visit))
3011 visit_file = Fexpand_file_name (visit, Qnil); 3019 visit_file = Fexpand_file_name (visit, Qnil);
3012 else 3020 else
3013 visit_file = filename; 3021 visit_file = filename;
3022 UNGCPRO;
3014 3023
3015 visiting = (EQ (visit, Qt) || STRINGP (visit)); 3024 visiting = (EQ (visit, Qt) || STRINGP (visit));
3016 quietly = !NILP (visit); 3025 quietly = !NILP (visit);
@@ -3263,7 +3272,9 @@ to the file, instead of any buffer contents, and END is ignored.")
3263 /* Discard the unwind protect for close_file_unwind. */ 3272 /* Discard the unwind protect for close_file_unwind. */
3264 specpdl_ptr = specpdl + count1; 3273 specpdl_ptr = specpdl + count1;
3265 /* Restore the original current buffer. */ 3274 /* Restore the original current buffer. */
3275 GCPRO1 (visit_file);
3266 unbind_to (count); 3276 unbind_to (count);
3277 UNGCPRO;
3267 3278
3268#ifdef CLASH_DETECTION 3279#ifdef CLASH_DETECTION
3269 if (!auto_saving) 3280 if (!auto_saving)
@@ -3336,7 +3347,6 @@ build_annotations (start, end)
3336 been dealt with by this function. */ 3347 been dealt with by this function. */
3337 if (current_buffer != given_buffer) 3348 if (current_buffer != given_buffer)
3338 { 3349 {
3339 Lisp_Object tem;
3340 start = BEGV; 3350 start = BEGV;
3341 end = ZV; 3351 end = ZV;
3342 annotations = Qnil; 3352 annotations = Qnil;
@@ -3527,14 +3537,12 @@ An argument specifies the modification time value to use\n\
3527Lisp_Object 3537Lisp_Object
3528auto_save_error () 3538auto_save_error ()
3529{ 3539{
3530 unsigned char *name = XSTRING (current_buffer->name)->data;
3531
3532 ring_bell (); 3540 ring_bell ();
3533 message ("Autosaving...error for %s", name); 3541 message ("Autosaving...error for %s", XSTRING (current_buffer->name)->data);
3534 Fsleep_for (make_number (1), Qnil); 3542 Fsleep_for (make_number (1), Qnil);
3535 message ("Autosaving...error!for %s", name); 3543 message ("Autosaving...error!for %s", XSTRING (current_buffer->name)->data);
3536 Fsleep_for (make_number (1), Qnil); 3544 Fsleep_for (make_number (1), Qnil);
3537 message ("Autosaving...error for %s", name); 3545 message ("Autosaving...error for %s", XSTRING (current_buffer->name)->data);
3538 Fsleep_for (make_number (1), Qnil); 3546 Fsleep_for (make_number (1), Qnil);
3539 return Qnil; 3547 return Qnil;
3540} 3548}
@@ -3588,7 +3596,6 @@ Non-nil second argument means save only current buffer.")
3588 int do_handled_files; 3596 int do_handled_files;
3589 Lisp_Object oquit; 3597 Lisp_Object oquit;
3590 int listdesc; 3598 int listdesc;
3591 Lisp_Object lispstream;
3592 int count = specpdl_ptr - specpdl; 3599 int count = specpdl_ptr - specpdl;
3593 int *ptr; 3600 int *ptr;
3594 3601