diff options
| author | Joakim Verona | 2012-08-19 02:44:11 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-08-19 02:44:11 +0200 |
| commit | 5436d1df5e2ba0b4d4f72b03a1cd09b20403654b (patch) | |
| tree | 532faa27319b3bb199d414dc85e63a58246d30b0 /src/fileio.c | |
| parent | d02344322b0d2fea8dd9ad9dd0a6c70e058f967b (diff) | |
| parent | e757f1c6f393cf82057dbee0a4325b07f0fd55c4 (diff) | |
| download | emacs-5436d1df5e2ba0b4d4f72b03a1cd09b20403654b.tar.gz emacs-5436d1df5e2ba0b4d4f72b03a1cd09b20403654b.zip | |
upstream
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/fileio.c b/src/fileio.c index eba157ea042..2f4a2ad2314 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | #include <pwd.h> | 30 | #include <pwd.h> |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #include <ctype.h> | ||
| 34 | #include <errno.h> | 33 | #include <errno.h> |
| 35 | 34 | ||
| 36 | #ifdef HAVE_LIBSELINUX | 35 | #ifdef HAVE_LIBSELINUX |
| @@ -38,6 +37,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 38 | #include <selinux/context.h> | 37 | #include <selinux/context.h> |
| 39 | #endif | 38 | #endif |
| 40 | 39 | ||
| 40 | #include <c-ctype.h> | ||
| 41 | |||
| 41 | #include "lisp.h" | 42 | #include "lisp.h" |
| 42 | #include "intervals.h" | 43 | #include "intervals.h" |
| 43 | #include "character.h" | 44 | #include "character.h" |
| @@ -67,12 +68,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 67 | #define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z') | 68 | #define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z') |
| 68 | #endif | 69 | #endif |
| 69 | #ifdef WINDOWSNT | 70 | #ifdef WINDOWSNT |
| 70 | #define IS_DRIVE(x) isalpha ((unsigned char) (x)) | 71 | #define IS_DRIVE(x) c_isalpha (x) |
| 71 | #endif | 72 | #endif |
| 72 | /* Need to lower-case the drive letter, or else expanded | 73 | /* Need to lower-case the drive letter, or else expanded |
| 73 | filenames will sometimes compare unequal, because | 74 | filenames will sometimes compare unequal, because |
| 74 | `expand-file-name' doesn't always down-case the drive letter. */ | 75 | `expand-file-name' doesn't always down-case the drive letter. */ |
| 75 | #define DRIVE_LETTER(x) (tolower ((unsigned char) (x))) | 76 | #define DRIVE_LETTER(x) c_tolower (x) |
| 76 | #endif | 77 | #endif |
| 77 | 78 | ||
| 78 | #include "systime.h" | 79 | #include "systime.h" |
| @@ -364,7 +365,7 @@ Given a Unix syntax file name, returns a string ending in slash. */) | |||
| 364 | r += 2; | 365 | r += 2; |
| 365 | } | 366 | } |
| 366 | 367 | ||
| 367 | if (getdefdir (toupper ((unsigned char) *beg) - 'A' + 1, r)) | 368 | if (getdefdir (c_toupper (*beg) - 'A' + 1, r)) |
| 368 | { | 369 | { |
| 369 | if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) | 370 | if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) |
| 370 | strcat (res, "/"); | 371 | strcat (res, "/"); |
| @@ -1053,7 +1054,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1053 | if (!IS_DIRECTORY_SEP (nm[0])) | 1054 | if (!IS_DIRECTORY_SEP (nm[0])) |
| 1054 | { | 1055 | { |
| 1055 | adir = alloca (MAXPATHLEN + 1); | 1056 | adir = alloca (MAXPATHLEN + 1); |
| 1056 | if (!getdefdir (toupper (drive) - 'A' + 1, adir)) | 1057 | if (!getdefdir (c_toupper (drive) - 'A' + 1, adir)) |
| 1057 | adir = NULL; | 1058 | adir = NULL; |
| 1058 | } | 1059 | } |
| 1059 | if (!adir) | 1060 | if (!adir) |
| @@ -1129,7 +1130,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1129 | adir = alloca (MAXPATHLEN + 1); | 1130 | adir = alloca (MAXPATHLEN + 1); |
| 1130 | if (drive) | 1131 | if (drive) |
| 1131 | { | 1132 | { |
| 1132 | if (!getdefdir (toupper (drive) - 'A' + 1, adir)) | 1133 | if (!getdefdir (c_toupper (drive) - 'A' + 1, adir)) |
| 1133 | newdir = "/"; | 1134 | newdir = "/"; |
| 1134 | } | 1135 | } |
| 1135 | else | 1136 | else |
| @@ -1635,7 +1636,7 @@ those `/' is discarded. */) | |||
| 1635 | else | 1636 | else |
| 1636 | { | 1637 | { |
| 1637 | o = p; | 1638 | o = p; |
| 1638 | while (p != endp && (isalnum (*p) || *p == '_')) p++; | 1639 | while (p != endp && (c_isalnum (*p) || *p == '_')) p++; |
| 1639 | s = p; | 1640 | s = p; |
| 1640 | } | 1641 | } |
| 1641 | 1642 | ||
| @@ -1698,7 +1699,7 @@ those `/' is discarded. */) | |||
| 1698 | else | 1699 | else |
| 1699 | { | 1700 | { |
| 1700 | o = p; | 1701 | o = p; |
| 1701 | while (p != endp && (isalnum (*p) || *p == '_')) p++; | 1702 | while (p != endp && (c_isalnum (*p) || *p == '_')) p++; |
| 1702 | s = p; | 1703 | s = p; |
| 1703 | } | 1704 | } |
| 1704 | 1705 | ||
| @@ -3145,12 +3146,12 @@ decide_coding_unwind (Lisp_Object unwind_data) | |||
| 3145 | set_buffer_internal (XBUFFER (buffer)); | 3146 | set_buffer_internal (XBUFFER (buffer)); |
| 3146 | adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); | 3147 | adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); |
| 3147 | adjust_overlays_for_delete (BEG, Z - BEG); | 3148 | adjust_overlays_for_delete (BEG, Z - BEG); |
| 3148 | buffer_set_intervals (current_buffer, NULL); | 3149 | set_buffer_intervals (current_buffer, NULL); |
| 3149 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); | 3150 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); |
| 3150 | 3151 | ||
| 3151 | /* Now we are safe to change the buffer's multibyteness directly. */ | 3152 | /* Now we are safe to change the buffer's multibyteness directly. */ |
| 3152 | BSET (current_buffer, enable_multibyte_characters, multibyte); | 3153 | bset_enable_multibyte_characters (current_buffer, multibyte); |
| 3153 | BSET (current_buffer, undo_list, undo_list); | 3154 | bset_undo_list (current_buffer, undo_list); |
| 3154 | 3155 | ||
| 3155 | return Qnil; | 3156 | return Qnil; |
| 3156 | } | 3157 | } |
| @@ -3486,16 +3487,16 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3486 | buf = XBUFFER (workbuf); | 3487 | buf = XBUFFER (workbuf); |
| 3487 | 3488 | ||
| 3488 | delete_all_overlays (buf); | 3489 | delete_all_overlays (buf); |
| 3489 | BSET (buf, directory, BVAR (current_buffer, directory)); | 3490 | bset_directory (buf, BVAR (current_buffer, directory)); |
| 3490 | BSET (buf, read_only, Qnil); | 3491 | bset_read_only (buf, Qnil); |
| 3491 | BSET (buf, filename, Qnil); | 3492 | bset_filename (buf, Qnil); |
| 3492 | BSET (buf, undo_list, Qt); | 3493 | bset_undo_list (buf, Qt); |
| 3493 | eassert (buf->overlays_before == NULL); | 3494 | eassert (buf->overlays_before == NULL); |
| 3494 | eassert (buf->overlays_after == NULL); | 3495 | eassert (buf->overlays_after == NULL); |
| 3495 | 3496 | ||
| 3496 | set_buffer_internal (buf); | 3497 | set_buffer_internal (buf); |
| 3497 | Ferase_buffer (); | 3498 | Ferase_buffer (); |
| 3498 | BSET (buf, enable_multibyte_characters, Qnil); | 3499 | bset_enable_multibyte_characters (buf, Qnil); |
| 3499 | 3500 | ||
| 3500 | insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); | 3501 | insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); |
| 3501 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); | 3502 | TEMP_SET_PT_BOTH (BEG, BEG_BYTE); |
| @@ -4104,8 +4105,8 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4104 | unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), | 4105 | unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), |
| 4105 | Fcons (BVAR (current_buffer, undo_list), | 4106 | Fcons (BVAR (current_buffer, undo_list), |
| 4106 | Fcurrent_buffer ())); | 4107 | Fcurrent_buffer ())); |
| 4107 | BSET (current_buffer, enable_multibyte_characters, Qnil); | 4108 | bset_enable_multibyte_characters (current_buffer, Qnil); |
| 4108 | BSET (current_buffer, undo_list, Qt); | 4109 | bset_undo_list (current_buffer, Qt); |
| 4109 | record_unwind_protect (decide_coding_unwind, unwind_data); | 4110 | record_unwind_protect (decide_coding_unwind, unwind_data); |
| 4110 | 4111 | ||
| 4111 | if (inserted > 0 && ! NILP (Vset_auto_coding_function)) | 4112 | if (inserted > 0 && ! NILP (Vset_auto_coding_function)) |
| @@ -4153,7 +4154,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4153 | && NILP (replace)) | 4154 | && NILP (replace)) |
| 4154 | /* Visiting a file with these coding system makes the buffer | 4155 | /* Visiting a file with these coding system makes the buffer |
| 4155 | unibyte. */ | 4156 | unibyte. */ |
| 4156 | BSET (current_buffer, enable_multibyte_characters, Qnil); | 4157 | bset_enable_multibyte_characters (current_buffer, Qnil); |
| 4157 | } | 4158 | } |
| 4158 | 4159 | ||
| 4159 | coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 4160 | coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| @@ -4196,13 +4197,13 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4196 | if (!NILP (visit)) | 4197 | if (!NILP (visit)) |
| 4197 | { | 4198 | { |
| 4198 | if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) | 4199 | if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) |
| 4199 | BSET (current_buffer, undo_list, Qnil); | 4200 | bset_undo_list (current_buffer, Qnil); |
| 4200 | 4201 | ||
| 4201 | if (NILP (handler)) | 4202 | if (NILP (handler)) |
| 4202 | { | 4203 | { |
| 4203 | current_buffer->modtime = mtime; | 4204 | current_buffer->modtime = mtime; |
| 4204 | current_buffer->modtime_size = st.st_size; | 4205 | current_buffer->modtime_size = st.st_size; |
| 4205 | BSET (current_buffer, filename, orig_filename); | 4206 | bset_filename (current_buffer, orig_filename); |
| 4206 | } | 4207 | } |
| 4207 | 4208 | ||
| 4208 | SAVE_MODIFF = MODIFF; | 4209 | SAVE_MODIFF = MODIFF; |
| @@ -4247,7 +4248,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4247 | 4248 | ||
| 4248 | /* Save old undo list and don't record undo for decoding. */ | 4249 | /* Save old undo list and don't record undo for decoding. */ |
| 4249 | old_undo = BVAR (current_buffer, undo_list); | 4250 | old_undo = BVAR (current_buffer, undo_list); |
| 4250 | BSET (current_buffer, undo_list, Qt); | 4251 | bset_undo_list (current_buffer, Qt); |
| 4251 | 4252 | ||
| 4252 | if (NILP (replace)) | 4253 | if (NILP (replace)) |
| 4253 | { | 4254 | { |
| @@ -4339,7 +4340,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4339 | 4340 | ||
| 4340 | if (NILP (visit)) | 4341 | if (NILP (visit)) |
| 4341 | { | 4342 | { |
| 4342 | BSET (current_buffer, undo_list, old_undo); | 4343 | bset_undo_list (current_buffer, old_undo); |
| 4343 | if (CONSP (old_undo) && inserted != old_inserted) | 4344 | if (CONSP (old_undo) && inserted != old_inserted) |
| 4344 | { | 4345 | { |
| 4345 | /* Adjust the last undo record for the size change during | 4346 | /* Adjust the last undo record for the size change during |
| @@ -4354,7 +4355,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4354 | else | 4355 | else |
| 4355 | /* If undo_list was Qt before, keep it that way. | 4356 | /* If undo_list was Qt before, keep it that way. |
| 4356 | Otherwise start with an empty undo_list. */ | 4357 | Otherwise start with an empty undo_list. */ |
| 4357 | BSET (current_buffer, undo_list, EQ (old_undo, Qt) ? Qt : Qnil); | 4358 | bset_undo_list (current_buffer, EQ (old_undo, Qt) ? Qt : Qnil); |
| 4358 | 4359 | ||
| 4359 | unbind_to (count1, Qnil); | 4360 | unbind_to (count1, Qnil); |
| 4360 | } | 4361 | } |
| @@ -4594,7 +4595,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4594 | { | 4595 | { |
| 4595 | SAVE_MODIFF = MODIFF; | 4596 | SAVE_MODIFF = MODIFF; |
| 4596 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); | 4597 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); |
| 4597 | BSET (current_buffer, filename, visit_file); | 4598 | bset_filename (current_buffer, visit_file); |
| 4598 | } | 4599 | } |
| 4599 | UNGCPRO; | 4600 | UNGCPRO; |
| 4600 | return val; | 4601 | return val; |
| @@ -4810,7 +4811,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4810 | { | 4811 | { |
| 4811 | SAVE_MODIFF = MODIFF; | 4812 | SAVE_MODIFF = MODIFF; |
| 4812 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); | 4813 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); |
| 4813 | BSET (current_buffer, filename, visit_file); | 4814 | bset_filename (current_buffer, visit_file); |
| 4814 | update_mode_lines++; | 4815 | update_mode_lines++; |
| 4815 | } | 4816 | } |
| 4816 | else if (quietly) | 4817 | else if (quietly) |