summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-01-30 14:22:58 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2011-01-30 14:22:58 -0800
commit4eec7f8b2b465c6fc2c09d37d4da2b540f607df0 (patch)
tree9f4e30300e4f96dd3c72f5f435032f8180ce1a6c /src/fileio.c
parentfcabb1a6e66f7e6cf4fe0984c4d5c169f4decd8a (diff)
parent42a5b22fc0201fe98ad8a093c3ab91122ab3a72b (diff)
downloademacs-4eec7f8b2b465c6fc2c09d37d4da2b540f607df0.tar.gz
emacs-4eec7f8b2b465c6fc2c09d37d4da2b540f607df0.tar.bz2
emacs-4eec7f8b2b465c6fc2c09d37d4da2b540f607df0.zip
Use SSDATA when the context wants char *.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 84e32a61265..3c61ee57bf2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -500,7 +500,7 @@ For a Unix-syntax file name, just appends a slash. */)
return call2 (handler, Qfile_name_as_directory, file);
buf = (char *) alloca (SBYTES (file) + 10);
- file_name_as_directory (buf, SDATA (file));
+ file_name_as_directory (buf, SSDATA (file));
return make_specified_string (buf, -1, strlen (buf),
STRING_MULTIBYTE (file));
}
@@ -559,7 +559,7 @@ In Unix-syntax, this function just removes the final slash. */)
return call2 (handler, Qdirectory_file_name, directory);
buf = (char *) alloca (SBYTES (directory) + 20);
- directory_file_name (SDATA (directory), buf);
+ directory_file_name (SSDATA (directory), buf);
return make_specified_string (buf, -1, strlen (buf),
STRING_MULTIBYTE (directory));
}
@@ -935,7 +935,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
#ifdef WINDOWSNT
if (IS_DIRECTORY_SEP (nm[1]))
{
- if (strcmp (nm, SDATA (name)) != 0)
+ if (strcmp (nm, SSDATA (name)) != 0)
name = make_specified_string (nm, -1, strlen (nm), multibyte);
}
else
@@ -951,7 +951,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
}
return name;
#else /* not DOS_NT */
- if (strcmp (nm, SDATA (name)) == 0)
+ if (strcmp (nm, SSDATA (name)) == 0)
return name;
return make_specified_string (nm, -1, strlen (nm), multibyte);
#endif /* not DOS_NT */
@@ -1685,13 +1685,13 @@ those `/' is discarded. */)
orig = make_unibyte_string (o, orig_length);
decoded = DECODE_FILE (orig);
decoded_length = SBYTES (decoded);
- strncpy (x, SDATA (decoded), decoded_length);
+ strncpy (x, SSDATA (decoded), decoded_length);
x += decoded_length;
/* If environment variable needed decoding, return value
needs to be multibyte. */
if (decoded_length != orig_length
- || strncmp (SDATA (decoded), o, orig_length))
+ || strncmp (SSDATA (decoded), o, orig_length))
multibyte = 1;
}
}
@@ -1761,7 +1761,7 @@ barf_or_query_if_file_exists (Lisp_Object absname, const unsigned char *querystr
/* stat is a good way to tell whether the file exists,
regardless of what access permissions it has. */
- if (lstat (SDATA (encoded_filename), &statbuf) >= 0)
+ if (lstat (SSDATA (encoded_filename), &statbuf) >= 0)
{
if (! interactive)
xsignal2 (Qfile_already_exists,
@@ -1859,7 +1859,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
|| INTEGERP (ok_if_already_exists))
barf_or_query_if_file_exists (newname, "copy to it",
INTEGERP (ok_if_already_exists), &out_st, 0);
- else if (stat (SDATA (encoded_newname), &out_st) < 0)
+ else if (stat (SSDATA (encoded_newname), &out_st) < 0)
out_st.st_mode = 0;
#ifdef WINDOWSNT
@@ -1892,7 +1892,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
}
#else /* not WINDOWSNT */
immediate_quit = 1;
- ifd = emacs_open (SDATA (encoded_file), O_RDONLY, 0);
+ ifd = emacs_open (SSDATA (encoded_file), O_RDONLY, 0);
immediate_quit = 0;
if (ifd < 0)
@@ -1942,7 +1942,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
| (NILP (ok_if_already_exists) ? O_EXCL : 0),
S_IREAD | S_IWRITE);
#else /* not MSDOS */
- ofd = emacs_open (SDATA (encoded_newname),
+ ofd = emacs_open (SSDATA (encoded_newname),
O_WRONLY | O_TRUNC | O_CREAT
| (NILP (ok_if_already_exists) ? O_EXCL : 0),
0666);
@@ -1993,7 +1993,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
EMACS_TIME atime, mtime;
EMACS_SET_SECS_USECS (atime, st.st_atime, 0);
EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
- if (set_file_times (SDATA (encoded_newname),
+ if (set_file_times (SSDATA (encoded_newname),
atime, mtime))
xsignal2 (Qfile_date_error,
build_string ("Cannot set file date"), newname);
@@ -2109,7 +2109,7 @@ With a prefix argument, TRASH is nil. */)
encoded_file = ENCODE_FILE (filename);
- if (0 > unlink (SDATA (encoded_file)))
+ if (0 > unlink (SSDATA (encoded_file)))
report_file_error ("Removing old name", list1 (filename));
return Qnil;
}
@@ -2190,7 +2190,7 @@ This is what happens in interactive use with M-x. */)
|| INTEGERP (ok_if_already_exists))
barf_or_query_if_file_exists (newname, "rename to it",
INTEGERP (ok_if_already_exists), 0, 0);
- if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname)))
+ if (0 > rename (SSDATA (encoded_file), SSDATA (encoded_newname)))
{
if (errno == EXDEV)
{
@@ -2277,8 +2277,8 @@ This is what happens in interactive use with M-x. */)
barf_or_query_if_file_exists (newname, "make it a new name",
INTEGERP (ok_if_already_exists), 0, 0);
- unlink (SDATA (newname));
- if (0 > link (SDATA (encoded_file), SDATA (encoded_newname)))
+ unlink (SSDATA (newname));
+ if (0 > link (SSDATA (encoded_file), SSDATA (encoded_newname)))
report_file_error ("Adding new name", list2 (file, newname));
UNGCPRO;
@@ -2336,15 +2336,15 @@ This happens for interactive use with M-x. */)
|| INTEGERP (ok_if_already_exists))
barf_or_query_if_file_exists (linkname, "make it a link",
INTEGERP (ok_if_already_exists), 0, 0);
- if (0 > symlink (SDATA (encoded_filename),
- SDATA (encoded_linkname)))
+ if (0 > symlink (SSDATA (encoded_filename),
+ SSDATA (encoded_linkname)))
{
/* If we didn't complain already, silently delete existing file. */
if (errno == EEXIST)
{
- unlink (SDATA (encoded_linkname));
- if (0 <= symlink (SDATA (encoded_filename),
- SDATA (encoded_linkname)))
+ unlink (SSDATA (encoded_linkname));
+ if (0 <= symlink (SSDATA (encoded_filename),
+ SSDATA (encoded_linkname)))
{
UNGCPRO;
return Qnil;
@@ -2444,7 +2444,7 @@ Use `file-symlink-p' to test for such links. */)
absname = ENCODE_FILE (absname);
- return (stat (SDATA (absname), &statbuf) >= 0) ? Qt : Qnil;
+ return (stat (SSDATA (absname), &statbuf) >= 0) ? Qt : Qnil;
}
DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0,
@@ -2466,7 +2466,7 @@ For a directory, this means you can access files in that directory. */)
absname = ENCODE_FILE (absname);
- return (check_executable (SDATA (absname)) ? Qt : Qnil);
+ return (check_executable (SSDATA (absname)) ? Qt : Qnil);
}
DEFUN ("file-readable-p", Ffile_readable_p, Sfile_readable_p, 1, 1, 0,
@@ -2503,13 +2503,13 @@ See also `file-exists-p' and `file-attributes'. */)
/* Opening a fifo without O_NONBLOCK can wait.
We don't want to wait. But we don't want to mess wth O_NONBLOCK
except in the case of a fifo, on a system which handles it. */
- desc = stat (SDATA (absname), &statbuf);
+ desc = stat (SSDATA (absname), &statbuf);
if (desc < 0)
return Qnil;
if (S_ISFIFO (statbuf.st_mode))
flags |= O_NONBLOCK;
#endif
- desc = emacs_open (SDATA (absname), flags, 0);
+ desc = emacs_open (SSDATA (absname), flags, 0);
if (desc < 0)
return Qnil;
emacs_close (desc);
@@ -2537,8 +2537,8 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
return call2 (handler, Qfile_writable_p, absname);
encoded = ENCODE_FILE (absname);
- if (stat (SDATA (encoded), &statbuf) >= 0)
- return (check_writable (SDATA (encoded))
+ if (stat (SSDATA (encoded), &statbuf) >= 0)
+ return (check_writable (SSDATA (encoded))
? Qt : Qnil);
dir = Ffile_name_directory (absname);
@@ -2583,9 +2583,9 @@ If there is no error, returns nil. */)
encoded_filename = ENCODE_FILE (absname);
- fd = emacs_open (SDATA (encoded_filename), O_RDONLY, 0);
+ fd = emacs_open (SSDATA (encoded_filename), O_RDONLY, 0);
if (fd < 0)
- report_file_error (SDATA (string), Fcons (filename, Qnil));
+ report_file_error (SSDATA (string), Fcons (filename, Qnil));
emacs_close (fd);
return Qnil;
@@ -2629,7 +2629,7 @@ points to a nonexistent file. */)
memset (buf, 0, bufsize);
errno = 0;
- valsize = readlink (SDATA (filename), buf, bufsize);
+ valsize = readlink (SSDATA (filename), buf, bufsize);
if (valsize == -1)
{
#ifdef ERANGE
@@ -2678,7 +2678,7 @@ See `file-symlink-p' to distinguish symlinks. */)
absname = ENCODE_FILE (absname);
- if (stat (SDATA (absname), &st) < 0)
+ if (stat (SSDATA (absname), &st) < 0)
return Qnil;
return (st.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil;
}
@@ -2746,7 +2746,7 @@ See `file-symlink-p' to distinguish symlinks. */)
return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil;
}
#else
- if (stat (SDATA (absname), &st) < 0)
+ if (stat (SSDATA (absname), &st) < 0)
return Qnil;
return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil;
#endif
@@ -2903,7 +2903,7 @@ Return nil, if file does not exist or is not accessible. */)
absname = ENCODE_FILE (absname);
- if (stat (SDATA (absname), &st) < 0)
+ if (stat (SSDATA (absname), &st) < 0)
return Qnil;
return make_number (st.st_mode & 07777);
@@ -2933,7 +2933,7 @@ symbolic notation, like the `chmod' command from GNU Coreutils. */)
encoded_absname = ENCODE_FILE (absname);
- if (chmod (SDATA (encoded_absname), XINT (mode)) < 0)
+ if (chmod (SSDATA (encoded_absname), XINT (mode)) < 0)
report_file_error ("Doing chmod", Fcons (absname, Qnil));
return Qnil;
@@ -3000,7 +3000,7 @@ Use the current time if TIME is nil. TIME is in the format of
EMACS_SET_SECS (t, sec);
EMACS_SET_USECS (t, usec);
- if (set_file_times (SDATA (encoded_absname), t, t))
+ if (set_file_times (SSDATA (encoded_absname), t, t))
{
#ifdef DOS_NT
struct stat st;
@@ -3063,12 +3063,12 @@ otherwise, if FILE2 does not exist, the answer is t. */)
absname2 = ENCODE_FILE (absname2);
UNGCPRO;
- if (stat (SDATA (absname1), &st) < 0)
+ if (stat (SSDATA (absname1), &st) < 0)
return Qnil;
mtime1 = st.st_mtime;
- if (stat (SDATA (absname2), &st) < 0)
+ if (stat (SSDATA (absname2), &st) < 0)
return Qt;
return (mtime1 > st.st_mtime) ? Qt : Qnil;
@@ -3250,12 +3250,12 @@ variable `last-coding-system-used' to the coding system actually used. */)
/* Tell stat to use expensive method to get accurate info. */
Vw32_get_true_file_attributes = Qt;
- total = stat (SDATA (filename), &st);
+ total = stat (SSDATA (filename), &st);
Vw32_get_true_file_attributes = tem;
}
if (total < 0)
#else
- if (stat (SDATA (filename), &st) < 0)
+ if (stat (SSDATA (filename), &st) < 0)
#endif /* WINDOWSNT */
{
if (fd >= 0) emacs_close (fd);
@@ -3287,7 +3287,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
#endif
if (fd < 0)
- if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0)
+ if ((fd = emacs_open (SSDATA (filename), O_RDONLY, 0)) < 0)
goto badopen;
/* Replacement should preserve point as it preserves markers. */
@@ -4975,8 +4975,8 @@ e_write (int desc, Lisp_Object string, int start, int end, struct coding_system
coding->produced -=
emacs_write (desc,
STRINGP (coding->dst_object)
- ? SDATA (coding->dst_object)
- : BYTE_POS_ADDR (coding->dst_pos_byte),
+ ? SSDATA (coding->dst_object)
+ : (char *) BYTE_POS_ADDR (coding->dst_pos_byte),
coding->produced);
if (coding->produced)
@@ -5021,7 +5021,7 @@ See Info node `(elisp)Modification Time' for more details. */)
filename = ENCODE_FILE (b->filename);
- if (stat (SDATA (filename), &st) < 0)
+ if (stat (SSDATA (filename), &st) < 0)
{
/* If the file doesn't exist now and didn't exist before,
we say that it isn't modified, provided the error is a tame one. */
@@ -5098,7 +5098,7 @@ An argument specifies the modification time value to use
filename = ENCODE_FILE (filename);
- if (stat (SDATA (filename), &st) >= 0)
+ if (stat (SSDATA (filename), &st) >= 0)
{
current_buffer->modtime = st.st_mtime;
current_buffer->modtime_size = st.st_size;
@@ -5155,7 +5155,7 @@ auto_save_1 (void)
/* Get visited file's mode to become the auto save file's mode. */
if (! NILP (current_buffer->filename))
{
- if (stat (SDATA (current_buffer->filename), &st) >= 0)
+ if (stat (SSDATA (current_buffer->filename), &st) >= 0)
/* But make sure we can overwrite it later! */
auto_save_mode_bits = st.st_mode | 0600;
else if ((modes = Ffile_modes (current_buffer->filename),
@@ -5278,7 +5278,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
UNGCPRO;
}
- stream = fopen (SDATA (listfile), "w");
+ stream = fopen (SSDATA (listfile), "w");
}
record_unwind_protect (do_auto_save_unwind,