aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1994-09-27 03:03:38 +0000
committerKarl Heuer1994-09-27 03:03:38 +0000
commit93c30b5f849cf4181ed162c312cb126dc80f6012 (patch)
treed8e876144443fc26c3a2269e323346f85750fc78 /src
parentd20d1d19eb92d6624fda6e60876993bce52ab99f (diff)
downloademacs-93c30b5f849cf4181ed162c312cb126dc80f6012.tar.gz
emacs-93c30b5f849cf4181ed162c312cb126dc80f6012.zip
(Ffind_file_name_handler, Fcopy_file, Frename_file, Fadd_name_to_file,
Fmake_symbolic_link, Fwrite_region, Fverify_visited_file_modtime, Fdo_auto_save, Fread_file_name_internal, Fread_file_name): Use type test macros.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 6f3d7663182..401e569b463 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -241,17 +241,16 @@ use the standard functions without calling themselves recursively.")
241 else 241 else
242 inhibited_handlers = Qnil; 242 inhibited_handlers = Qnil;
243 243
244 for (chain = Vfile_name_handler_alist; XTYPE (chain) == Lisp_Cons; 244 for (chain = Vfile_name_handler_alist; CONSP (chain);
245 chain = XCONS (chain)->cdr) 245 chain = XCONS (chain)->cdr)
246 { 246 {
247 Lisp_Object elt; 247 Lisp_Object elt;
248 elt = XCONS (chain)->car; 248 elt = XCONS (chain)->car;
249 if (XTYPE (elt) == Lisp_Cons) 249 if (CONSP (elt))
250 { 250 {
251 Lisp_Object string; 251 Lisp_Object string;
252 string = XCONS (elt)->car; 252 string = XCONS (elt)->car;
253 if (XTYPE (string) == Lisp_String 253 if (STRINGP (string) && fast_string_match (string, filename) >= 0)
254 && fast_string_match (string, filename) >= 0)
255 { 254 {
256 Lisp_Object handler, tem; 255 Lisp_Object handler, tem;
257 256
@@ -1774,9 +1773,9 @@ A prefix arg makes KEEP-TIME non-nil.")
1774 ok_if_already_exists, keep_date)); 1773 ok_if_already_exists, keep_date));
1775 1774
1776 if (NILP (ok_if_already_exists) 1775 if (NILP (ok_if_already_exists)
1777 || XTYPE (ok_if_already_exists) == Lisp_Int) 1776 || INTEGERP (ok_if_already_exists))
1778 barf_or_query_if_file_exists (newname, "copy to it", 1777 barf_or_query_if_file_exists (newname, "copy to it",
1779 XTYPE (ok_if_already_exists) == Lisp_Int); 1778 INTEGERP (ok_if_already_exists));
1780 1779
1781 ifd = open (XSTRING (filename)->data, O_RDONLY); 1780 ifd = open (XSTRING (filename)->data, O_RDONLY);
1782 if (ifd < 0) 1781 if (ifd < 0)
@@ -1954,9 +1953,9 @@ This is what happens in interactive use with M-x.")
1954 filename, newname, ok_if_already_exists)); 1953 filename, newname, ok_if_already_exists));
1955 1954
1956 if (NILP (ok_if_already_exists) 1955 if (NILP (ok_if_already_exists)
1957 || XTYPE (ok_if_already_exists) == Lisp_Int) 1956 || INTEGERP (ok_if_already_exists))
1958 barf_or_query_if_file_exists (newname, "rename to it", 1957 barf_or_query_if_file_exists (newname, "rename to it",
1959 XTYPE (ok_if_already_exists) == Lisp_Int); 1958 INTEGERP (ok_if_already_exists));
1960#ifndef BSD4_1 1959#ifndef BSD4_1
1961 if (0 > rename (XSTRING (filename)->data, XSTRING (newname)->data)) 1960 if (0 > rename (XSTRING (filename)->data, XSTRING (newname)->data))
1962#else 1961#else
@@ -2017,9 +2016,9 @@ This is what happens in interactive use with M-x.")
2017 newname, ok_if_already_exists)); 2016 newname, ok_if_already_exists));
2018 2017
2019 if (NILP (ok_if_already_exists) 2018 if (NILP (ok_if_already_exists)
2020 || XTYPE (ok_if_already_exists) == Lisp_Int) 2019 || INTEGERP (ok_if_already_exists))
2021 barf_or_query_if_file_exists (newname, "make it a new name", 2020 barf_or_query_if_file_exists (newname, "make it a new name",
2022 XTYPE (ok_if_already_exists) == Lisp_Int); 2021 INTEGERP (ok_if_already_exists));
2023 unlink (XSTRING (newname)->data); 2022 unlink (XSTRING (newname)->data);
2024 if (0 > link (XSTRING (filename)->data, XSTRING (newname)->data)) 2023 if (0 > link (XSTRING (filename)->data, XSTRING (newname)->data))
2025 { 2024 {
@@ -2071,9 +2070,9 @@ This happens for interactive use with M-x.")
2071 linkname, ok_if_already_exists)); 2070 linkname, ok_if_already_exists));
2072 2071
2073 if (NILP (ok_if_already_exists) 2072 if (NILP (ok_if_already_exists)
2074 || XTYPE (ok_if_already_exists) == Lisp_Int) 2073 || INTEGERP (ok_if_already_exists))
2075 barf_or_query_if_file_exists (linkname, "make it a link", 2074 barf_or_query_if_file_exists (linkname, "make it a link",
2076 XTYPE (ok_if_already_exists) == Lisp_Int); 2075 INTEGERP (ok_if_already_exists));
2077 if (0 > symlink (XSTRING (filename)->data, XSTRING (linkname)->data)) 2076 if (0 > symlink (XSTRING (filename)->data, XSTRING (linkname)->data))
2078 { 2077 {
2079 /* If we didn't complain already, silently delete existing file. */ 2078 /* If we didn't complain already, silently delete existing file. */
@@ -3069,7 +3068,7 @@ to the file, instead of any buffer contents, and END is ignored.")
3069 call the corresponding file handler. */ 3068 call the corresponding file handler. */
3070 handler = Ffind_file_name_handler (filename, Qwrite_region); 3069 handler = Ffind_file_name_handler (filename, Qwrite_region);
3071 /* If FILENAME has no handler, see if VISIT has one. */ 3070 /* If FILENAME has no handler, see if VISIT has one. */
3072 if (NILP (handler) && XTYPE (visit) == Lisp_String) 3071 if (NILP (handler) && STRINGP (visit))
3073 handler = Ffind_file_name_handler (visit, Qwrite_region); 3072 handler = Ffind_file_name_handler (visit, Qwrite_region);
3074 3073
3075 if (!NILP (handler)) 3074 if (!NILP (handler))
@@ -3487,7 +3486,7 @@ This means that the file has not been changed since it was visited or saved.")
3487 CHECK_BUFFER (buf, 0); 3486 CHECK_BUFFER (buf, 0);
3488 b = XBUFFER (buf); 3487 b = XBUFFER (buf);
3489 3488
3490 if (XTYPE (b->filename) != Lisp_String) return Qt; 3489 if (!STRINGP (b->filename)) return Qt;
3491 if (b->modtime == 0) return Qt; 3490 if (b->modtime == 0) return Qt;
3492 3491
3493 /* If the file name has special constructs in it, 3492 /* If the file name has special constructs in it,
@@ -3680,7 +3679,7 @@ Non-nil second argument means save only current buffer.")
3680 3679
3681 /* Record all the buffers that have auto save mode 3680 /* Record all the buffers that have auto save mode
3682 in the special file that lists them. */ 3681 in the special file that lists them. */
3683 if (XTYPE (b->auto_save_file_name) == Lisp_String 3682 if (STRINGP (b->auto_save_file_name)
3684 && listdesc >= 0 && do_handled_files == 0) 3683 && listdesc >= 0 && do_handled_files == 0)
3685 { 3684 {
3686 write (listdesc, XSTRING (b->auto_save_file_name)->data, 3685 write (listdesc, XSTRING (b->auto_save_file_name)->data,
@@ -3695,7 +3694,7 @@ Non-nil second argument means save only current buffer.")
3695 /* Check for auto save enabled 3694 /* Check for auto save enabled
3696 and file changed since last auto save 3695 and file changed since last auto save
3697 and file changed since last real save. */ 3696 and file changed since last real save. */
3698 if (XTYPE (b->auto_save_file_name) == Lisp_String 3697 if (STRINGP (b->auto_save_file_name)
3699 && b->save_modified < BUF_MODIFF (b) 3698 && b->save_modified < BUF_MODIFF (b)
3700 && b->auto_save_modified < BUF_MODIFF (b) 3699 && b->auto_save_modified < BUF_MODIFF (b)
3701 /* -1 means we've turned off autosaving for a while--see below. */ 3700 /* -1 means we've turned off autosaving for a while--see below. */
@@ -3875,7 +3874,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
3875 specdir = Ffile_name_directory (string); 3874 specdir = Ffile_name_directory (string);
3876 val = Ffile_name_completion (name, realdir); 3875 val = Ffile_name_completion (name, realdir);
3877 UNGCPRO; 3876 UNGCPRO;
3878 if (XTYPE (val) != Lisp_String) 3877 if (!STRINGP (val))
3879 { 3878 {
3880 if (changed) 3879 if (changed)
3881 return double_dollars (string); 3880 return double_dollars (string);
@@ -3935,7 +3934,7 @@ DIR defaults to current buffer's directory default.")
3935 /* If dir starts with user's homedir, change that to ~. */ 3934 /* If dir starts with user's homedir, change that to ~. */
3936 homedir = (char *) egetenv ("HOME"); 3935 homedir = (char *) egetenv ("HOME");
3937 if (homedir != 0 3936 if (homedir != 0
3938 && XTYPE (dir) == Lisp_String 3937 && STRINGP (dir)
3939 && !strncmp (homedir, XSTRING (dir)->data, strlen (homedir)) 3938 && !strncmp (homedir, XSTRING (dir)->data, strlen (homedir))
3940 && XSTRING (dir)->data[strlen (homedir)] == '/') 3939 && XSTRING (dir)->data[strlen (homedir)] == '/')
3941 { 3940 {
@@ -4019,7 +4018,7 @@ DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 5, 0,
4019 /* If dir starts with user's homedir, change that to ~. */ 4018 /* If dir starts with user's homedir, change that to ~. */
4020 homedir = (char *) egetenv ("HOME"); 4019 homedir = (char *) egetenv ("HOME");
4021 if (homedir != 0 4020 if (homedir != 0
4022 && XTYPE (dir) == Lisp_String 4021 && STRINGP (dir)
4023 && !strncmp (homedir, XSTRING (dir)->data, strlen (homedir)) 4022 && !strncmp (homedir, XSTRING (dir)->data, strlen (homedir))
4024 && XSTRING (dir)->data[strlen (homedir)] == '/') 4023 && XSTRING (dir)->data[strlen (homedir)] == '/')
4025 { 4024 {