aboutsummaryrefslogtreecommitdiffstats
path: root/src/character.c
diff options
context:
space:
mode:
authorPaul Eggert2012-08-26 01:41:36 -0700
committerPaul Eggert2012-08-26 01:41:36 -0700
commitd5172d4fbc2ca871d18426fb9e84ee6bb87a0e68 (patch)
treefe1dd8c01faf007f86f46cbf4a6f441ae28b104d /src/character.c
parent6af64513413d7194cfa2d8308db2d73f6ed64bf4 (diff)
downloademacs-d5172d4fbc2ca871d18426fb9e84ee6bb87a0e68.tar.gz
emacs-d5172d4fbc2ca871d18426fb9e84ee6bb87a0e68.zip
* character.c, charset.c, chartab.c: Use bool for booleans.
* character.c (lisp_string_width, string_count_byte8) (string_escape_byte8): * charset.c (charset_map_loaded, load_charset_map, read_hex): (load_charset_map_from_file, map_charset_chars) (Fdefine_charset_internal, define_charset_internal) (Fdeclare_equiv_charset, find_charsets_in_text) (Ffind_charset_region, char_charset, Fiso_charset): * chartab.c (sub_char_table_ref, sub_char_table_ref_and_range) (sub_char_table_set, sub_char_table_set_range) (char_table_set_range, optimize_sub_char_table) (map_sub_char_table): Use bool for boolean. * character.c (str_to_unibyte): Omit last boolean argument; it was always 0. All callers changed. * character.h, charset.h: Adjust to match previous changes. * character.h (char_printable_p): Remove decl of nonexistent function. * charset.h (struct charset): Members code_linear_p, iso_chars_96, ascii_compatible_p, supplementary_p, compact_codes_p, unified_p are all boolean, so make them single-bit bitfields.
Diffstat (limited to 'src/character.c')
-rw-r--r--src/character.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/character.c b/src/character.c
index b2acf36ec15..cfaaf8eeca9 100644
--- a/src/character.c
+++ b/src/character.c
@@ -427,7 +427,7 @@ lisp_string_width (Lisp_Object string, ptrdiff_t precision,
427 /* This set multibyte to 0 even if STRING is multibyte when it 427 /* This set multibyte to 0 even if STRING is multibyte when it
428 contains only ascii and eight-bit-graphic, but that's 428 contains only ascii and eight-bit-graphic, but that's
429 intentional. */ 429 intentional. */
430 int multibyte = len < SBYTES (string); 430 bool multibyte = len < SBYTES (string);
431 unsigned char *str = SDATA (string); 431 unsigned char *str = SDATA (string);
432 ptrdiff_t i = 0, i_byte = 0; 432 ptrdiff_t i = 0, i_byte = 0;
433 ptrdiff_t width = 0; 433 ptrdiff_t width = 0;
@@ -765,13 +765,10 @@ str_as_unibyte (unsigned char *str, ptrdiff_t bytes)
765 corresponding byte and store in DST. CHARS is the number of 765 corresponding byte and store in DST. CHARS is the number of
766 characters in SRC. The value is the number of bytes stored in DST. 766 characters in SRC. The value is the number of bytes stored in DST.
767 Usually, the value is the same as CHARS, but is less than it if SRC 767 Usually, the value is the same as CHARS, but is less than it if SRC
768 contains a non-ASCII, non-eight-bit character. If ACCEPT_LATIN_1 768 contains a non-ASCII, non-eight-bit character. */
769 is nonzero, a Latin-1 character is accepted and converted to a byte
770 of that character code.
771 Note: Currently the arg ACCEPT_LATIN_1 is not used. */
772 769
773ptrdiff_t 770ptrdiff_t
774str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, int accept_latin_1) 771str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars)
775{ 772{
776 ptrdiff_t i; 773 ptrdiff_t i;
777 774
@@ -781,8 +778,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, i
781 778
782 if (CHAR_BYTE8_P (c)) 779 if (CHAR_BYTE8_P (c))
783 c = CHAR_TO_BYTE8 (c); 780 c = CHAR_TO_BYTE8 (c);
784 else if (! ASCII_CHAR_P (c) 781 else if (! ASCII_CHAR_P (c))
785 && (! accept_latin_1 || c >= 0x100))
786 return i; 782 return i;
787 *dst++ = c; 783 *dst++ = c;
788 } 784 }
@@ -793,7 +789,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, i
793static ptrdiff_t 789static ptrdiff_t
794string_count_byte8 (Lisp_Object string) 790string_count_byte8 (Lisp_Object string)
795{ 791{
796 int multibyte = STRING_MULTIBYTE (string); 792 bool multibyte = STRING_MULTIBYTE (string);
797 ptrdiff_t nbytes = SBYTES (string); 793 ptrdiff_t nbytes = SBYTES (string);
798 unsigned char *p = SDATA (string); 794 unsigned char *p = SDATA (string);
799 unsigned char *pend = p + nbytes; 795 unsigned char *pend = p + nbytes;
@@ -825,7 +821,7 @@ string_escape_byte8 (Lisp_Object string)
825{ 821{
826 ptrdiff_t nchars = SCHARS (string); 822 ptrdiff_t nchars = SCHARS (string);
827 ptrdiff_t nbytes = SBYTES (string); 823 ptrdiff_t nbytes = SBYTES (string);
828 int multibyte = STRING_MULTIBYTE (string); 824 bool multibyte = STRING_MULTIBYTE (string);
829 ptrdiff_t byte8_count; 825 ptrdiff_t byte8_count;
830 const unsigned char *src, *src_end; 826 const unsigned char *src, *src_end;
831 unsigned char *dst; 827 unsigned char *dst;