[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117486: * chartab.c (char_table_translate): Move to
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r117486: * chartab.c (char_table_translate): Move to... |
Date: |
Tue, 08 Jul 2014 07:17:20 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117486
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-07-08 11:17:04 +0400
message:
* 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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/character.h
character.h-20091113204419-o5vbwnq5f7feedwu-8538
src/chartab.c chartab.c-20091113204419-o5vbwnq5f7feedwu-8539
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-07-08 06:24:07 +0000
+++ b/src/ChangeLog 2014-07-08 07:17:04 +0000
@@ -1,3 +1,11 @@
+2014-07-08 Dmitry Antipov <address@hidden>
+
+ * 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 <address@hidden>
* process.c: Add sanity checks for file descriptors (Bug#17844).
=== modified file 'src/character.h'
--- a/src/character.h 2014-06-23 04:11:29 +0000
+++ b/src/character.h 2014-07-08 07:17:04 +0000
@@ -667,6 +667,20 @@
#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 */
=== modified file 'src/chartab.c'
--- a/src/chartab.c 2014-07-02 03:26:19 +0000
+++ b/src/chartab.c 2014-07-08 07:17:04 +0000
@@ -663,19 +663,6 @@
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)
{
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2014-07-02 15:22:49 +0000
+++ b/src/lisp.h 2014-07-08 07:17:04 +0000
@@ -823,7 +823,6 @@
/* 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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117486: * chartab.c (char_table_translate): Move to...,
Dmitry Antipov <=