aboutsummaryrefslogtreecommitdiffstats
path: root/src/charset.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/charset.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/charset.c')
-rw-r--r--src/charset.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/charset.c b/src/charset.c
index 3e286fa947d..0673790e91c 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -215,7 +215,7 @@ static struct
215 215
216/* Set to 1 to warn that a charset map is loaded and thus a buffer 216/* Set to 1 to warn that a charset map is loaded and thus a buffer
217 text and a string data may be relocated. */ 217 text and a string data may be relocated. */
218int charset_map_loaded; 218bool charset_map_loaded;
219 219
220struct charset_map_entries 220struct charset_map_entries
221{ 221{
@@ -256,7 +256,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
256{ 256{
257 Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil); 257 Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil);
258 unsigned max_code = CHARSET_MAX_CODE (charset); 258 unsigned max_code = CHARSET_MAX_CODE (charset);
259 int ascii_compatible_p = charset->ascii_compatible_p; 259 bool ascii_compatible_p = charset->ascii_compatible_p;
260 int min_char, max_char, nonascii_min_char; 260 int min_char, max_char, nonascii_min_char;
261 int i; 261 int i;
262 unsigned char *fast_map = charset->fast_map; 262 unsigned char *fast_map = charset->fast_map;
@@ -423,7 +423,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
423 paying attention to comment character '#'. */ 423 paying attention to comment character '#'. */
424 424
425static inline unsigned 425static inline unsigned
426read_hex (FILE *fp, int *eof, int *overflow) 426read_hex (FILE *fp, bool *eof, bool *overflow)
427{ 427{
428 int c; 428 int c;
429 unsigned n; 429 unsigned n;
@@ -512,7 +512,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
512 { 512 {
513 unsigned from, to, c; 513 unsigned from, to, c;
514 int idx; 514 int idx;
515 int eof = 0, overflow = 0; 515 bool eof = 0, overflow = 0;
516 516
517 from = read_hex (fp, &eof, &overflow); 517 from = read_hex (fp, &eof, &overflow);
518 if (eof) 518 if (eof)
@@ -717,10 +717,8 @@ map_charset_chars (void (*c_function)(Lisp_Object, Lisp_Object), Lisp_Object fun
717 Lisp_Object arg, struct charset *charset, unsigned from, unsigned to) 717 Lisp_Object arg, struct charset *charset, unsigned from, unsigned to)
718{ 718{
719 Lisp_Object range; 719 Lisp_Object range;
720 int partial; 720 bool partial = (from > CHARSET_MIN_CODE (charset)
721 721 || to < CHARSET_MAX_CODE (charset));
722 partial = (from > CHARSET_MIN_CODE (charset)
723 || to < CHARSET_MAX_CODE (charset));
724 722
725 if (CHARSET_METHOD (charset) == CHARSET_METHOD_OFFSET) 723 if (CHARSET_METHOD (charset) == CHARSET_METHOD_OFFSET)
726 { 724 {
@@ -855,7 +853,7 @@ usage: (define-charset-internal ...) */)
855 struct charset charset; 853 struct charset charset;
856 int id; 854 int id;
857 int dimension; 855 int dimension;
858 int new_definition_p; 856 bool new_definition_p;
859 int nchars; 857 int nchars;
860 858
861 if (nargs != charset_arg_max) 859 if (nargs != charset_arg_max)
@@ -1250,7 +1248,7 @@ define_charset_internal (Lisp_Object name,
1250 const char *code_space_chars, 1248 const char *code_space_chars,
1251 unsigned min_code, unsigned max_code, 1249 unsigned min_code, unsigned max_code,
1252 int iso_final, int iso_revision, int emacs_mule_id, 1250 int iso_final, int iso_revision, int emacs_mule_id,
1253 int ascii_compatible, int supplementary, 1251 bool ascii_compatible, bool supplementary,
1254 int code_offset) 1252 int code_offset)
1255{ 1253{
1256 const unsigned char *code_space = (const unsigned char *) code_space_chars; 1254 const unsigned char *code_space = (const unsigned char *) code_space_chars;
@@ -1448,7 +1446,7 @@ if CHARSET is designated instead. */)
1448 (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char, Lisp_Object charset) 1446 (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char, Lisp_Object charset)
1449{ 1447{
1450 int id; 1448 int id;
1451 int chars_flag; 1449 bool chars_flag;
1452 1450
1453 CHECK_CHARSET_GET_ID (charset, id); 1451 CHECK_CHARSET_GET_ID (charset, id);
1454 check_iso_charset_parameter (dimension, chars, final_char); 1452 check_iso_charset_parameter (dimension, chars, final_char);
@@ -1499,7 +1497,9 @@ string_xstring_p (Lisp_Object string)
1499 It may lookup a translation table TABLE if supplied. */ 1497 It may lookup a translation table TABLE if supplied. */
1500 1498
1501static void 1499static void
1502find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte) 1500find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars,
1501 ptrdiff_t nbytes, Lisp_Object charsets,
1502 Lisp_Object table, bool multibyte)
1503{ 1503{
1504 const unsigned char *pend = ptr + nbytes; 1504 const unsigned char *pend = ptr + nbytes;
1505 1505
@@ -1549,7 +1549,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
1549 ptrdiff_t from, from_byte, to, stop, stop_byte; 1549 ptrdiff_t from, from_byte, to, stop, stop_byte;
1550 int i; 1550 int i;
1551 Lisp_Object val; 1551 Lisp_Object val;
1552 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 1552 bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
1553 1553
1554 validate_region (&beg, &end); 1554 validate_region (&beg, &end);
1555 from = XFASTINT (beg); 1555 from = XFASTINT (beg);
@@ -1735,7 +1735,7 @@ decode_char (struct charset *charset, unsigned int code)
1735/* Variable used temporarily by the macro ENCODE_CHAR. */ 1735/* Variable used temporarily by the macro ENCODE_CHAR. */
1736Lisp_Object charset_work; 1736Lisp_Object charset_work;
1737 1737
1738/* Return a code-point of CHAR in CHARSET. If CHAR doesn't belong to 1738/* Return a code-point of C in CHARSET. If C doesn't belong to
1739 CHARSET, return CHARSET_INVALID_CODE (CHARSET). If STRICT is true, 1739 CHARSET, return CHARSET_INVALID_CODE (CHARSET). If STRICT is true,
1740 use CHARSET's strict_max_char instead of max_char. */ 1740 use CHARSET's strict_max_char instead of max_char. */
1741 1741
@@ -1978,7 +1978,7 @@ is specified. */)
1978struct charset * 1978struct charset *
1979char_charset (int c, Lisp_Object charset_list, unsigned int *code_return) 1979char_charset (int c, Lisp_Object charset_list, unsigned int *code_return)
1980{ 1980{
1981 int maybe_null = 0; 1981 bool maybe_null = 0;
1982 1982
1983 if (NILP (charset_list)) 1983 if (NILP (charset_list))
1984 charset_list = Vcharset_ordered_list; 1984 charset_list = Vcharset_ordered_list;
@@ -2106,7 +2106,7 @@ DIMENSION, CHARS, and FINAL-CHAR. */)
2106 (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char) 2106 (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char)
2107{ 2107{
2108 int id; 2108 int id;
2109 int chars_flag; 2109 bool chars_flag;
2110 2110
2111 check_iso_charset_parameter (dimension, chars, final_char); 2111 check_iso_charset_parameter (dimension, chars, final_char);
2112 chars_flag = XFASTINT (chars) == 96; 2112 chars_flag = XFASTINT (chars) == 96;