* chartab.c (char_table_translate): Move to...
* character.h (char_table_translate): ... inline function here. Avoid Faref and assume that args are always valid. This helps to speedup search, which is especially important for a huge buffers. * lisp.h (char_table_translate): Remove prototype.
This commit is contained in:
parent
12dc542935
commit
f298de5264
4 changed files with 22 additions and 14 deletions
|
@ -1,3 +1,11 @@
|
|||
2014-07-08 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* chartab.c (char_table_translate): Move to...
|
||||
* character.h (char_table_translate): ... inline function here.
|
||||
Avoid Faref and assume that args are always valid. This helps to
|
||||
speedup search, which is especially important for a huge buffers.
|
||||
* lisp.h (char_table_translate): Remove prototype.
|
||||
|
||||
2014-07-08 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* process.c: Add sanity checks for file descriptors (Bug#17844).
|
||||
|
|
|
@ -667,6 +667,20 @@ extern Lisp_Object string_escape_byte8 (Lisp_Object);
|
|||
#define GET_TRANSLATION_TABLE(id) \
|
||||
(XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)]))
|
||||
|
||||
/* Look up the element in char table OBJ at index CH, and return it as
|
||||
an integer. If the element is not a character, return CH itself. */
|
||||
|
||||
INLINE int
|
||||
char_table_translate (Lisp_Object obj, int ch)
|
||||
{
|
||||
/* This internal function is expected to be called with valid arguments,
|
||||
so there is a eassert instead of CHECK_xxx for the sake of speed. */
|
||||
eassert (CHAR_VALID_P (ch));
|
||||
eassert (CHAR_TABLE_P (obj));
|
||||
obj = CHAR_TABLE_REF (obj, ch);
|
||||
return CHARACTERP (obj) ? XINT (obj) : ch;
|
||||
}
|
||||
|
||||
INLINE_HEADER_END
|
||||
|
||||
#endif /* EMACS_CHARACTER_H */
|
||||
|
|
|
@ -663,19 +663,6 @@ or a character code. Return VALUE. */)
|
|||
return value;
|
||||
}
|
||||
|
||||
/* Look up the element in TABLE at index CH, and return it as an
|
||||
integer. If the element is not a character, return CH itself. */
|
||||
|
||||
int
|
||||
char_table_translate (Lisp_Object table, int ch)
|
||||
{
|
||||
Lisp_Object value;
|
||||
value = Faref (table, make_number (ch));
|
||||
if (! CHARACTERP (value))
|
||||
return ch;
|
||||
return XINT (value);
|
||||
}
|
||||
|
||||
static Lisp_Object
|
||||
optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
|
||||
{
|
||||
|
|
|
@ -823,7 +823,6 @@ INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object);
|
|||
/* Defined in chartab.c. */
|
||||
extern Lisp_Object char_table_ref (Lisp_Object, int);
|
||||
extern void char_table_set (Lisp_Object, int, Lisp_Object);
|
||||
extern int char_table_translate (Lisp_Object, int);
|
||||
|
||||
/* Defined in data.c. */
|
||||
extern Lisp_Object Qarrayp, Qbufferp, Qbuffer_or_string_p, Qchar_table_p;
|
||||
|
|
Loading…
Add table
Reference in a new issue