From 17c05d741e131e630ad83622ae7eceee67897016 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 24 Aug 2012 23:25:00 -0700 Subject: [PATCH] * casefiddle.c, casetab.c, category.c: Use bool for boolean. * casefiddle.c (casify_object, casify_region): * casetab.c (set_case_table): * category.c, category.h (word_boundary_p): * category.h (CHAR_HAS_CATEGORY): Use bool for booleans, instead of int. --- src/ChangeLog | 9 +++++++++ src/casefiddle.c | 13 +++++++------ src/casetab.c | 4 ++-- src/category.c | 8 ++++---- src/category.h | 12 ++++++------ 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 1a836543d69..e509b9c315f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-08-25 Paul Eggert + + * casefiddle.c, casetab.c, category.c: Use bool for boolean. + * casefiddle.c (casify_object, casify_region): + * casetab.c (set_case_table): + * category.c, category.h (word_boundary_p): + * category.h (CHAR_HAS_CATEGORY): + Use bool for booleans, instead of int. + 2012-08-25 Eli Zaretskii * makefile.w32-in ($(BLD)/alloc.$(O)): Depend on $(GNU_LIB)/execinfo.h. diff --git a/src/casefiddle.c b/src/casefiddle.c index 81e84252b72..1102054b153 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -35,8 +35,8 @@ Lisp_Object Qidentity; static Lisp_Object casify_object (enum case_action flag, Lisp_Object obj) { - register int c, c1; - register int inword = flag == CASE_DOWN; + int c, c1; + bool inword = flag == CASE_DOWN; /* If the case table is flagged as modified, rescan it. */ if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1])) @@ -47,7 +47,8 @@ casify_object (enum case_action flag, Lisp_Object obj) int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER | CHAR_SHIFT | CHAR_CTL | CHAR_META); int flags = XINT (obj) & flagbits; - int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); + bool multibyte = ! NILP (BVAR (current_buffer, + enable_multibyte_characters)); /* If the character has higher bits set above the flags, return it unchanged. @@ -189,9 +190,9 @@ The argument object is not altered--the value is a copy. */) static void casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) { - register int c; - register int inword = flag == CASE_DOWN; - register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); + int c; + bool inword = flag == CASE_DOWN; + bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); ptrdiff_t start, end; ptrdiff_t start_byte; diff --git a/src/casetab.c b/src/casetab.c index a163d5204f8..3e22d0d0b77 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -79,7 +79,7 @@ This is the one used for new buffers. */) return Vascii_downcase_table; } -static Lisp_Object set_case_table (Lisp_Object table, int standard); +static Lisp_Object set_case_table (Lisp_Object, bool); DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0, doc: /* Select a new case table for the current buffer. @@ -113,7 +113,7 @@ See `set-case-table' for more info on case tables. */) } static Lisp_Object -set_case_table (Lisp_Object table, int standard) +set_case_table (Lisp_Object table, bool standard) { Lisp_Object up, canon, eqv; diff --git a/src/category.c b/src/category.c index 1c9085fd558..80dc6938d8b 100644 --- a/src/category.c +++ b/src/category.c @@ -406,17 +406,17 @@ then delete CATEGORY from the category set instead of adding it. */) return Qnil; } -/* Return 1 if there is a word boundary between two word-constituent - characters C1 and C2 if they appear in this order, else return 0. +/* Return true if there is a word boundary between two word-constituent + characters C1 and C2 if they appear in this order. Use the macro WORD_BOUNDARY_P instead of calling this function directly. */ -int +bool word_boundary_p (int c1, int c2) { Lisp_Object category_set1, category_set2; Lisp_Object tail; - int default_result; + bool default_result; if (EQ (CHAR_TABLE_REF (Vchar_script_table, c1), CHAR_TABLE_REF (Vchar_script_table, c2))) diff --git a/src/category.h b/src/category.h index 9fb981ed383..17cd203db45 100644 --- a/src/category.h +++ b/src/category.h @@ -77,14 +77,14 @@ INLINE_HEADER_BEGIN /* Return the category set of character C in the current category table. */ #define CATEGORY_SET(c) char_category_set (c) -/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0. +/* Return true if CATEGORY_SET contains CATEGORY. The faster version of `!NILP (Faref (category_set, category))'. */ #define CATEGORY_MEMBER(category, category_set) \ ((XCATEGORY_SET (category_set)->data[(category) / 8] \ >> ((category) % 8)) & 1) -/* Return 1 if category set of CH contains CATEGORY, else return 0. */ -CATEGORY_INLINE int +/* Return true if category set of CH contains CATEGORY. */ +CATEGORY_INLINE bool CHAR_HAS_CATEGORY (int ch, int category) { Lisp_Object category_set = CATEGORY_SET (ch); @@ -108,14 +108,14 @@ CHAR_HAS_CATEGORY (int ch, int category) #define CATEGORY_TABLE_VERSION (table) \ Fchar_table_extra_slot (table, make_number (1)) -/* Return 1 if there is a word boundary between two word-constituent - characters C1 and C2 if they appear in this order, else return 0. +/* Return true if there is a word boundary between two + word-constituent characters C1 and C2 if they appear in this order. There is no word boundary between two word-constituent ASCII and Latin-1 characters. */ #define WORD_BOUNDARY_P(c1, c2) \ (!(SINGLE_BYTE_CHAR_P (c1) && SINGLE_BYTE_CHAR_P (c2)) \ && word_boundary_p (c1, c2)) -extern int word_boundary_p (int, int); +extern bool word_boundary_p (int, int); INLINE_HEADER_END -- 2.39.2