aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorKen Raeburn2002-07-15 00:01:34 +0000
committerKen Raeburn2002-07-15 00:01:34 +0000
commitd5db40779d7505244d37476b4f046641f07eea2b (patch)
tree5c8bf4dad41639287e722cb7cbdc0709e47a9e53 /src/fileio.c
parent491c2516d32fa8b9ba9422ec142c8925dd82af00 (diff)
downloademacs-d5db40779d7505244d37476b4f046641f07eea2b.tar.gz
emacs-d5db40779d7505244d37476b4f046641f07eea2b.zip
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
SCHARS, SBYTES, STRING_INTERVALS, SREF, SDATA; explicit size_byte references left unchanged for now.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c278
1 files changed, 139 insertions, 139 deletions
diff --git a/src/fileio.c b/src/fileio.c
index ce27fad4516..c3f82613d83 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -269,8 +269,8 @@ report_file_error (string, data)
269 default: 269 default:
270 /* System error messages are capitalized. Downcase the initial 270 /* System error messages are capitalized. Downcase the initial
271 unless it is followed by a slash. */ 271 unless it is followed by a slash. */
272 if (XSTRING (errstring)->data[1] != '/') 272 if (SREF (errstring, 1) != '/')
273 XSTRING (errstring)->data[0] = DOWNCASE (XSTRING (errstring)->data[0]); 273 SREF (errstring, 0) = DOWNCASE (SREF (errstring, 0));
274 274
275 Fsignal (Qfile_error, 275 Fsignal (Qfile_error,
276 Fcons (build_string (string), Fcons (errstring, data))); 276 Fcons (build_string (string), Fcons (errstring, data)));
@@ -408,11 +408,11 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'. */)
408#ifdef FILE_SYSTEM_CASE 408#ifdef FILE_SYSTEM_CASE
409 filename = FILE_SYSTEM_CASE (filename); 409 filename = FILE_SYSTEM_CASE (filename);
410#endif 410#endif
411 beg = XSTRING (filename)->data; 411 beg = SDATA (filename);
412#ifdef DOS_NT 412#ifdef DOS_NT
413 beg = strcpy (alloca (strlen (beg) + 1), beg); 413 beg = strcpy (alloca (strlen (beg) + 1), beg);
414#endif 414#endif
415 p = beg + STRING_BYTES (XSTRING (filename)); 415 p = beg + SBYTES (filename);
416 416
417 while (p != beg && !IS_DIRECTORY_SEP (p[-1]) 417 while (p != beg && !IS_DIRECTORY_SEP (p[-1])
418#ifdef VMS 418#ifdef VMS
@@ -480,8 +480,8 @@ or the entire name if it contains no slash. */)
480 if (!NILP (handler)) 480 if (!NILP (handler))
481 return call2 (handler, Qfile_name_nondirectory, filename); 481 return call2 (handler, Qfile_name_nondirectory, filename);
482 482
483 beg = XSTRING (filename)->data; 483 beg = SDATA (filename);
484 end = p = beg + STRING_BYTES (XSTRING (filename)); 484 end = p = beg + SBYTES (filename);
485 485
486 while (p != beg && !IS_DIRECTORY_SEP (p[-1]) 486 while (p != beg && !IS_DIRECTORY_SEP (p[-1])
487#ifdef VMS 487#ifdef VMS
@@ -637,8 +637,8 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc. */)
637 if (!NILP (handler)) 637 if (!NILP (handler))
638 return call2 (handler, Qfile_name_as_directory, file); 638 return call2 (handler, Qfile_name_as_directory, file);
639 639
640 buf = (char *) alloca (STRING_BYTES (XSTRING (file)) + 10); 640 buf = (char *) alloca (SBYTES (file) + 10);
641 return build_string (file_name_as_directory (buf, XSTRING (file)->data)); 641 return build_string (file_name_as_directory (buf, SDATA (file)));
642} 642}
643 643
644/* 644/*
@@ -833,11 +833,11 @@ it returns a file name such as \"[X]Y.DIR.1\". */)
833 /* 20 extra chars is insufficient for VMS, since we might perform a 833 /* 20 extra chars is insufficient for VMS, since we might perform a
834 logical name translation. an equivalence string can be up to 255 834 logical name translation. an equivalence string can be up to 255
835 chars long, so grab that much extra space... - sss */ 835 chars long, so grab that much extra space... - sss */
836 buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20 + 255); 836 buf = (char *) alloca (SBYTES (directory) + 20 + 255);
837#else 837#else
838 buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20); 838 buf = (char *) alloca (SBYTES (directory) + 20);
839#endif 839#endif
840 directory_file_name (XSTRING (directory)->data, buf); 840 directory_file_name (SDATA (directory), buf);
841 return build_string (buf); 841 return build_string (buf);
842} 842}
843 843
@@ -912,10 +912,10 @@ make_temp_name (prefix, base64_p)
912#endif 912#endif
913 } 913 }
914 914
915 len = XSTRING (prefix)->size; 915 len = SCHARS (prefix);
916 val = make_uninit_string (len + 3 + pidlen); 916 val = make_uninit_string (len + 3 + pidlen);
917 data = XSTRING (val)->data; 917 data = SDATA (val);
918 bcopy(XSTRING (prefix)->data, data, len); 918 bcopy(SDATA (prefix), data, len);
919 p = data + len; 919 p = data + len;
920 920
921 bcopy (pidbuf, p, pidlen); 921 bcopy (pidbuf, p, pidlen);
@@ -970,7 +970,7 @@ make_temp_name (prefix, base64_p)
970 } 970 }
971 971
972 error ("Cannot create temporary name for prefix `%s'", 972 error ("Cannot create temporary name for prefix `%s'",
973 XSTRING (prefix)->data); 973 SDATA (prefix));
974 return Qnil; 974 return Qnil;
975} 975}
976 976
@@ -1073,7 +1073,7 @@ See also the function `substitute-in-file-name'. */)
1073 return call3 (handler, Qexpand_file_name, name, default_directory); 1073 return call3 (handler, Qexpand_file_name, name, default_directory);
1074 } 1074 }
1075 1075
1076 o = XSTRING (default_directory)->data; 1076 o = SDATA (default_directory);
1077 1077
1078 /* Make sure DEFAULT_DIRECTORY is properly expanded. 1078 /* Make sure DEFAULT_DIRECTORY is properly expanded.
1079 It would be better to do this down below where we actually use 1079 It would be better to do this down below where we actually use
@@ -1118,7 +1118,7 @@ See also the function `substitute-in-file-name'. */)
1118 name = FILE_SYSTEM_CASE (name); 1118 name = FILE_SYSTEM_CASE (name);
1119#endif 1119#endif
1120 1120
1121 nm = XSTRING (name)->data; 1121 nm = SDATA (name);
1122 1122
1123#ifdef DOS_NT 1123#ifdef DOS_NT
1124 /* We will force directory separators to be either all \ or /, so make 1124 /* We will force directory separators to be either all \ or /, so make
@@ -1292,21 +1292,21 @@ See also the function `substitute-in-file-name'. */)
1292#ifdef WINDOWSNT 1292#ifdef WINDOWSNT
1293 if (IS_DIRECTORY_SEP (nm[1])) 1293 if (IS_DIRECTORY_SEP (nm[1]))
1294 { 1294 {
1295 if (strcmp (nm, XSTRING (name)->data) != 0) 1295 if (strcmp (nm, SDATA (name)) != 0)
1296 name = build_string (nm); 1296 name = build_string (nm);
1297 } 1297 }
1298 else 1298 else
1299#endif 1299#endif
1300 /* drive must be set, so this is okay */ 1300 /* drive must be set, so this is okay */
1301 if (strcmp (nm - 2, XSTRING (name)->data) != 0) 1301 if (strcmp (nm - 2, SDATA (name)) != 0)
1302 { 1302 {
1303 name = make_string (nm - 2, p - nm + 2); 1303 name = make_string (nm - 2, p - nm + 2);
1304 XSTRING (name)->data[0] = DRIVE_LETTER (drive); 1304 SREF (name, 0) = DRIVE_LETTER (drive);
1305 XSTRING (name)->data[1] = ':'; 1305 SREF (name, 1) = ':';
1306 } 1306 }
1307 return name; 1307 return name;
1308#else /* not DOS_NT */ 1308#else /* not DOS_NT */
1309 if (nm == XSTRING (name)->data) 1309 if (nm == SDATA (name))
1310 return name; 1310 return name;
1311 return build_string (nm); 1311 return build_string (nm);
1312#endif /* not DOS_NT */ 1312#endif /* not DOS_NT */
@@ -1419,7 +1419,7 @@ See also the function `substitute-in-file-name'. */)
1419#endif 1419#endif
1420 && !newdir) 1420 && !newdir)
1421 { 1421 {
1422 newdir = XSTRING (default_directory)->data; 1422 newdir = SDATA (default_directory);
1423#ifdef DOS_NT 1423#ifdef DOS_NT
1424 /* Note if special escape prefix is present, but remove for now. */ 1424 /* Note if special escape prefix is present, but remove for now. */
1425 if (newdir[0] == '/' && newdir[1] == ':') 1425 if (newdir[0] == '/' && newdir[1] == ':')
@@ -1726,7 +1726,7 @@ See also the function `substitute-in-file-name'.")
1726 name = Fupcase (name); 1726 name = Fupcase (name);
1727#endif 1727#endif
1728 1728
1729 nm = XSTRING (name)->data; 1729 nm = SDATA (name);
1730 1730
1731 /* If nm is absolute, flush ...// and detect /./ and /../. 1731 /* If nm is absolute, flush ...// and detect /./ and /../.
1732 If no /./ or /../ we can return right away. */ 1732 If no /./ or /../ we can return right away. */
@@ -1835,7 +1835,7 @@ See also the function `substitute-in-file-name'.")
1835 if (index (nm, '/')) 1835 if (index (nm, '/'))
1836 return build_string (sys_translate_unix (nm)); 1836 return build_string (sys_translate_unix (nm));
1837#endif /* VMS */ 1837#endif /* VMS */
1838 if (nm == XSTRING (name)->data) 1838 if (nm == SDATA (name))
1839 return name; 1839 return name;
1840 return build_string (nm); 1840 return build_string (nm);
1841 } 1841 }
@@ -1896,7 +1896,7 @@ See also the function `substitute-in-file-name'.")
1896 if (NILP (defalt)) 1896 if (NILP (defalt))
1897 defalt = current_buffer->directory; 1897 defalt = current_buffer->directory;
1898 CHECK_STRING (defalt); 1898 CHECK_STRING (defalt);
1899 newdir = XSTRING (defalt)->data; 1899 newdir = SDATA (defalt);
1900 } 1900 }
1901 1901
1902 /* Now concatenate the directory and name to new space in the stack frame */ 1902 /* Now concatenate the directory and name to new space in the stack frame */
@@ -2046,13 +2046,13 @@ duplicates what `expand-file-name' does. */)
2046 if (!NILP (handler)) 2046 if (!NILP (handler))
2047 return call2 (handler, Qsubstitute_in_file_name, filename); 2047 return call2 (handler, Qsubstitute_in_file_name, filename);
2048 2048
2049 nm = XSTRING (filename)->data; 2049 nm = SDATA (filename);
2050#ifdef DOS_NT 2050#ifdef DOS_NT
2051 nm = strcpy (alloca (strlen (nm) + 1), nm); 2051 nm = strcpy (alloca (strlen (nm) + 1), nm);
2052 CORRECT_DIR_SEPS (nm); 2052 CORRECT_DIR_SEPS (nm);
2053 substituted = (strcmp (nm, XSTRING (filename)->data) != 0); 2053 substituted = (strcmp (nm, SDATA (filename)) != 0);
2054#endif 2054#endif
2055 endp = nm + STRING_BYTES (XSTRING (filename)); 2055 endp = nm + SBYTES (filename);
2056 2056
2057 /* If /~ or // appears, discard everything through first slash. */ 2057 /* If /~ or // appears, discard everything through first slash. */
2058 2058
@@ -2168,7 +2168,7 @@ duplicates what `expand-file-name' does. */)
2168 2168
2169 /* If substitution required, recopy the string and do it */ 2169 /* If substitution required, recopy the string and do it */
2170 /* Make space in stack frame for the new copy */ 2170 /* Make space in stack frame for the new copy */
2171 xnm = (unsigned char *) alloca (STRING_BYTES (XSTRING (filename)) + total + 1); 2171 xnm = (unsigned char *) alloca (SBYTES (filename) + total + 1);
2172 x = xnm; 2172 x = xnm;
2173 2173
2174 /* Copy the rest of the name through, replacing $ constructs with values */ 2174 /* Copy the rest of the name through, replacing $ constructs with values */
@@ -2279,16 +2279,16 @@ expand_and_dir_to_file (filename, defdir)
2279 absname = Fexpand_file_name (filename, defdir); 2279 absname = Fexpand_file_name (filename, defdir);
2280#ifdef VMS 2280#ifdef VMS
2281 { 2281 {
2282 register int c = XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1]; 2282 register int c = SREF (absname, SBYTES (absname) - 1);
2283 if (c == ':' || c == ']' || c == '>') 2283 if (c == ':' || c == ']' || c == '>')
2284 absname = Fdirectory_file_name (absname); 2284 absname = Fdirectory_file_name (absname);
2285 } 2285 }
2286#else 2286#else
2287 /* Remove final slash, if any (unless this is the root dir). 2287 /* Remove final slash, if any (unless this is the root dir).
2288 stat behaves differently depending! */ 2288 stat behaves differently depending! */
2289 if (XSTRING (absname)->size > 1 2289 if (SCHARS (absname) > 1
2290 && IS_DIRECTORY_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1]) 2290 && IS_DIRECTORY_SEP (SREF (absname, SBYTES (absname) - 1))
2291 && !IS_DEVICE_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname))-2])) 2291 && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname)-2)))
2292 /* We cannot take shortcuts; they might be wrong for magic file names. */ 2292 /* We cannot take shortcuts; they might be wrong for magic file names. */
2293 absname = Fdirectory_file_name (absname); 2293 absname = Fdirectory_file_name (absname);
2294#endif 2294#endif
@@ -2323,7 +2323,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2323 2323
2324 /* stat is a good way to tell whether the file exists, 2324 /* stat is a good way to tell whether the file exists,
2325 regardless of what access permissions it has. */ 2325 regardless of what access permissions it has. */
2326 if (stat (XSTRING (encoded_filename)->data, &statbuf) >= 0) 2326 if (stat (SDATA (encoded_filename), &statbuf) >= 0)
2327 { 2327 {
2328 if (! interactive) 2328 if (! interactive)
2329 Fsignal (Qfile_already_exists, 2329 Fsignal (Qfile_already_exists,
@@ -2331,7 +2331,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2331 Fcons (absname, Qnil))); 2331 Fcons (absname, Qnil)));
2332 GCPRO1 (absname); 2332 GCPRO1 (absname);
2333 tem = format1 ("File %s already exists; %s anyway? ", 2333 tem = format1 ("File %s already exists; %s anyway? ",
2334 XSTRING (absname)->data, querystring); 2334 SDATA (absname), querystring);
2335 if (quick) 2335 if (quick)
2336 tem = Fy_or_n_p (tem); 2336 tem = Fy_or_n_p (tem);
2337 else 2337 else
@@ -2404,12 +2404,12 @@ A prefix arg makes KEEP-TIME non-nil. */)
2404 || INTEGERP (ok_if_already_exists)) 2404 || INTEGERP (ok_if_already_exists))
2405 barf_or_query_if_file_exists (encoded_newname, "copy to it", 2405 barf_or_query_if_file_exists (encoded_newname, "copy to it",
2406 INTEGERP (ok_if_already_exists), &out_st, 0); 2406 INTEGERP (ok_if_already_exists), &out_st, 0);
2407 else if (stat (XSTRING (encoded_newname)->data, &out_st) < 0) 2407 else if (stat (SDATA (encoded_newname), &out_st) < 0)
2408 out_st.st_mode = 0; 2408 out_st.st_mode = 0;
2409 2409
2410#ifdef WINDOWSNT 2410#ifdef WINDOWSNT
2411 if (!CopyFile (XSTRING (encoded_file)->data, 2411 if (!CopyFile (SDATA (encoded_file),
2412 XSTRING (encoded_newname)->data, 2412 SDATA (encoded_newname),
2413 FALSE)) 2413 FALSE))
2414 report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil))); 2414 report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
2415 else if (NILP (keep_time)) 2415 else if (NILP (keep_time))
@@ -2419,7 +2419,7 @@ A prefix arg makes KEEP-TIME non-nil. */)
2419 char * filename; 2419 char * filename;
2420 2420
2421 EMACS_GET_TIME (now); 2421 EMACS_GET_TIME (now);
2422 filename = XSTRING (encoded_newname)->data; 2422 filename = SDATA (encoded_newname);
2423 2423
2424 /* Ensure file is writable while its modified time is set. */ 2424 /* Ensure file is writable while its modified time is set. */
2425 attributes = GetFileAttributes (filename); 2425 attributes = GetFileAttributes (filename);
@@ -2436,7 +2436,7 @@ A prefix arg makes KEEP-TIME non-nil. */)
2436 SetFileAttributes (filename, attributes); 2436 SetFileAttributes (filename, attributes);
2437 } 2437 }
2438#else /* not WINDOWSNT */ 2438#else /* not WINDOWSNT */
2439 ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0); 2439 ifd = emacs_open (SDATA (encoded_file), O_RDONLY, 0);
2440 if (ifd < 0) 2440 if (ifd < 0)
2441 report_file_error ("Opening input file", Fcons (file, Qnil)); 2441 report_file_error ("Opening input file", Fcons (file, Qnil));
2442 2442
@@ -2472,13 +2472,13 @@ A prefix arg makes KEEP-TIME non-nil. */)
2472 2472
2473#ifdef VMS 2473#ifdef VMS
2474 /* Create the copy file with the same record format as the input file */ 2474 /* Create the copy file with the same record format as the input file */
2475 ofd = sys_creat (XSTRING (encoded_newname)->data, 0666, ifd); 2475 ofd = sys_creat (SDATA (encoded_newname), 0666, ifd);
2476#else 2476#else
2477#ifdef MSDOS 2477#ifdef MSDOS
2478 /* System's default file type was set to binary by _fmode in emacs.c. */ 2478 /* System's default file type was set to binary by _fmode in emacs.c. */
2479 ofd = creat (XSTRING (encoded_newname)->data, S_IREAD | S_IWRITE); 2479 ofd = creat (SDATA (encoded_newname), S_IREAD | S_IWRITE);
2480#else /* not MSDOS */ 2480#else /* not MSDOS */
2481 ofd = creat (XSTRING (encoded_newname)->data, 0666); 2481 ofd = creat (SDATA (encoded_newname), 0666);
2482#endif /* not MSDOS */ 2482#endif /* not MSDOS */
2483#endif /* VMS */ 2483#endif /* VMS */
2484 if (ofd < 0) 2484 if (ofd < 0)
@@ -2504,14 +2504,14 @@ A prefix arg makes KEEP-TIME non-nil. */)
2504 EMACS_TIME atime, mtime; 2504 EMACS_TIME atime, mtime;
2505 EMACS_SET_SECS_USECS (atime, st.st_atime, 0); 2505 EMACS_SET_SECS_USECS (atime, st.st_atime, 0);
2506 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0); 2506 EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
2507 if (set_file_times (XSTRING (encoded_newname)->data, 2507 if (set_file_times (SDATA (encoded_newname),
2508 atime, mtime)) 2508 atime, mtime))
2509 Fsignal (Qfile_date_error, 2509 Fsignal (Qfile_date_error,
2510 Fcons (build_string ("Cannot set file date"), 2510 Fcons (build_string ("Cannot set file date"),
2511 Fcons (newname, Qnil))); 2511 Fcons (newname, Qnil)));
2512 } 2512 }
2513#ifndef MSDOS 2513#ifndef MSDOS
2514 chmod (XSTRING (encoded_newname)->data, st.st_mode & 07777); 2514 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2515#else /* MSDOS */ 2515#else /* MSDOS */
2516#if defined (__DJGPP__) && __DJGPP__ > 1 2516#if defined (__DJGPP__) && __DJGPP__ > 1
2517 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits, 2517 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
@@ -2519,7 +2519,7 @@ A prefix arg makes KEEP-TIME non-nil. */)
2519 get only the READ bit, which will make the copied file read-only, 2519 get only the READ bit, which will make the copied file read-only,
2520 so it's better not to chmod at all. */ 2520 so it's better not to chmod at all. */
2521 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0) 2521 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
2522 chmod (XSTRING (encoded_newname)->data, st.st_mode & 07777); 2522 chmod (SDATA (encoded_newname), st.st_mode & 07777);
2523#endif /* DJGPP version 2 or newer */ 2523#endif /* DJGPP version 2 or newer */
2524#endif /* MSDOS */ 2524#endif /* MSDOS */
2525 } 2525 }
@@ -2553,7 +2553,7 @@ DEFUN ("make-directory-internal", Fmake_directory_internal,
2553 2553
2554 encoded_dir = ENCODE_FILE (directory); 2554 encoded_dir = ENCODE_FILE (directory);
2555 2555
2556 dir = XSTRING (encoded_dir)->data; 2556 dir = SDATA (encoded_dir);
2557 2557
2558#ifdef WINDOWSNT 2558#ifdef WINDOWSNT
2559 if (mkdir (dir) != 0) 2559 if (mkdir (dir) != 0)
@@ -2583,7 +2583,7 @@ DEFUN ("delete-directory", Fdelete_directory, Sdelete_directory, 1, 1, "FDelete
2583 2583
2584 encoded_dir = ENCODE_FILE (directory); 2584 encoded_dir = ENCODE_FILE (directory);
2585 2585
2586 dir = XSTRING (encoded_dir)->data; 2586 dir = SDATA (encoded_dir);
2587 2587
2588 if (rmdir (dir) != 0) 2588 if (rmdir (dir) != 0)
2589 report_file_error ("Removing directory", Flist (1, &directory)); 2589 report_file_error ("Removing directory", Flist (1, &directory));
@@ -2609,7 +2609,7 @@ If file has multiple names, it continues to exist with the other names. */)
2609 2609
2610 encoded_file = ENCODE_FILE (filename); 2610 encoded_file = ENCODE_FILE (filename);
2611 2611
2612 if (0 > unlink (XSTRING (encoded_file)->data)) 2612 if (0 > unlink (SDATA (encoded_file)))
2613 report_file_error ("Removing old name", Flist (1, &filename)); 2613 report_file_error ("Removing old name", Flist (1, &filename));
2614 return Qnil; 2614 return Qnil;
2615} 2615}
@@ -2679,10 +2679,10 @@ This is what happens in interactive use with M-x. */)
2679 barf_or_query_if_file_exists (encoded_newname, "rename to it", 2679 barf_or_query_if_file_exists (encoded_newname, "rename to it",
2680 INTEGERP (ok_if_already_exists), 0, 0); 2680 INTEGERP (ok_if_already_exists), 0, 0);
2681#ifndef BSD4_1 2681#ifndef BSD4_1
2682 if (0 > rename (XSTRING (encoded_file)->data, XSTRING (encoded_newname)->data)) 2682 if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname)))
2683#else 2683#else
2684 if (0 > link (XSTRING (encoded_file)->data, XSTRING (encoded_newname)->data) 2684 if (0 > link (SDATA (encoded_file), SDATA (encoded_newname))
2685 || 0 > unlink (XSTRING (encoded_file)->data)) 2685 || 0 > unlink (SDATA (encoded_file)))
2686#endif 2686#endif
2687 { 2687 {
2688 if (errno == EXDEV) 2688 if (errno == EXDEV)
@@ -2754,8 +2754,8 @@ This is what happens in interactive use with M-x. */)
2754 barf_or_query_if_file_exists (encoded_newname, "make it a new name", 2754 barf_or_query_if_file_exists (encoded_newname, "make it a new name",
2755 INTEGERP (ok_if_already_exists), 0, 0); 2755 INTEGERP (ok_if_already_exists), 0, 0);
2756 2756
2757 unlink (XSTRING (newname)->data); 2757 unlink (SDATA (newname));
2758 if (0 > link (XSTRING (encoded_file)->data, XSTRING (encoded_newname)->data)) 2758 if (0 > link (SDATA (encoded_file), SDATA (encoded_newname)))
2759 { 2759 {
2760#ifdef NO_ARG_ARRAY 2760#ifdef NO_ARG_ARRAY
2761 args[0] = file; 2761 args[0] = file;
@@ -2795,7 +2795,7 @@ This happens for interactive use with M-x. */)
2795 /* If the link target has a ~, we must expand it to get 2795 /* If the link target has a ~, we must expand it to get
2796 a truly valid file name. Otherwise, do not expand; 2796 a truly valid file name. Otherwise, do not expand;
2797 we want to permit links to relative file names. */ 2797 we want to permit links to relative file names. */
2798 if (XSTRING (filename)->data[0] == '~') 2798 if (SREF (filename, 0) == '~')
2799 filename = Fexpand_file_name (filename, Qnil); 2799 filename = Fexpand_file_name (filename, Qnil);
2800 linkname = Fexpand_file_name (linkname, Qnil); 2800 linkname = Fexpand_file_name (linkname, Qnil);
2801 2801
@@ -2820,15 +2820,15 @@ This happens for interactive use with M-x. */)
2820 || INTEGERP (ok_if_already_exists)) 2820 || INTEGERP (ok_if_already_exists))
2821 barf_or_query_if_file_exists (encoded_linkname, "make it a link", 2821 barf_or_query_if_file_exists (encoded_linkname, "make it a link",
2822 INTEGERP (ok_if_already_exists), 0, 0); 2822 INTEGERP (ok_if_already_exists), 0, 0);
2823 if (0 > symlink (XSTRING (encoded_filename)->data, 2823 if (0 > symlink (SDATA (encoded_filename),
2824 XSTRING (encoded_linkname)->data)) 2824 SDATA (encoded_linkname)))
2825 { 2825 {
2826 /* If we didn't complain already, silently delete existing file. */ 2826 /* If we didn't complain already, silently delete existing file. */
2827 if (errno == EEXIST) 2827 if (errno == EEXIST)
2828 { 2828 {
2829 unlink (XSTRING (encoded_linkname)->data); 2829 unlink (SDATA (encoded_linkname));
2830 if (0 <= symlink (XSTRING (encoded_filename)->data, 2830 if (0 <= symlink (SDATA (encoded_filename),
2831 XSTRING (encoded_linkname)->data)) 2831 SDATA (encoded_linkname)))
2832 { 2832 {
2833 UNGCPRO; 2833 UNGCPRO;
2834 return Qnil; 2834 return Qnil;
@@ -2860,15 +2860,15 @@ If STRING is nil or a null string, the logical name NAME is deleted. */)
2860{ 2860{
2861 CHECK_STRING (name); 2861 CHECK_STRING (name);
2862 if (NILP (string)) 2862 if (NILP (string))
2863 delete_logical_name (XSTRING (name)->data); 2863 delete_logical_name (SDATA (name));
2864 else 2864 else
2865 { 2865 {
2866 CHECK_STRING (string); 2866 CHECK_STRING (string);
2867 2867
2868 if (XSTRING (string)->size == 0) 2868 if (SCHARS (string) == 0)
2869 delete_logical_name (XSTRING (name)->data); 2869 delete_logical_name (SDATA (name));
2870 else 2870 else
2871 define_logical_name (XSTRING (name)->data, XSTRING (string)->data); 2871 define_logical_name (SDATA (name), SDATA (string));
2872 } 2872 }
2873 2873
2874 return string; 2874 return string;
@@ -2887,7 +2887,7 @@ DEFUN ("sysnetunam", Fsysnetunam, Ssysnetunam, 2, 2, 0,
2887 CHECK_STRING (path); 2887 CHECK_STRING (path);
2888 CHECK_STRING (login); 2888 CHECK_STRING (login);
2889 2889
2890 netresult = netunam (XSTRING (path)->data, XSTRING (login)->data); 2890 netresult = netunam (SDATA (path), SDATA (login));
2891 2891
2892 if (netresult == -1) 2892 if (netresult == -1)
2893 return Qnil; 2893 return Qnil;
@@ -2906,7 +2906,7 @@ On Unix, this is a name starting with a `/' or a `~'. */)
2906 unsigned char *ptr; 2906 unsigned char *ptr;
2907 2907
2908 CHECK_STRING (filename); 2908 CHECK_STRING (filename);
2909 ptr = XSTRING (filename)->data; 2909 ptr = SDATA (filename);
2910 if (IS_DIRECTORY_SEP (*ptr) || *ptr == '~' 2910 if (IS_DIRECTORY_SEP (*ptr) || *ptr == '~'
2911#ifdef VMS 2911#ifdef VMS
2912/* ??? This criterion is probably wrong for '<'. */ 2912/* ??? This criterion is probably wrong for '<'. */
@@ -3003,7 +3003,7 @@ See also `file-readable-p' and `file-attributes'. */)
3003 3003
3004 absname = ENCODE_FILE (absname); 3004 absname = ENCODE_FILE (absname);
3005 3005
3006 return (stat (XSTRING (absname)->data, &statbuf) >= 0) ? Qt : Qnil; 3006 return (stat (SDATA (absname), &statbuf) >= 0) ? Qt : Qnil;
3007} 3007}
3008 3008
3009DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, 3009DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0,
@@ -3026,7 +3026,7 @@ For a directory, this means you can access files in that directory. */)
3026 3026
3027 absname = ENCODE_FILE (absname); 3027 absname = ENCODE_FILE (absname);
3028 3028
3029 return (check_executable (XSTRING (absname)->data) ? Qt : Qnil); 3029 return (check_executable (SDATA (absname)) ? Qt : Qnil);
3030} 3030}
3031 3031
3032DEFUN ("file-readable-p", Ffile_readable_p, Sfile_readable_p, 1, 1, 0, 3032DEFUN ("file-readable-p", Ffile_readable_p, Sfile_readable_p, 1, 1, 0,
@@ -3055,7 +3055,7 @@ See also `file-exists-p' and `file-attributes'. */)
3055#if defined(DOS_NT) || defined(macintosh) 3055#if defined(DOS_NT) || defined(macintosh)
3056 /* Under MS-DOS, Windows, and Macintosh, open does not work for 3056 /* Under MS-DOS, Windows, and Macintosh, open does not work for
3057 directories. */ 3057 directories. */
3058 if (access (XSTRING (absname)->data, 0) == 0) 3058 if (access (SDATA (absname), 0) == 0)
3059 return Qt; 3059 return Qt;
3060 return Qnil; 3060 return Qnil;
3061#else /* not DOS_NT and not macintosh */ 3061#else /* not DOS_NT and not macintosh */
@@ -3064,13 +3064,13 @@ See also `file-exists-p' and `file-attributes'. */)
3064 /* Opening a fifo without O_NONBLOCK can wait. 3064 /* Opening a fifo without O_NONBLOCK can wait.
3065 We don't want to wait. But we don't want to mess wth O_NONBLOCK 3065 We don't want to wait. But we don't want to mess wth O_NONBLOCK
3066 except in the case of a fifo, on a system which handles it. */ 3066 except in the case of a fifo, on a system which handles it. */
3067 desc = stat (XSTRING (absname)->data, &statbuf); 3067 desc = stat (SDATA (absname), &statbuf);
3068 if (desc < 0) 3068 if (desc < 0)
3069 return Qnil; 3069 return Qnil;
3070 if (S_ISFIFO (statbuf.st_mode)) 3070 if (S_ISFIFO (statbuf.st_mode))
3071 flags |= O_NONBLOCK; 3071 flags |= O_NONBLOCK;
3072#endif 3072#endif
3073 desc = emacs_open (XSTRING (absname)->data, flags, 0); 3073 desc = emacs_open (SDATA (absname), flags, 0);
3074 if (desc < 0) 3074 if (desc < 0)
3075 return Qnil; 3075 return Qnil;
3076 emacs_close (desc); 3076 emacs_close (desc);
@@ -3099,8 +3099,8 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
3099 return call2 (handler, Qfile_writable_p, absname); 3099 return call2 (handler, Qfile_writable_p, absname);
3100 3100
3101 encoded = ENCODE_FILE (absname); 3101 encoded = ENCODE_FILE (absname);
3102 if (stat (XSTRING (encoded)->data, &statbuf) >= 0) 3102 if (stat (SDATA (encoded), &statbuf) >= 0)
3103 return (check_writable (XSTRING (encoded)->data) 3103 return (check_writable (SDATA (encoded))
3104 ? Qt : Qnil); 3104 ? Qt : Qnil);
3105 3105
3106 dir = Ffile_name_directory (absname); 3106 dir = Ffile_name_directory (absname);
@@ -3118,11 +3118,11 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
3118 /* The read-only attribute of the parent directory doesn't affect 3118 /* The read-only attribute of the parent directory doesn't affect
3119 whether a file or directory can be created within it. Some day we 3119 whether a file or directory can be created within it. Some day we
3120 should check ACLs though, which do affect this. */ 3120 should check ACLs though, which do affect this. */
3121 if (stat (XSTRING (dir)->data, &statbuf) < 0) 3121 if (stat (SDATA (dir), &statbuf) < 0)
3122 return Qnil; 3122 return Qnil;
3123 return (statbuf.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; 3123 return (statbuf.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil;
3124#else 3124#else
3125 return (check_writable (!NILP (dir) ? (char *) XSTRING (dir)->data : "") 3125 return (check_writable (!NILP (dir) ? (char *) SDATA (dir) : "")
3126 ? Qt : Qnil); 3126 ? Qt : Qnil);
3127#endif 3127#endif
3128} 3128}
@@ -3150,9 +3150,9 @@ If there is no error, we return nil. */)
3150 3150
3151 encoded_filename = ENCODE_FILE (absname); 3151 encoded_filename = ENCODE_FILE (absname);
3152 3152
3153 fd = emacs_open (XSTRING (encoded_filename)->data, O_RDONLY, 0); 3153 fd = emacs_open (SDATA (encoded_filename), O_RDONLY, 0);
3154 if (fd < 0) 3154 if (fd < 0)
3155 report_file_error (XSTRING (string)->data, Fcons (filename, Qnil)); 3155 report_file_error (SDATA (string), Fcons (filename, Qnil));
3156 emacs_close (fd); 3156 emacs_close (fd);
3157 3157
3158 return Qnil; 3158 return Qnil;
@@ -3192,7 +3192,7 @@ Otherwise returns nil. */)
3192 bzero (buf, bufsize); 3192 bzero (buf, bufsize);
3193 3193
3194 errno = 0; 3194 errno = 0;
3195 valsize = readlink (XSTRING (filename)->data, buf, bufsize); 3195 valsize = readlink (SDATA (filename), buf, bufsize);
3196 if (valsize == -1) 3196 if (valsize == -1)
3197 { 3197 {
3198#ifdef ERANGE 3198#ifdef ERANGE
@@ -3241,7 +3241,7 @@ See `file-symlink-p' to distinguish symlinks. */)
3241 3241
3242 absname = ENCODE_FILE (absname); 3242 absname = ENCODE_FILE (absname);
3243 3243
3244 if (stat (XSTRING (absname)->data, &st) < 0) 3244 if (stat (SDATA (absname), &st) < 0)
3245 return Qnil; 3245 return Qnil;
3246 return (st.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; 3246 return (st.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil;
3247} 3247}
@@ -3307,7 +3307,7 @@ This is the sort of file that holds an ordinary stream of data bytes. */)
3307 3307
3308 /* Tell stat to use expensive method to get accurate info. */ 3308 /* Tell stat to use expensive method to get accurate info. */
3309 Vw32_get_true_file_attributes = Qt; 3309 Vw32_get_true_file_attributes = Qt;
3310 result = stat (XSTRING (absname)->data, &st); 3310 result = stat (SDATA (absname), &st);
3311 Vw32_get_true_file_attributes = tem; 3311 Vw32_get_true_file_attributes = tem;
3312 3312
3313 if (result < 0) 3313 if (result < 0)
@@ -3315,7 +3315,7 @@ This is the sort of file that holds an ordinary stream of data bytes. */)
3315 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; 3315 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil;
3316 } 3316 }
3317#else 3317#else
3318 if (stat (XSTRING (absname)->data, &st) < 0) 3318 if (stat (SDATA (absname), &st) < 0)
3319 return Qnil; 3319 return Qnil;
3320 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; 3320 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil;
3321#endif 3321#endif
@@ -3340,10 +3340,10 @@ DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
3340 3340
3341 absname = ENCODE_FILE (absname); 3341 absname = ENCODE_FILE (absname);
3342 3342
3343 if (stat (XSTRING (absname)->data, &st) < 0) 3343 if (stat (SDATA (absname), &st) < 0)
3344 return Qnil; 3344 return Qnil;
3345#if defined (MSDOS) && __DJGPP__ < 2 3345#if defined (MSDOS) && __DJGPP__ < 2
3346 if (check_executable (XSTRING (absname)->data)) 3346 if (check_executable (SDATA (absname)))
3347 st.st_mode |= S_IEXEC; 3347 st.st_mode |= S_IEXEC;
3348#endif /* MSDOS && __DJGPP__ < 2 */ 3348#endif /* MSDOS && __DJGPP__ < 2 */
3349 3349
@@ -3370,7 +3370,7 @@ Only the 12 low bits of MODE are used. */)
3370 3370
3371 encoded_absname = ENCODE_FILE (absname); 3371 encoded_absname = ENCODE_FILE (absname);
3372 3372
3373 if (chmod (XSTRING (encoded_absname)->data, XINT (mode)) < 0) 3373 if (chmod (SDATA (encoded_absname), XINT (mode)) < 0)
3374 report_file_error ("Doing chmod", Fcons (absname, Qnil)); 3374 report_file_error ("Doing chmod", Fcons (absname, Qnil));
3375 3375
3376 return Qnil; 3376 return Qnil;
@@ -3456,12 +3456,12 @@ otherwise, if FILE2 does not exist, the answer is t. */)
3456 absname2 = ENCODE_FILE (absname2); 3456 absname2 = ENCODE_FILE (absname2);
3457 UNGCPRO; 3457 UNGCPRO;
3458 3458
3459 if (stat (XSTRING (absname1)->data, &st) < 0) 3459 if (stat (SDATA (absname1), &st) < 0)
3460 return Qnil; 3460 return Qnil;
3461 3461
3462 mtime1 = st.st_mtime; 3462 mtime1 = st.st_mtime;
3463 3463
3464 if (stat (XSTRING (absname2)->data, &st) < 0) 3464 if (stat (SDATA (absname2), &st) < 0)
3465 return Qt; 3465 return Qt;
3466 3466
3467 return (mtime1 > st.st_mtime) ? Qt : Qnil; 3467 return (mtime1 > st.st_mtime) ? Qt : Qnil;
@@ -3640,15 +3640,15 @@ actually used. */)
3640 3640
3641 /* Tell stat to use expensive method to get accurate info. */ 3641 /* Tell stat to use expensive method to get accurate info. */
3642 Vw32_get_true_file_attributes = Qt; 3642 Vw32_get_true_file_attributes = Qt;
3643 total = stat (XSTRING (filename)->data, &st); 3643 total = stat (SDATA (filename), &st);
3644 Vw32_get_true_file_attributes = tem; 3644 Vw32_get_true_file_attributes = tem;
3645 } 3645 }
3646 if (total < 0) 3646 if (total < 0)
3647#else 3647#else
3648#ifndef APOLLO 3648#ifndef APOLLO
3649 if (stat (XSTRING (filename)->data, &st) < 0) 3649 if (stat (SDATA (filename), &st) < 0)
3650#else 3650#else
3651 if ((fd = emacs_open (XSTRING (filename)->data, O_RDONLY, 0)) < 0 3651 if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0
3652 || fstat (fd, &st) < 0) 3652 || fstat (fd, &st) < 0)
3653#endif /* not APOLLO */ 3653#endif /* not APOLLO */
3654#endif /* WINDOWSNT */ 3654#endif /* WINDOWSNT */
@@ -3683,7 +3683,7 @@ actually used. */)
3683#endif 3683#endif
3684 3684
3685 if (fd < 0) 3685 if (fd < 0)
3686 if ((fd = emacs_open (XSTRING (filename)->data, O_RDONLY, 0)) < 0) 3686 if ((fd = emacs_open (SDATA (filename), O_RDONLY, 0)) < 0)
3687 goto badopen; 3687 goto badopen;
3688 3688
3689 /* Replacement should preserve point as it preserves markers. */ 3689 /* Replacement should preserve point as it preserves markers. */
@@ -3779,7 +3779,7 @@ actually used. */)
3779 3779
3780 if (nread < 0) 3780 if (nread < 0)
3781 error ("IO error reading %s: %s", 3781 error ("IO error reading %s: %s",
3782 XSTRING (orig_filename)->data, emacs_strerror (errno)); 3782 SDATA (orig_filename), emacs_strerror (errno));
3783 else if (nread > 0) 3783 else if (nread > 0)
3784 { 3784 {
3785 struct buffer *prev = current_buffer; 3785 struct buffer *prev = current_buffer;
@@ -3896,7 +3896,7 @@ actually used. */)
3896 nread = emacs_read (fd, buffer, sizeof buffer); 3896 nread = emacs_read (fd, buffer, sizeof buffer);
3897 if (nread < 0) 3897 if (nread < 0)
3898 error ("IO error reading %s: %s", 3898 error ("IO error reading %s: %s",
3899 XSTRING (orig_filename)->data, emacs_strerror (errno)); 3899 SDATA (orig_filename), emacs_strerror (errno));
3900 else if (nread == 0) 3900 else if (nread == 0)
3901 break; 3901 break;
3902 3902
@@ -3967,7 +3967,7 @@ actually used. */)
3967 nread = emacs_read (fd, buffer + total_read, trial - total_read); 3967 nread = emacs_read (fd, buffer + total_read, trial - total_read);
3968 if (nread < 0) 3968 if (nread < 0)
3969 error ("IO error reading %s: %s", 3969 error ("IO error reading %s: %s",
3970 XSTRING (orig_filename)->data, emacs_strerror (errno)); 3970 SDATA (orig_filename), emacs_strerror (errno));
3971 else if (nread == 0) 3971 else if (nread == 0)
3972 break; 3972 break;
3973 total_read += nread; 3973 total_read += nread;
@@ -4150,7 +4150,7 @@ actually used. */)
4150 4150
4151 if (how_much == -1) 4151 if (how_much == -1)
4152 error ("IO error reading %s: %s", 4152 error ("IO error reading %s: %s",
4153 XSTRING (orig_filename)->data, emacs_strerror (errno)); 4153 SDATA (orig_filename), emacs_strerror (errno));
4154 else if (how_much == -2) 4154 else if (how_much == -2)
4155 error ("maximum buffer size exceeded"); 4155 error ("maximum buffer size exceeded");
4156 } 4156 }
@@ -4370,7 +4370,7 @@ actually used. */)
4370 4370
4371 if (how_much < 0) 4371 if (how_much < 0)
4372 error ("IO error reading %s: %s", 4372 error ("IO error reading %s: %s",
4373 XSTRING (orig_filename)->data, emacs_strerror (errno)); 4373 SDATA (orig_filename), emacs_strerror (errno));
4374 4374
4375 notfound: 4375 notfound:
4376 4376
@@ -4493,7 +4493,7 @@ actually used. */)
4493 if (!EQ (current_buffer->undo_list, Qt)) 4493 if (!EQ (current_buffer->undo_list, Qt))
4494 current_buffer->undo_list = Qnil; 4494 current_buffer->undo_list = Qnil;
4495#ifdef APOLLO 4495#ifdef APOLLO
4496 stat (XSTRING (filename)->data, &st); 4496 stat (SDATA (filename), &st);
4497#endif 4497#endif
4498 4498
4499 if (NILP (handler)) 4499 if (NILP (handler))
@@ -4880,7 +4880,7 @@ This does code conversion according to the value of
4880 4880
4881 encoded_filename = ENCODE_FILE (filename); 4881 encoded_filename = ENCODE_FILE (filename);
4882 4882
4883 fn = XSTRING (encoded_filename)->data; 4883 fn = SDATA (encoded_filename);
4884 desc = -1; 4884 desc = -1;
4885 if (!NILP (append)) 4885 if (!NILP (append))
4886#ifdef DOS_NT 4886#ifdef DOS_NT
@@ -4897,7 +4897,7 @@ This does code conversion according to the value of
4897 desc = emacs_open (fn, O_RDWR, 0); 4897 desc = emacs_open (fn, O_RDWR, 0);
4898 if (desc < 0) 4898 if (desc < 0)
4899 desc = creat_copy_attrs (STRINGP (current_buffer->filename) 4899 desc = creat_copy_attrs (STRINGP (current_buffer->filename)
4900 ? XSTRING (current_buffer->filename)->data : 0, 4900 ? SDATA (current_buffer->filename) : 0,
4901 fn); 4901 fn);
4902 } 4902 }
4903 else /* Write to temporary name and rename if no errors */ 4903 else /* Write to temporary name and rename if no errors */
@@ -4909,8 +4909,8 @@ This does code conversion according to the value of
4909 { 4909 {
4910 temp_name = Fmake_temp_name (concat2 (temp_name, 4910 temp_name = Fmake_temp_name (concat2 (temp_name,
4911 build_string ("$$SAVE$$"))); 4911 build_string ("$$SAVE$$")));
4912 fname = XSTRING (filename)->data; 4912 fname = SDATA (filename);
4913 fn = XSTRING (temp_name)->data; 4913 fn = SDATA (temp_name);
4914 desc = creat_copy_attrs (fname, fn); 4914 desc = creat_copy_attrs (fname, fn);
4915 if (desc < 0) 4915 if (desc < 0)
4916 { 4916 {
@@ -5019,7 +5019,7 @@ This does code conversion according to the value of
5019 5019
5020 if (STRINGP (start)) 5020 if (STRINGP (start))
5021 { 5021 {
5022 failure = 0 > a_write (desc, start, 0, XSTRING (start)->size, 5022 failure = 0 > a_write (desc, start, 0, SCHARS (start),
5023 &annotations, &coding); 5023 &annotations, &coding);
5024 save_errno = errno; 5024 save_errno = errno;
5025 } 5025 }
@@ -5129,7 +5129,7 @@ This does code conversion according to the value of
5129 current_buffer->modtime = st.st_mtime; 5129 current_buffer->modtime = st.st_mtime;
5130 5130
5131 if (failure) 5131 if (failure)
5132 error ("IO error writing %s: %s", XSTRING (filename)->data, 5132 error ("IO error writing %s: %s", SDATA (filename),
5133 emacs_strerror (save_errno)); 5133 emacs_strerror (save_errno));
5134 5134
5135 if (visiting) 5135 if (visiting)
@@ -5304,7 +5304,7 @@ a_write (desc, string, pos, nchars, annot, coding)
5304 tem = Fcdr (Fcar (*annot)); 5304 tem = Fcdr (Fcar (*annot));
5305 if (STRINGP (tem)) 5305 if (STRINGP (tem))
5306 { 5306 {
5307 if (0 > e_write (desc, tem, 0, XSTRING (tem)->size, coding)) 5307 if (0 > e_write (desc, tem, 0, SCHARS (tem), coding))
5308 return -1; 5308 return -1;
5309 } 5309 }
5310 *annot = Fcdr (*annot); 5310 *annot = Fcdr (*annot);
@@ -5340,8 +5340,8 @@ e_write (desc, string, start, end, coding)
5340 5340
5341 if (STRINGP (string)) 5341 if (STRINGP (string))
5342 { 5342 {
5343 addr = XSTRING (string)->data; 5343 addr = SDATA (string);
5344 nbytes = STRING_BYTES (XSTRING (string)); 5344 nbytes = SBYTES (string);
5345 coding->src_multibyte = STRING_MULTIBYTE (string); 5345 coding->src_multibyte = STRING_MULTIBYTE (string);
5346 } 5346 }
5347 else if (start < end) 5347 else if (start < end)
@@ -5429,7 +5429,7 @@ This means that the file has not been changed since it was visited or saved. */
5429 5429
5430 filename = ENCODE_FILE (b->filename); 5430 filename = ENCODE_FILE (b->filename);
5431 5431
5432 if (stat (XSTRING (filename)->data, &st) < 0) 5432 if (stat (SDATA (filename), &st) < 0)
5433 { 5433 {
5434 /* If the file doesn't exist now and didn't exist before, 5434 /* If the file doesn't exist now and didn't exist before,
5435 we say that it isn't modified, provided the error is a tame one. */ 5435 we say that it isn't modified, provided the error is a tame one. */
@@ -5497,7 +5497,7 @@ An argument specifies the modification time value to use
5497 5497
5498 filename = ENCODE_FILE (filename); 5498 filename = ENCODE_FILE (filename);
5499 5499
5500 if (stat (XSTRING (filename)->data, &st) >= 0) 5500 if (stat (SDATA (filename), &st) >= 0)
5501 current_buffer->modtime = st.st_mtime; 5501 current_buffer->modtime = st.st_mtime;
5502 } 5502 }
5503 5503
@@ -5519,14 +5519,14 @@ auto_save_error (error)
5519 args[2] = Ferror_message_string (error); 5519 args[2] = Ferror_message_string (error);
5520 msg = Fformat (3, args); 5520 msg = Fformat (3, args);
5521 GCPRO1 (msg); 5521 GCPRO1 (msg);
5522 nbytes = STRING_BYTES (XSTRING (msg)); 5522 nbytes = SBYTES (msg);
5523 5523
5524 for (i = 0; i < 3; ++i) 5524 for (i = 0; i < 3; ++i)
5525 { 5525 {
5526 if (i == 0) 5526 if (i == 0)
5527 message2 (XSTRING (msg)->data, nbytes, STRING_MULTIBYTE (msg)); 5527 message2 (SDATA (msg), nbytes, STRING_MULTIBYTE (msg));
5528 else 5528 else
5529 message2_nolog (XSTRING (msg)->data, nbytes, STRING_MULTIBYTE (msg)); 5529 message2_nolog (SDATA (msg), nbytes, STRING_MULTIBYTE (msg));
5530 Fsleep_for (make_number (1), Qnil); 5530 Fsleep_for (make_number (1), Qnil);
5531 } 5531 }
5532 5532
@@ -5541,7 +5541,7 @@ auto_save_1 ()
5541 5541
5542 /* Get visited file's mode to become the auto save file's mode. */ 5542 /* Get visited file's mode to become the auto save file's mode. */
5543 if (! NILP (current_buffer->filename) 5543 if (! NILP (current_buffer->filename)
5544 && stat (XSTRING (current_buffer->filename)->data, &st) >= 0) 5544 && stat (SDATA (current_buffer->filename), &st) >= 0)
5545 /* But make sure we can overwrite it later! */ 5545 /* But make sure we can overwrite it later! */
5546 auto_save_mode_bits = st.st_mode | 0600; 5546 auto_save_mode_bits = st.st_mode | 0600;
5547 else 5547 else
@@ -5635,7 +5635,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5635 call2 (Qmake_directory, dir, Qt); 5635 call2 (Qmake_directory, dir, Qt);
5636 } 5636 }
5637 5637
5638 stream = fopen (XSTRING (listfile)->data, "w"); 5638 stream = fopen (SDATA (listfile), "w");
5639 if (stream != NULL) 5639 if (stream != NULL)
5640 { 5640 {
5641 /* Arrange to close that file whether or not we get an error. 5641 /* Arrange to close that file whether or not we get an error.
@@ -5678,12 +5678,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5678 { 5678 {
5679 if (!NILP (b->filename)) 5679 if (!NILP (b->filename))
5680 { 5680 {
5681 fwrite (XSTRING (b->filename)->data, 1, 5681 fwrite (SDATA (b->filename), 1,
5682 STRING_BYTES (XSTRING (b->filename)), stream); 5682 SBYTES (b->filename), stream);
5683 } 5683 }
5684 putc ('\n', stream); 5684 putc ('\n', stream);
5685 fwrite (XSTRING (b->auto_save_file_name)->data, 1, 5685 fwrite (SDATA (b->auto_save_file_name), 1,
5686 STRING_BYTES (XSTRING (b->auto_save_file_name)), stream); 5686 SBYTES (b->auto_save_file_name), stream);
5687 putc ('\n', stream); 5687 putc ('\n', stream);
5688 } 5688 }
5689 5689
@@ -5817,17 +5817,17 @@ double_dollars (val)
5817 register int n; 5817 register int n;
5818 int osize, count; 5818 int osize, count;
5819 5819
5820 osize = STRING_BYTES (XSTRING (val)); 5820 osize = SBYTES (val);
5821 5821
5822 /* Count the number of $ characters. */ 5822 /* Count the number of $ characters. */
5823 for (n = osize, count = 0, old = XSTRING (val)->data; n > 0; n--) 5823 for (n = osize, count = 0, old = SDATA (val); n > 0; n--)
5824 if (*old++ == '$') count++; 5824 if (*old++ == '$') count++;
5825 if (count > 0) 5825 if (count > 0)
5826 { 5826 {
5827 old = XSTRING (val)->data; 5827 old = SDATA (val);
5828 val = make_uninit_multibyte_string (XSTRING (val)->size + count, 5828 val = make_uninit_multibyte_string (SCHARS (val) + count,
5829 osize + count); 5829 osize + count);
5830 new = XSTRING (val)->data; 5830 new = SDATA (val);
5831 for (n = osize; n > 0; n--) 5831 for (n = osize; n > 0; n--)
5832 if (*old != '$') 5832 if (*old != '$')
5833 *new++ = *old++; 5833 *new++ = *old++;
@@ -5870,7 +5870,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
5870 /* No need to protect ACTION--we only compare it with t and nil. */ 5870 /* No need to protect ACTION--we only compare it with t and nil. */
5871 GCPRO5 (string, realdir, name, specdir, orig_string); 5871 GCPRO5 (string, realdir, name, specdir, orig_string);
5872 5872
5873 if (XSTRING (string)->size == 0) 5873 if (SCHARS (string) == 0)
5874 { 5874 {
5875 if (EQ (action, Qlambda)) 5875 if (EQ (action, Qlambda))
5876 { 5876 {
@@ -5931,8 +5931,8 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
5931 Lisp_Object tem = XCAR (all); 5931 Lisp_Object tem = XCAR (all);
5932 int len; 5932 int len;
5933 if (STRINGP (tem) && 5933 if (STRINGP (tem) &&
5934 (len = XSTRING (tem)->size, len > 0) && 5934 (len = SCHARS (tem), len > 0) &&
5935 IS_DIRECTORY_SEP (XSTRING (tem)->data[len-1])) 5935 IS_DIRECTORY_SEP (SREF (tem, len-1)))
5936 comp = Fcons (tem, comp); 5936 comp = Fcons (tem, comp);
5937 } 5937 }
5938 } 5938 }
@@ -5957,7 +5957,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
5957#ifdef VMS 5957#ifdef VMS
5958 /* Supposedly this helps commands such as `cd' that read directory names, 5958 /* Supposedly this helps commands such as `cd' that read directory names,
5959 but can someone explain how it helps them? -- RMS */ 5959 but can someone explain how it helps them? -- RMS */
5960 if (XSTRING (name)->size == 0) 5960 if (SCHARS (name) == 0)
5961 return Qt; 5961 return Qt;
5962#endif /* VMS */ 5962#endif /* VMS */
5963 if (!NILP (Vread_file_name_predicate)) 5963 if (!NILP (Vread_file_name_predicate))
@@ -6014,23 +6014,23 @@ provides a file dialog box. */)
6014#endif 6014#endif
6015 if (homedir != 0 6015 if (homedir != 0
6016 && STRINGP (dir) 6016 && STRINGP (dir)
6017 && !strncmp (homedir, XSTRING (dir)->data, strlen (homedir)) 6017 && !strncmp (homedir, SDATA (dir), strlen (homedir))
6018 && IS_DIRECTORY_SEP (XSTRING (dir)->data[strlen (homedir)])) 6018 && IS_DIRECTORY_SEP (SDATA (dir)[strlen (homedir)]))
6019 { 6019 {
6020 dir = make_string (XSTRING (dir)->data + strlen (homedir) - 1, 6020 dir = make_string (SDATA (dir) + strlen (homedir) - 1,
6021 STRING_BYTES (XSTRING (dir)) - strlen (homedir) + 1); 6021 SBYTES (dir) - strlen (homedir) + 1);
6022 XSTRING (dir)->data[0] = '~'; 6022 SREF (dir, 0) = '~';
6023 } 6023 }
6024 /* Likewise for default_filename. */ 6024 /* Likewise for default_filename. */
6025 if (homedir != 0 6025 if (homedir != 0
6026 && STRINGP (default_filename) 6026 && STRINGP (default_filename)
6027 && !strncmp (homedir, XSTRING (default_filename)->data, strlen (homedir)) 6027 && !strncmp (homedir, SDATA (default_filename), strlen (homedir))
6028 && IS_DIRECTORY_SEP (XSTRING (default_filename)->data[strlen (homedir)])) 6028 && IS_DIRECTORY_SEP (SDATA (default_filename)[strlen (homedir)]))
6029 { 6029 {
6030 default_filename 6030 default_filename
6031 = make_string (XSTRING (default_filename)->data + strlen (homedir) - 1, 6031 = make_string (SDATA (default_filename) + strlen (homedir) - 1,
6032 STRING_BYTES (XSTRING (default_filename)) - strlen (homedir) + 1); 6032 SBYTES (default_filename) - strlen (homedir) + 1);
6033 XSTRING (default_filename)->data[0] = '~'; 6033 SREF (default_filename, 0) = '~';
6034 } 6034 }
6035 if (!NILP (default_filename)) 6035 if (!NILP (default_filename))
6036 { 6036 {
@@ -6048,7 +6048,7 @@ provides a file dialog box. */)
6048 args[0] = insdef; 6048 args[0] = insdef;
6049 args[1] = initial; 6049 args[1] = initial;
6050 insdef = Fconcat (2, args); 6050 insdef = Fconcat (2, args);
6051 pos = make_number (XSTRING (double_dollars (dir))->size); 6051 pos = make_number (SCHARS (double_dollars (dir)));
6052 insdef = Fcons (double_dollars (insdef), pos); 6052 insdef = Fcons (double_dollars (insdef), pos);
6053 } 6053 }
6054 else 6054 else
@@ -6093,7 +6093,7 @@ provides a file dialog box. */)
6093 /* If DIR contains a file name, split it. */ 6093 /* If DIR contains a file name, split it. */
6094 Lisp_Object file; 6094 Lisp_Object file;
6095 file = Ffile_name_nondirectory (dir); 6095 file = Ffile_name_nondirectory (dir);
6096 if (XSTRING (file)->size && NILP (default_filename)) 6096 if (SCHARS (file) && NILP (default_filename))
6097 { 6097 {
6098 default_filename = file; 6098 default_filename = file;
6099 dir = Ffile_name_directory (dir); 6099 dir = Ffile_name_directory (dir);
@@ -6137,7 +6137,7 @@ provides a file dialog box. */)
6137 6137
6138 if (!NILP (tem) && !NILP (default_filename)) 6138 if (!NILP (tem) && !NILP (default_filename))
6139 val = default_filename; 6139 val = default_filename;
6140 else if (XSTRING (val)->size == 0 && NILP (insdef)) 6140 else if (SCHARS (val) == 0 && NILP (insdef))
6141 { 6141 {
6142 if (!NILP (default_filename)) 6142 if (!NILP (default_filename))
6143 val = default_filename; 6143 val = default_filename;