From 8a1816bb4a523e10ad30438e38704fc584bb4854 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 3 Jun 2008 04:24:04 +0000 Subject: [PATCH] (char_charset): Return NULL if the arg charset_list is specified and C doesn't belong to any of them. --- src/ChangeLog | 5 +++++ src/charset.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 66f00bcea7a..1ef32828b45 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-06-03 Kenichi Handa + + * charset.c (char_charset): Return NULL if the arg charset_list is + specified and C doesn't belong to any of them. + 2008-06-02 Chip Coldwell * font.c (font_pixel_size): Don't take cdr of an integer. diff --git a/src/charset.c b/src/charset.c index 052c511f6a3..a08089d6d2c 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1813,8 +1813,12 @@ char_charset (c, charset_list, code_return) Lisp_Object charset_list; unsigned *code_return; { + int maybe_null = 0; + if (NILP (charset_list)) charset_list = Vcharset_ordered_list; + else + maybe_null = 1; while (CONSP (charset_list)) { @@ -1832,7 +1836,8 @@ char_charset (c, charset_list, code_return) && EQ (charset_list, Vcharset_non_preferred_head)) return CHARSET_FROM_ID (charset_unicode); } - return (c <= MAX_5_BYTE_CHAR ? CHARSET_FROM_ID (charset_emacs) + return (maybe_null ? NULL + : c <= MAX_5_BYTE_CHAR ? CHARSET_FROM_ID (charset_emacs) : CHARSET_FROM_ID (charset_eight_bit)); } -- 2.39.2