aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2004-01-29 02:54:22 +0000
committerKenichi Handa2004-01-29 02:54:22 +0000
commit13f52ed8144e1e352f03b69c92ed40fd322bb513 (patch)
tree42d5dc3a752f736bcd0f94e88c695d11b365069f /src
parentd57625a021192f87993f6018f9577c41e201bbc7 (diff)
downloademacs-13f52ed8144e1e352f03b69c92ed40fd322bb513.tar.gz
emacs-13f52ed8144e1e352f03b69c92ed40fd322bb513.zip
(string_char_to_byte): Optimize for ASCII only string.
(string_byte_to_char): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/fns.c10
2 files changed, 9 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 100cfd83f06..9d52344d5b3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12004-01-29 Kenichi Handa <handa@m17n.org>
2
3 * fns.c (string_char_to_byte): Optimize for ASCII only string.
4 (string_byte_to_char): Likewise.
5
12004-01-28 Peter Runestig <peter@runestig.com> 62004-01-28 Peter Runestig <peter@runestig.com>
2 7
3 * makefile.w32-in, w32fns.c: Add `default-printer-name' function. 8 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
diff --git a/src/fns.c b/src/fns.c
index 6383e09302b..493d7ba2897 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -884,12 +884,11 @@ string_char_to_byte (string, char_index)
884 int best_below, best_below_byte; 884 int best_below, best_below_byte;
885 int best_above, best_above_byte; 885 int best_above, best_above_byte;
886 886
887 if (! STRING_MULTIBYTE (string))
888 return char_index;
889
890 best_below = best_below_byte = 0; 887 best_below = best_below_byte = 0;
891 best_above = SCHARS (string); 888 best_above = SCHARS (string);
892 best_above_byte = SBYTES (string); 889 best_above_byte = SBYTES (string);
890 if (best_above == best_above_byte)
891 return char_index;
893 892
894 if (EQ (string, string_char_byte_cache_string)) 893 if (EQ (string, string_char_byte_cache_string))
895 { 894 {
@@ -957,12 +956,11 @@ string_byte_to_char (string, byte_index)
957 int best_below, best_below_byte; 956 int best_below, best_below_byte;
958 int best_above, best_above_byte; 957 int best_above, best_above_byte;
959 958
960 if (! STRING_MULTIBYTE (string))
961 return byte_index;
962
963 best_below = best_below_byte = 0; 959 best_below = best_below_byte = 0;
964 best_above = SCHARS (string); 960 best_above = SCHARS (string);
965 best_above_byte = SBYTES (string); 961 best_above_byte = SBYTES (string);
962 if (best_above == best_above_byte)
963 return byte_index;
966 964
967 if (EQ (string, string_char_byte_cache_string)) 965 if (EQ (string, string_char_byte_cache_string))
968 { 966 {