mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
* fileio.c, filelock.c, floatfns.c, fns.c: Use bool for boolean.
* fileio.c (auto_saving, auto_save_error_occurred, make_temp_name) (Fexpand_file_name, barf_or_query_if_file_exists, Fcopy_file) (file_name_absolute_p, Fsubstitute_in_file_name): (check_executable, check_writable, Ffile_accessible_directory_p) (Fset_file_selinux_context, Fdefault_file_modes) (Finsert_file_contents, choose_write_coding_system) (Fwrite_region, build_annotations, a_write, e_write) (Fdo_auto_save): * filelock.c (boot_time_initialized, get_boot_time) (get_boot_time_1, lock_file_1, within_one_second): * floatfns.c (in_float): * fns.c (concat, internal_equal, Frequire, base64_encode_1) (base64_decode_1, cmpfn_eql, cmpfn_user_defined) (sweep_weak_table, sweep_weak_hash_tables, secure_hash): * lisp.h (struct Lisp_Hash_Table.cmpfn): * window.c (compare_window_configurations): Use bool for booleans. * fileio.c (auto_saving_dir_umask, auto_saving_mode_bits) (Fdefault_file_modes): Now mode_t, not int, for modes. (Fdo_auto_save): Set a boolean to 1 rather than using ++. (internal_delete_file): Now returns void, not a (boolean) int, since nobody was looking at the return value. * lisp.h, window.h: Adjust to above API changes.
This commit is contained in:
parent
7e570fbf3e
commit
f75d7a913d
8 changed files with 178 additions and 164 deletions
|
|
@ -1,5 +1,30 @@
|
|||
2012-09-05 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* fileio.c, filelock.c, floatfns.c, fns.c: Use bool for boolean.
|
||||
* fileio.c (auto_saving, auto_save_error_occurred, make_temp_name)
|
||||
(Fexpand_file_name, barf_or_query_if_file_exists, Fcopy_file)
|
||||
(file_name_absolute_p, Fsubstitute_in_file_name):
|
||||
(check_executable, check_writable, Ffile_accessible_directory_p)
|
||||
(Fset_file_selinux_context, Fdefault_file_modes)
|
||||
(Finsert_file_contents, choose_write_coding_system)
|
||||
(Fwrite_region, build_annotations, a_write, e_write)
|
||||
(Fdo_auto_save):
|
||||
* filelock.c (boot_time_initialized, get_boot_time)
|
||||
(get_boot_time_1, lock_file_1, within_one_second):
|
||||
* floatfns.c (in_float):
|
||||
* fns.c (concat, internal_equal, Frequire, base64_encode_1)
|
||||
(base64_decode_1, cmpfn_eql, cmpfn_user_defined)
|
||||
(sweep_weak_table, sweep_weak_hash_tables, secure_hash):
|
||||
* lisp.h (struct Lisp_Hash_Table.cmpfn):
|
||||
* window.c (compare_window_configurations):
|
||||
Use bool for booleans.
|
||||
* fileio.c (auto_saving_dir_umask, auto_saving_mode_bits)
|
||||
(Fdefault_file_modes): Now mode_t, not int, for modes.
|
||||
(Fdo_auto_save): Set a boolean to 1 rather than using ++.
|
||||
(internal_delete_file): Now returns void, not a (boolean) int,
|
||||
since nobody was looking at the return value.
|
||||
* lisp.h, window.h: Adjust to above API changes.
|
||||
|
||||
* xdisp.c (set_message): Simplify and reindent last change.
|
||||
|
||||
2012-09-05 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
|
|
|||
199
src/fileio.c
199
src/fileio.c
|
|
@ -85,18 +85,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
|
||||
#include "commands.h"
|
||||
|
||||
/* Nonzero during writing of auto-save files. */
|
||||
static int auto_saving;
|
||||
/* True during writing of auto-save files. */
|
||||
static bool auto_saving;
|
||||
|
||||
/* Nonzero umask during creation of auto-save directories. */
|
||||
static int auto_saving_dir_umask;
|
||||
static mode_t auto_saving_dir_umask;
|
||||
|
||||
/* Set by auto_save_1 to mode of original file so Fwrite_region will create
|
||||
a new file with the same mode as the original. */
|
||||
static int auto_save_mode_bits;
|
||||
static mode_t auto_save_mode_bits;
|
||||
|
||||
/* Set by auto_save_1 if an error occurred during the last auto-save. */
|
||||
static int auto_save_error_occurred;
|
||||
static bool auto_save_error_occurred;
|
||||
|
||||
/* The symbol bound to coding-system-for-read when
|
||||
insert-file-contents is called for recovering a file. This is not
|
||||
|
|
@ -145,10 +145,10 @@ Lisp_Object Qfile_name_history;
|
|||
|
||||
static Lisp_Object Qcar_less_than_car;
|
||||
|
||||
static int a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
|
||||
Lisp_Object *, struct coding_system *);
|
||||
static int e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
|
||||
struct coding_system *);
|
||||
static bool a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
|
||||
Lisp_Object *, struct coding_system *);
|
||||
static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
|
||||
struct coding_system *);
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -595,7 +595,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p;
|
|||
which has no existing file. To make this work, PREFIX should be
|
||||
an absolute file name.
|
||||
|
||||
BASE64_P non-zero means add the pid as 3 characters in base64
|
||||
BASE64_P means add the pid as 3 characters in base64
|
||||
encoding. In this case, 6 characters will be added to PREFIX to
|
||||
form the file name. Otherwise, if Emacs is running on a system
|
||||
with long file names, add the pid as a decimal number.
|
||||
|
|
@ -604,7 +604,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p;
|
|||
generated. */
|
||||
|
||||
Lisp_Object
|
||||
make_temp_name (Lisp_Object prefix, int base64_p)
|
||||
make_temp_name (Lisp_Object prefix, bool base64_p)
|
||||
{
|
||||
Lisp_Object val;
|
||||
int len, clen;
|
||||
|
|
@ -761,8 +761,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
|
|||
struct passwd *pw;
|
||||
#ifdef DOS_NT
|
||||
int drive = 0;
|
||||
int collapse_newdir = 1;
|
||||
int is_escaped = 0;
|
||||
bool collapse_newdir = 1;
|
||||
bool is_escaped = 0;
|
||||
#endif /* DOS_NT */
|
||||
ptrdiff_t length;
|
||||
Lisp_Object handler, result, handled_name;
|
||||
|
|
@ -920,10 +920,9 @@ filesystem tree, not (expand-file-name ".." dirname). */)
|
|||
/* If it turns out that the filename we want to return is just a
|
||||
suffix of FILENAME, we don't need to go through and edit
|
||||
things; we just need to construct a new string using data
|
||||
starting at the middle of FILENAME. If we set lose to a
|
||||
non-zero value, that means we've discovered that we can't do
|
||||
that cool trick. */
|
||||
int lose = 0;
|
||||
starting at the middle of FILENAME. If we set LOSE, that
|
||||
means we've discovered that we can't do that cool trick. */
|
||||
bool lose = 0;
|
||||
char *p = nm;
|
||||
|
||||
while (*p)
|
||||
|
|
@ -1360,7 +1359,6 @@ See also the function `substitute-in-file-name'.")
|
|||
ptrdiff_t tlen;
|
||||
unsigned char *target;
|
||||
struct passwd *pw;
|
||||
int lose;
|
||||
|
||||
CHECK_STRING (name);
|
||||
nm = SDATA (name);
|
||||
|
|
@ -1369,8 +1367,8 @@ See also the function `substitute-in-file-name'.")
|
|||
If no /./ or /../ we can return right away. */
|
||||
if (nm[0] == '/')
|
||||
{
|
||||
bool lose = 0;
|
||||
p = nm;
|
||||
lose = 0;
|
||||
while (*p)
|
||||
{
|
||||
if (p[0] == '/' && p[1] == '/'
|
||||
|
|
@ -1494,7 +1492,7 @@ See also the function `substitute-in-file-name'.")
|
|||
#endif
|
||||
|
||||
/* If /~ or // appears, discard everything through first slash. */
|
||||
static int
|
||||
static bool
|
||||
file_name_absolute_p (const char *filename)
|
||||
{
|
||||
return
|
||||
|
|
@ -1560,12 +1558,10 @@ If `//' appears, everything up to and including the first of
|
|||
those `/' is discarded. */)
|
||||
(Lisp_Object filename)
|
||||
{
|
||||
char *nm;
|
||||
|
||||
register char *s, *p, *o, *x, *endp;
|
||||
char *nm, *s, *p, *o, *x, *endp;
|
||||
char *target = NULL;
|
||||
int total = 0;
|
||||
int substituted = 0;
|
||||
bool substituted = 0;
|
||||
bool multibyte;
|
||||
char *xnm;
|
||||
Lisp_Object handler;
|
||||
|
|
@ -1780,7 +1776,7 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
|
|||
}
|
||||
|
||||
/* Signal an error if the file ABSNAME already exists.
|
||||
If INTERACTIVE is nonzero, ask the user whether to proceed,
|
||||
If INTERACTIVE, ask the user whether to proceed,
|
||||
and bypass the error if the user says to go ahead.
|
||||
QUERYSTRING is a name for the action that is being considered
|
||||
to alter the file.
|
||||
|
|
@ -1789,13 +1785,14 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
|
|||
If the file does not exist, STATPTR->st_mode is set to 0.
|
||||
If STATPTR is null, we don't store into it.
|
||||
|
||||
If QUICK is nonzero, we ask for y or n, not yes or no. */
|
||||
If QUICK, ask for y or n, not yes or no. */
|
||||
|
||||
static void
|
||||
barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring,
|
||||
int interactive, struct stat *statptr, int quick)
|
||||
bool interactive, struct stat *statptr,
|
||||
bool quick)
|
||||
{
|
||||
register Lisp_Object tem, encoded_filename;
|
||||
Lisp_Object tem, encoded_filename;
|
||||
struct stat statbuf;
|
||||
struct gcpro gcpro1;
|
||||
|
||||
|
|
@ -1869,11 +1866,11 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
|
|||
Lisp_Object handler;
|
||||
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
int input_file_statable_p;
|
||||
bool input_file_statable_p;
|
||||
Lisp_Object encoded_file, encoded_newname;
|
||||
#if HAVE_LIBSELINUX
|
||||
security_context_t con;
|
||||
int fail, conlength = 0;
|
||||
int conlength = 0;
|
||||
#endif
|
||||
|
||||
encoded_file = encoded_newname = Qnil;
|
||||
|
|
@ -1988,7 +1985,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
|
|||
S_IREAD | S_IWRITE);
|
||||
#else /* not MSDOS */
|
||||
{
|
||||
int new_mask = 0666;
|
||||
mode_t new_mask = 0666;
|
||||
if (input_file_statable_p)
|
||||
{
|
||||
if (!NILP (preserve_uid_gid))
|
||||
|
|
@ -2018,7 +2015,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
|
|||
owner and group. */
|
||||
if (input_file_statable_p)
|
||||
{
|
||||
int mode_mask = 07777;
|
||||
mode_t mode_mask = 07777;
|
||||
if (!NILP (preserve_uid_gid))
|
||||
{
|
||||
/* Attempt to change owner and group. If that doesn't work
|
||||
|
|
@ -2041,7 +2038,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
|
|||
if (conlength > 0)
|
||||
{
|
||||
/* Set the modified context back to the file. */
|
||||
fail = fsetfilecon (ofd, con);
|
||||
bool fail = fsetfilecon (ofd, con) != 0;
|
||||
/* See http://debbugs.gnu.org/11245 for ENOTSUP. */
|
||||
if (fail && errno != ENOTSUP)
|
||||
report_file_error ("Doing fsetfilecon", Fcons (newname, Qnil));
|
||||
|
|
@ -2184,17 +2181,14 @@ internal_delete_file_1 (Lisp_Object ignore)
|
|||
return Qt;
|
||||
}
|
||||
|
||||
/* Delete file FILENAME, returning 1 if successful and 0 if failed.
|
||||
/* Delete file FILENAME.
|
||||
This ignores `delete-by-moving-to-trash'. */
|
||||
|
||||
int
|
||||
void
|
||||
internal_delete_file (Lisp_Object filename)
|
||||
{
|
||||
Lisp_Object tem;
|
||||
|
||||
tem = internal_condition_case_2 (Fdelete_file, filename, Qnil,
|
||||
Qt, internal_delete_file_1);
|
||||
return NILP (tem);
|
||||
internal_condition_case_2 (Fdelete_file, filename, Qnil,
|
||||
Qt, internal_delete_file_1);
|
||||
}
|
||||
|
||||
DEFUN ("rename-file", Frename_file, Srename_file, 2, 3,
|
||||
|
|
@ -2430,9 +2424,9 @@ On Unix, this is a name starting with a `/' or a `~'. */)
|
|||
return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil;
|
||||
}
|
||||
|
||||
/* Return nonzero if file FILENAME exists and can be executed. */
|
||||
/* Return true if file FILENAME exists and can be executed. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
check_executable (char *filename)
|
||||
{
|
||||
#ifdef DOS_NT
|
||||
|
|
@ -2452,9 +2446,9 @@ check_executable (char *filename)
|
|||
#endif /* not DOS_NT */
|
||||
}
|
||||
|
||||
/* Return nonzero if file FILENAME exists and can be written. */
|
||||
/* Return true if file FILENAME exists and can be written. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
check_writable (const char *filename)
|
||||
{
|
||||
#ifdef MSDOS
|
||||
|
|
@ -2464,7 +2458,7 @@ check_writable (const char *filename)
|
|||
return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode));
|
||||
#else /* not MSDOS */
|
||||
#ifdef HAVE_EUIDACCESS
|
||||
int res = (euidaccess (filename, 2) >= 0);
|
||||
bool res = (euidaccess (filename, 2) >= 0);
|
||||
#ifdef CYGWIN
|
||||
/* euidaccess may have returned failure because Cygwin couldn't
|
||||
determine the file's UID or GID; if so, we return success. */
|
||||
|
|
@ -2732,7 +2726,7 @@ searchable directory. */)
|
|||
(Lisp_Object filename)
|
||||
{
|
||||
Lisp_Object handler;
|
||||
int tem;
|
||||
bool tem;
|
||||
struct gcpro gcpro1;
|
||||
|
||||
/* If the file name has special constructs in it,
|
||||
|
|
@ -2868,7 +2862,8 @@ compiled with SELinux support. */)
|
|||
Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context)));
|
||||
Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context))));
|
||||
security_context_t con;
|
||||
int fail, conlength;
|
||||
bool fail;
|
||||
int conlength;
|
||||
context_t parsed_con;
|
||||
#endif
|
||||
|
||||
|
|
@ -2912,8 +2907,9 @@ compiled with SELinux support. */)
|
|||
}
|
||||
|
||||
/* Set the modified context back to the file. */
|
||||
fail = lsetfilecon (SSDATA (encoded_absname),
|
||||
context_str (parsed_con));
|
||||
fail = (lsetfilecon (SSDATA (encoded_absname),
|
||||
context_str (parsed_con))
|
||||
!= 0);
|
||||
/* See http://debbugs.gnu.org/11245 for ENOTSUP. */
|
||||
if (fail && errno != ENOTSUP)
|
||||
report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil));
|
||||
|
|
@ -3004,7 +3000,7 @@ DEFUN ("default-file-modes", Fdefault_file_modes, Sdefault_file_modes, 0, 0, 0,
|
|||
The value is an integer. */)
|
||||
(void)
|
||||
{
|
||||
int realmask;
|
||||
mode_t realmask;
|
||||
Lisp_Object value;
|
||||
|
||||
BLOCK_INPUT;
|
||||
|
|
@ -3246,29 +3242,29 @@ variable `last-coding-system-used' to the coding system actually used. */)
|
|||
struct stat st;
|
||||
int file_status;
|
||||
EMACS_TIME mtime;
|
||||
register int fd;
|
||||
int fd;
|
||||
ptrdiff_t inserted = 0;
|
||||
int nochange = 0;
|
||||
register ptrdiff_t how_much;
|
||||
bool nochange = 0;
|
||||
ptrdiff_t how_much;
|
||||
off_t beg_offset, end_offset;
|
||||
register int unprocessed;
|
||||
int unprocessed;
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
|
||||
Lisp_Object handler, val, insval, orig_filename, old_undo;
|
||||
Lisp_Object p;
|
||||
ptrdiff_t total = 0;
|
||||
int not_regular = 0;
|
||||
bool not_regular = 0;
|
||||
int save_errno = 0;
|
||||
char read_buf[READ_BUF_SIZE];
|
||||
struct coding_system coding;
|
||||
char buffer[1 << 14];
|
||||
int replace_handled = 0;
|
||||
int set_coding_system = 0;
|
||||
bool replace_handled = 0;
|
||||
bool set_coding_system = 0;
|
||||
Lisp_Object coding_system;
|
||||
int read_quit = 0;
|
||||
bool read_quit = 0;
|
||||
Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark;
|
||||
int we_locked_file = 0;
|
||||
int deferred_remove_unwind_protect = 0;
|
||||
bool we_locked_file = 0;
|
||||
bool deferred_remove_unwind_protect = 0;
|
||||
|
||||
if (current_buffer->base_buffer && ! NILP (visit))
|
||||
error ("Cannot do file visiting in an indirect buffer");
|
||||
|
|
@ -3569,9 +3565,9 @@ variable `last-coding-system-used' to the coding system actually used. */)
|
|||
ptrdiff_t same_at_end = ZV_BYTE;
|
||||
ptrdiff_t overlap;
|
||||
/* There is still a possibility we will find the need to do code
|
||||
conversion. If that happens, we set this variable to 1 to
|
||||
conversion. If that happens, set this variable to
|
||||
give up on handling REPLACE in the optimized way. */
|
||||
int giveup_match_end = 0;
|
||||
bool giveup_match_end = 0;
|
||||
|
||||
if (beg_offset != 0)
|
||||
{
|
||||
|
|
@ -4427,8 +4423,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file
|
|||
If it is not set locally, we anyway have to convert EOL
|
||||
format if the default value of `buffer-file-coding-system'
|
||||
tells that it is not Unix-like (LF only) format. */
|
||||
int using_default_coding = 0;
|
||||
int force_raw_text = 0;
|
||||
bool using_default_coding = 0;
|
||||
bool force_raw_text = 0;
|
||||
|
||||
val = BVAR (current_buffer, buffer_file_coding_system);
|
||||
if (NILP (val)
|
||||
|
|
@ -4537,8 +4533,8 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
`write-region-post-annotation-function' at the end. */)
|
||||
(Lisp_Object start, Lisp_Object end, Lisp_Object filename, Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, Lisp_Object mustbenew)
|
||||
{
|
||||
register int desc;
|
||||
int failure;
|
||||
int desc;
|
||||
bool ok;
|
||||
int save_errno = 0;
|
||||
const char *fn;
|
||||
struct stat st;
|
||||
|
|
@ -4548,8 +4544,8 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
Lisp_Object visit_file;
|
||||
Lisp_Object annotations;
|
||||
Lisp_Object encoded_filename;
|
||||
int visiting = (EQ (visit, Qt) || STRINGP (visit));
|
||||
int quietly = !NILP (visit);
|
||||
bool visiting = (EQ (visit, Qt) || STRINGP (visit));
|
||||
bool quietly = !NILP (visit);
|
||||
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
|
||||
struct buffer *given_buffer;
|
||||
struct coding_system coding;
|
||||
|
|
@ -4713,37 +4709,27 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
|
||||
UNGCPRO;
|
||||
|
||||
failure = 0;
|
||||
immediate_quit = 1;
|
||||
|
||||
if (STRINGP (start))
|
||||
{
|
||||
failure = 0 > a_write (desc, start, 0, SCHARS (start),
|
||||
&annotations, &coding);
|
||||
save_errno = errno;
|
||||
}
|
||||
ok = a_write (desc, start, 0, SCHARS (start), &annotations, &coding);
|
||||
else if (XINT (start) != XINT (end))
|
||||
{
|
||||
failure = 0 > a_write (desc, Qnil,
|
||||
XINT (start), XINT (end) - XINT (start),
|
||||
&annotations, &coding);
|
||||
save_errno = errno;
|
||||
}
|
||||
ok = a_write (desc, Qnil, XINT (start), XINT (end) - XINT (start),
|
||||
&annotations, &coding);
|
||||
else
|
||||
{
|
||||
/* If file was empty, still need to write the annotations */
|
||||
/* If file was empty, still need to write the annotations. */
|
||||
coding.mode |= CODING_MODE_LAST_BLOCK;
|
||||
failure = 0 > a_write (desc, Qnil, XINT (end), 0, &annotations, &coding);
|
||||
save_errno = errno;
|
||||
ok = a_write (desc, Qnil, XINT (end), 0, &annotations, &coding);
|
||||
}
|
||||
save_errno = errno;
|
||||
|
||||
if (CODING_REQUIRE_FLUSHING (&coding)
|
||||
&& !(coding.mode & CODING_MODE_LAST_BLOCK)
|
||||
&& ! failure)
|
||||
if (ok && CODING_REQUIRE_FLUSHING (&coding)
|
||||
&& !(coding.mode & CODING_MODE_LAST_BLOCK))
|
||||
{
|
||||
/* We have to flush out a data. */
|
||||
coding.mode |= CODING_MODE_LAST_BLOCK;
|
||||
failure = 0 > e_write (desc, Qnil, 1, 1, &coding);
|
||||
ok = e_write (desc, Qnil, 1, 1, &coding);
|
||||
save_errno = errno;
|
||||
}
|
||||
|
||||
|
|
@ -4760,13 +4746,13 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
ignore EINVAL which happens when fsync is not supported on this
|
||||
file. */
|
||||
if (errno != EINTR && errno != EINVAL)
|
||||
failure = 1, save_errno = errno;
|
||||
ok = 0, save_errno = errno;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* NFS can report a write failure now. */
|
||||
if (emacs_close (desc) < 0)
|
||||
failure = 1, save_errno = errno;
|
||||
ok = 0, save_errno = errno;
|
||||
|
||||
stat (fn, &st);
|
||||
|
||||
|
|
@ -4803,7 +4789,7 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
current_buffer->modtime_size = st.st_size;
|
||||
}
|
||||
|
||||
if (failure)
|
||||
if (! ok)
|
||||
error ("IO error writing %s: %s", SDATA (filename),
|
||||
emacs_strerror (save_errno));
|
||||
|
||||
|
|
@ -4859,7 +4845,8 @@ build_annotations (Lisp_Object start, Lisp_Object end)
|
|||
Lisp_Object p, res;
|
||||
struct gcpro gcpro1, gcpro2;
|
||||
Lisp_Object original_buffer;
|
||||
int i, used_global = 0;
|
||||
int i;
|
||||
bool used_global = 0;
|
||||
|
||||
XSETBUFFER (original_buffer, current_buffer);
|
||||
|
||||
|
|
@ -4939,11 +4926,11 @@ build_annotations (Lisp_Object start, Lisp_Object end)
|
|||
|
||||
We modify *ANNOT by discarding elements as we use them up.
|
||||
|
||||
The return value is negative in case of system call failure. */
|
||||
Return true if successful. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
a_write (int desc, Lisp_Object string, ptrdiff_t pos,
|
||||
register ptrdiff_t nchars, Lisp_Object *annot,
|
||||
ptrdiff_t nchars, Lisp_Object *annot,
|
||||
struct coding_system *coding)
|
||||
{
|
||||
Lisp_Object tem;
|
||||
|
|
@ -4965,29 +4952,29 @@ a_write (int desc, Lisp_Object string, ptrdiff_t pos,
|
|||
/* Output buffer text up to the next annotation's position. */
|
||||
if (nextpos > pos)
|
||||
{
|
||||
if (0 > e_write (desc, string, pos, nextpos, coding))
|
||||
return -1;
|
||||
if (!e_write (desc, string, pos, nextpos, coding))
|
||||
return 0;
|
||||
pos = nextpos;
|
||||
}
|
||||
/* Output the annotation. */
|
||||
tem = Fcdr (Fcar (*annot));
|
||||
if (STRINGP (tem))
|
||||
{
|
||||
if (0 > e_write (desc, tem, 0, SCHARS (tem), coding))
|
||||
return -1;
|
||||
if (!e_write (desc, tem, 0, SCHARS (tem), coding))
|
||||
return 0;
|
||||
}
|
||||
*annot = Fcdr (*annot);
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Write text in the range START and END into descriptor DESC,
|
||||
encoding them with coding system CODING. If STRING is nil, START
|
||||
and END are character positions of the current buffer, else they
|
||||
are indexes to the string STRING. */
|
||||
are indexes to the string STRING. Return true if successful. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end,
|
||||
struct coding_system *coding)
|
||||
{
|
||||
|
|
@ -5056,12 +5043,12 @@ e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end,
|
|||
coding->produced);
|
||||
|
||||
if (coding->produced)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
start += coding->consumed_char;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime,
|
||||
|
|
@ -5300,12 +5287,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
|
|||
{
|
||||
struct buffer *old = current_buffer, *b;
|
||||
Lisp_Object tail, buf, hook;
|
||||
int auto_saved = 0;
|
||||
bool auto_saved = 0;
|
||||
int do_handled_files;
|
||||
Lisp_Object oquit;
|
||||
FILE *stream = NULL;
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
int orig_minibuffer_auto_raise = minibuffer_auto_raise;
|
||||
bool orig_minibuffer_auto_raise = minibuffer_auto_raise;
|
||||
bool old_message_p = 0;
|
||||
struct gcpro gcpro1, gcpro2;
|
||||
|
||||
|
|
@ -5452,7 +5439,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
|
|||
if (!auto_saved && NILP (no_message))
|
||||
message1 ("Auto-saving...");
|
||||
internal_condition_case (auto_save_1, Qt, auto_save_error);
|
||||
auto_saved++;
|
||||
auto_saved = 1;
|
||||
BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
|
||||
XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
|
||||
set_buffer_internal (old);
|
||||
|
|
|
|||
|
|
@ -100,10 +100,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
/* Return the time of the last system boot. */
|
||||
|
||||
static time_t boot_time;
|
||||
static int boot_time_initialized;
|
||||
static bool boot_time_initialized;
|
||||
|
||||
#ifdef BOOT_TIME
|
||||
static void get_boot_time_1 (const char *, int);
|
||||
static void get_boot_time_1 (const char *, bool);
|
||||
#endif
|
||||
|
||||
static time_t
|
||||
|
|
@ -170,7 +170,7 @@ get_boot_time (void)
|
|||
{
|
||||
char cmd_string[sizeof WTMP_FILE ".19.gz"];
|
||||
Lisp_Object tempname, filename;
|
||||
int delete_flag = 0;
|
||||
bool delete_flag = 0;
|
||||
|
||||
filename = Qnil;
|
||||
|
||||
|
|
@ -225,13 +225,13 @@ get_boot_time (void)
|
|||
|
||||
If FILENAME is zero, use the same file as before;
|
||||
if no FILENAME has ever been specified, this is the utmp file.
|
||||
Use the newest reboot record if NEWEST is nonzero,
|
||||
Use the newest reboot record if NEWEST,
|
||||
the first reboot record otherwise.
|
||||
Ignore all reboot records on or before BOOT_TIME.
|
||||
Success is indicated by setting BOOT_TIME to a larger value. */
|
||||
|
||||
void
|
||||
get_boot_time_1 (const char *filename, int newest)
|
||||
get_boot_time_1 (const char *filename, bool newest)
|
||||
{
|
||||
struct utmp ut, *utp;
|
||||
int desc;
|
||||
|
|
@ -331,11 +331,11 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
|
|||
}
|
||||
|
||||
/* Lock the lock file named LFNAME.
|
||||
If FORCE is nonzero, we do so even if it is already locked.
|
||||
Return 1 if successful, 0 if not. */
|
||||
If FORCE, do so even if it is already locked.
|
||||
Return true if successful. */
|
||||
|
||||
static int
|
||||
lock_file_1 (char *lfname, int force)
|
||||
static bool
|
||||
lock_file_1 (char *lfname, bool force)
|
||||
{
|
||||
int err;
|
||||
int symlink_errno;
|
||||
|
|
@ -370,9 +370,9 @@ lock_file_1 (char *lfname, int force)
|
|||
return err == 0;
|
||||
}
|
||||
|
||||
/* Return 1 if times A and B are no more than one second apart. */
|
||||
/* Return true if times A and B are no more than one second apart. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
within_one_second (time_t a, time_t b)
|
||||
{
|
||||
return (a - b >= -1 && a - b <= 1);
|
||||
|
|
@ -491,7 +491,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
|
|||
static int
|
||||
lock_if_free (lock_info_type *clasher, register char *lfname)
|
||||
{
|
||||
while (lock_file_1 (lfname, 0) == 0)
|
||||
while (! lock_file_1 (lfname, 0))
|
||||
{
|
||||
int locker;
|
||||
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ extern double logb (double);
|
|||
static void float_error ();
|
||||
#endif
|
||||
|
||||
/* Nonzero while executing in floating point.
|
||||
/* True while executing in floating point.
|
||||
This tells float_error what to do. */
|
||||
|
||||
static int in_float;
|
||||
static bool in_float;
|
||||
|
||||
/* If an argument is out of range for a mathematical function,
|
||||
here is the actual argument value to use in the error message.
|
||||
|
|
|
|||
70
src/fns.c
70
src/fns.c
|
|
@ -51,7 +51,7 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
|
|||
|
||||
static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512;
|
||||
|
||||
static int internal_equal (Lisp_Object , Lisp_Object, int, int);
|
||||
static bool internal_equal (Lisp_Object, Lisp_Object, int, bool);
|
||||
|
||||
DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
|
||||
doc: /* Return the argument unchanged. */)
|
||||
|
|
@ -352,7 +352,7 @@ Symbols are also allowed; their print names are used instead. */)
|
|||
}
|
||||
|
||||
static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args,
|
||||
enum Lisp_Type target_type, int last_special);
|
||||
enum Lisp_Type target_type, bool last_special);
|
||||
|
||||
/* ARGSUSED */
|
||||
Lisp_Object
|
||||
|
|
@ -450,19 +450,19 @@ struct textprop_rec
|
|||
|
||||
static Lisp_Object
|
||||
concat (ptrdiff_t nargs, Lisp_Object *args,
|
||||
enum Lisp_Type target_type, int last_special)
|
||||
enum Lisp_Type target_type, bool last_special)
|
||||
{
|
||||
Lisp_Object val;
|
||||
register Lisp_Object tail;
|
||||
register Lisp_Object this;
|
||||
Lisp_Object tail;
|
||||
Lisp_Object this;
|
||||
ptrdiff_t toindex;
|
||||
ptrdiff_t toindex_byte = 0;
|
||||
register EMACS_INT result_len;
|
||||
register EMACS_INT result_len_byte;
|
||||
EMACS_INT result_len;
|
||||
EMACS_INT result_len_byte;
|
||||
ptrdiff_t argnum;
|
||||
Lisp_Object last_tail;
|
||||
Lisp_Object prev;
|
||||
int some_multibyte;
|
||||
bool some_multibyte;
|
||||
/* When we make a multibyte string, we can't copy text properties
|
||||
while concatenating each string because the length of resulting
|
||||
string can't be decided until we finish the whole concatenation.
|
||||
|
|
@ -1988,10 +1988,10 @@ of strings. (`equal' ignores text properties.) */)
|
|||
|
||||
/* DEPTH is current depth of recursion. Signal an error if it
|
||||
gets too deep.
|
||||
PROPS, if non-nil, means compare string text properties too. */
|
||||
PROPS means compare string text properties too. */
|
||||
|
||||
static int
|
||||
internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props)
|
||||
static bool
|
||||
internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props)
|
||||
{
|
||||
if (depth > 200)
|
||||
error ("Stack overflow in equal");
|
||||
|
|
@ -2589,9 +2589,9 @@ Normally the return value is FEATURE.
|
|||
The normal messages at start and end of loading FILENAME are suppressed. */)
|
||||
(Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror)
|
||||
{
|
||||
register Lisp_Object tem;
|
||||
Lisp_Object tem;
|
||||
struct gcpro gcpro1, gcpro2;
|
||||
int from_file = load_in_progress;
|
||||
bool from_file = load_in_progress;
|
||||
|
||||
CHECK_SYMBOL (feature);
|
||||
|
||||
|
|
@ -2917,8 +2917,8 @@ static const short base64_char_to_value[128] =
|
|||
base64 characters. */
|
||||
|
||||
|
||||
static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, int, int);
|
||||
static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, int,
|
||||
static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, bool, bool);
|
||||
static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, bool,
|
||||
ptrdiff_t *);
|
||||
|
||||
DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region,
|
||||
|
|
@ -3026,7 +3026,7 @@ into shorter lines. */)
|
|||
|
||||
static ptrdiff_t
|
||||
base64_encode_1 (const char *from, char *to, ptrdiff_t length,
|
||||
int line_break, int multibyte)
|
||||
bool line_break, bool multibyte)
|
||||
{
|
||||
int counter = 0;
|
||||
ptrdiff_t i = 0;
|
||||
|
|
@ -3133,7 +3133,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
|
|||
ptrdiff_t old_pos = PT;
|
||||
ptrdiff_t decoded_length;
|
||||
ptrdiff_t inserted_chars;
|
||||
int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
|
||||
bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
|
||||
USE_SAFE_ALLOCA;
|
||||
|
||||
validate_region (&beg, &end);
|
||||
|
|
@ -3218,13 +3218,13 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
|
|||
}
|
||||
|
||||
/* Base64-decode the data at FROM of LENGTH bytes into TO. If
|
||||
MULTIBYTE is nonzero, the decoded result should be in multibyte
|
||||
MULTIBYTE, the decoded result should be in multibyte
|
||||
form. If NCHARS_RETURN is not NULL, store the number of produced
|
||||
characters in *NCHARS_RETURN. */
|
||||
|
||||
static ptrdiff_t
|
||||
base64_decode_1 (const char *from, char *to, ptrdiff_t length,
|
||||
int multibyte, ptrdiff_t *nchars_return)
|
||||
bool multibyte, ptrdiff_t *nchars_return)
|
||||
{
|
||||
ptrdiff_t i = 0; /* Used inside READ_QUADRUPLET_BYTE */
|
||||
char *e = to;
|
||||
|
|
@ -3340,7 +3340,7 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
|
|||
static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
|
||||
static ptrdiff_t get_key_arg (Lisp_Object, ptrdiff_t, Lisp_Object *, char *);
|
||||
static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
|
||||
static int sweep_weak_table (struct Lisp_Hash_Table *, int);
|
||||
static bool sweep_weak_table (struct Lisp_Hash_Table *, bool);
|
||||
|
||||
|
||||
|
||||
|
|
@ -3432,10 +3432,10 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max)
|
|||
***********************************************************************/
|
||||
|
||||
/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
|
||||
HASH2 in hash table H using `eql'. Value is non-zero if KEY1 and
|
||||
HASH2 in hash table H using `eql'. Value is true if KEY1 and
|
||||
KEY2 are the same. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
cmpfn_eql (struct Lisp_Hash_Table *h,
|
||||
Lisp_Object key1, EMACS_UINT hash1,
|
||||
Lisp_Object key2, EMACS_UINT hash2)
|
||||
|
|
@ -3447,10 +3447,10 @@ cmpfn_eql (struct Lisp_Hash_Table *h,
|
|||
|
||||
|
||||
/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
|
||||
HASH2 in hash table H using `equal'. Value is non-zero if KEY1 and
|
||||
HASH2 in hash table H using `equal'. Value is true if KEY1 and
|
||||
KEY2 are the same. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
cmpfn_equal (struct Lisp_Hash_Table *h,
|
||||
Lisp_Object key1, EMACS_UINT hash1,
|
||||
Lisp_Object key2, EMACS_UINT hash2)
|
||||
|
|
@ -3460,10 +3460,10 @@ cmpfn_equal (struct Lisp_Hash_Table *h,
|
|||
|
||||
|
||||
/* Compare KEY1 which has hash code HASH1, and KEY2 with hash code
|
||||
HASH2 in hash table H using H->user_cmp_function. Value is non-zero
|
||||
HASH2 in hash table H using H->user_cmp_function. Value is true
|
||||
if KEY1 and KEY2 are the same. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
cmpfn_user_defined (struct Lisp_Hash_Table *h,
|
||||
Lisp_Object key1, EMACS_UINT hash1,
|
||||
Lisp_Object key2, EMACS_UINT hash2)
|
||||
|
|
@ -3923,16 +3923,16 @@ hash_clear (struct Lisp_Hash_Table *h)
|
|||
Weak Hash Tables
|
||||
************************************************************************/
|
||||
|
||||
/* Sweep weak hash table H. REMOVE_ENTRIES_P non-zero means remove
|
||||
/* Sweep weak hash table H. REMOVE_ENTRIES_P means remove
|
||||
entries from the table that don't survive the current GC.
|
||||
REMOVE_ENTRIES_P zero means mark entries that are in use. Value is
|
||||
non-zero if anything was marked. */
|
||||
!REMOVE_ENTRIES_P means mark entries that are in use. Value is
|
||||
true if anything was marked. */
|
||||
|
||||
static int
|
||||
sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
|
||||
static bool
|
||||
sweep_weak_table (struct Lisp_Hash_Table *h, bool remove_entries_p)
|
||||
{
|
||||
ptrdiff_t bucket, n;
|
||||
int marked;
|
||||
bool marked;
|
||||
|
||||
n = ASIZE (h->index) & ~ARRAY_MARK_FLAG;
|
||||
marked = 0;
|
||||
|
|
@ -3949,7 +3949,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
|
|||
ptrdiff_t i = XFASTINT (idx);
|
||||
bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
|
||||
bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
|
||||
int remove_p;
|
||||
bool remove_p;
|
||||
|
||||
if (EQ (h->weak, Qkey))
|
||||
remove_p = !key_known_to_survive_p;
|
||||
|
|
@ -4022,7 +4022,7 @@ void
|
|||
sweep_weak_hash_tables (void)
|
||||
{
|
||||
struct Lisp_Hash_Table *h, *used, *next;
|
||||
int marked;
|
||||
bool marked;
|
||||
|
||||
/* Mark all keys and values that are in use. Keep on marking until
|
||||
there is no more change. This is necessary for cases like
|
||||
|
|
@ -4674,7 +4674,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
|
|||
coding_system = Vcoding_system_for_write;
|
||||
else
|
||||
{
|
||||
int force_raw_text = 0;
|
||||
bool force_raw_text = 0;
|
||||
|
||||
coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
|
||||
if (NILP (coding_system)
|
||||
|
|
|
|||
10
src/lisp.h
10
src/lisp.h
|
|
@ -1205,9 +1205,9 @@ struct Lisp_Hash_Table
|
|||
struct Lisp_Hash_Table *next_weak;
|
||||
|
||||
/* C function to compare two keys. */
|
||||
int (*cmpfn) (struct Lisp_Hash_Table *,
|
||||
Lisp_Object, EMACS_UINT,
|
||||
Lisp_Object, EMACS_UINT);
|
||||
bool (*cmpfn) (struct Lisp_Hash_Table *,
|
||||
Lisp_Object, EMACS_UINT,
|
||||
Lisp_Object, EMACS_UINT);
|
||||
|
||||
/* C function to compute hash code. */
|
||||
EMACS_UINT (*hashfn) (struct Lisp_Hash_Table *, Lisp_Object);
|
||||
|
|
@ -3151,9 +3151,9 @@ EXFUN (Fread_file_name, 6); /* not a normal DEFUN */
|
|||
extern Lisp_Object close_file_unwind (Lisp_Object);
|
||||
extern Lisp_Object restore_point_unwind (Lisp_Object);
|
||||
extern _Noreturn void report_file_error (const char *, Lisp_Object);
|
||||
extern int internal_delete_file (Lisp_Object);
|
||||
extern void internal_delete_file (Lisp_Object);
|
||||
extern void syms_of_fileio (void);
|
||||
extern Lisp_Object make_temp_name (Lisp_Object, int);
|
||||
extern Lisp_Object make_temp_name (Lisp_Object, bool);
|
||||
extern Lisp_Object Qdelete_file;
|
||||
|
||||
/* Defined in search.c */
|
||||
|
|
|
|||
|
|
@ -6576,15 +6576,17 @@ freeze_window_starts (struct frame *f, int freeze_p)
|
|||
/* Return 1 if window configurations CONFIGURATION1 and CONFIGURATION2
|
||||
describe the same state of affairs. This is used by Fequal.
|
||||
|
||||
ignore_positions non-zero means ignore non-matching scroll positions
|
||||
IGNORE_POSITIONS means ignore non-matching scroll positions
|
||||
and the like.
|
||||
|
||||
This ignores a couple of things like the dedication status of
|
||||
window, combination_limit and the like. This might have to be
|
||||
fixed. */
|
||||
|
||||
int
|
||||
compare_window_configurations (Lisp_Object configuration1, Lisp_Object configuration2, int ignore_positions)
|
||||
bool
|
||||
compare_window_configurations (Lisp_Object configuration1,
|
||||
Lisp_Object configuration2,
|
||||
bool ignore_positions)
|
||||
{
|
||||
register struct save_window_data *d1, *d2;
|
||||
struct Lisp_Vector *sws1, *sws2;
|
||||
|
|
|
|||
|
|
@ -973,7 +973,7 @@ extern Lisp_Object Qwindowp, Qwindow_live_p;
|
|||
extern Lisp_Object Vwindow_list;
|
||||
|
||||
extern struct window *decode_live_window (Lisp_Object);
|
||||
extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
|
||||
extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);
|
||||
extern void mark_window_cursors_off (struct window *);
|
||||
extern int window_internal_height (struct window *);
|
||||
extern int window_body_cols (struct window *w);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue