summaryrefslogtreecommitdiff
path: root/src/charset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/charset.c b/src/charset.c
index 8ff469e13a3..09520ccc2ad 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -30,6 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <sys/types.h>
@@ -240,7 +241,8 @@ struct charset_map_entries
static void
load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag)
{
- Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil);
+ Lisp_Object vec UNINIT;
+ Lisp_Object table UNINIT;
unsigned max_code = CHARSET_MAX_CODE (charset);
bool ascii_compatible_p = charset->ascii_compatible_p;
int min_char, max_char, nonascii_min_char;
@@ -434,7 +436,7 @@ read_hex (FILE *fp, bool *eof, bool *overflow)
n = 0;
while (c_isxdigit (c = getc (fp)))
{
- if (UINT_MAX >> 4 < n)
+ if (INT_LEFT_SHIFT_OVERFLOW (n, 4))
*overflow = 1;
n = ((n << 4)
| (c - ('0' <= c && c <= '9' ? '0'
@@ -842,9 +844,9 @@ usage: (define-charset-internal ...) */)
int nchars;
if (nargs != charset_arg_max)
- return Fsignal (Qwrong_number_of_arguments,
- Fcons (intern ("define-charset-internal"),
- make_number (nargs)));
+ Fsignal (Qwrong_number_of_arguments,
+ Fcons (intern ("define-charset-internal"),
+ make_number (nargs)));
attrs = Fmake_vector (make_number (charset_attr_max), Qnil);
@@ -1050,8 +1052,8 @@ usage: (define-charset-internal ...) */)
/* Here, we just copy the parent's fast_map. It's not accurate,
but at least it works for quickly detecting which character
DOESN'T belong to this charset. */
- for (i = 0; i < 190; i++)
- charset.fast_map[i] = parent_charset->fast_map[i];
+ memcpy (charset.fast_map, parent_charset->fast_map,
+ sizeof charset.fast_map);
/* We also copy these for parents. */
charset.min_char = parent_charset->min_char;
@@ -1400,7 +1402,7 @@ check_iso_charset_parameter (Lisp_Object dimension, Lisp_Object chars,
int final_ch = XFASTINT (final_char);
if (! ('0' <= final_ch && final_ch <= '~'))
- error ("Invalid FINAL-CHAR '%c', it should be '0'..'~'", final_ch);
+ error ("Invalid FINAL-CHAR `%c', it should be `0'..`~'", final_ch);
return chars_flag;
}
@@ -1838,12 +1840,12 @@ encode_char (struct charset *charset, int c)
}
-DEFUN ("decode-char", Fdecode_char, Sdecode_char, 2, 3, 0,
+DEFUN ("decode-char", Fdecode_char, Sdecode_char, 2, 2, 0,
doc: /* Decode the pair of CHARSET and CODE-POINT into a character.
Return nil if CODE-POINT is not valid in CHARSET.
CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). */)
- (Lisp_Object charset, Lisp_Object code_point, Lisp_Object restriction)
+ (Lisp_Object charset, Lisp_Object code_point)
{
int c, id;
unsigned code;
@@ -1857,10 +1859,10 @@ CODE-POINT may be a cons (HIGHER-16-BIT-VALUE . LOWER-16-BIT-VALUE). */)
}
-DEFUN ("encode-char", Fencode_char, Sencode_char, 2, 3, 0,
+DEFUN ("encode-char", Fencode_char, Sencode_char, 2, 2, 0,
doc: /* Encode the character CH into a code-point of CHARSET.
Return nil if CHARSET doesn't include CH. */)
- (Lisp_Object ch, Lisp_Object charset, Lisp_Object restriction)
+ (Lisp_Object ch, Lisp_Object charset)
{
int c, id;
unsigned code;