emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2012839: More casefiddle minor fixes


From: Paul Eggert
Subject: [Emacs-diffs] master 2012839: More casefiddle minor fixes
Date: Thu, 6 Apr 2017 23:03:27 -0400 (EDT)

branch: master
commit 2012839a53a5c4877832e2b09091ce28ea29abc4
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    More casefiddle minor fixes
    
    * src/casefiddle.c (case_character_impl): Omit unnecessary casts.
    (case_character_impl): Avoid reevaluation of CHAR_TABLE_REF.
    (GREEK_CAPITAL_LETTER_SIGMA): Fix typo in my previous change.
---
 src/casefiddle.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/casefiddle.c b/src/casefiddle.c
index b7782a8..443d62b 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -125,9 +125,9 @@ case_character_impl (struct casing_str_buf *buf,
     }
 
   /* Look through the special casing entries.  */
-  if (buf && !NILP (ctx->specialcase_char_tables[(int)flag]))
+  if (buf && !NILP (ctx->specialcase_char_tables[flag]))
     {
-      prop = CHAR_TABLE_REF (ctx->specialcase_char_tables[(int)flag], ch);
+      prop = CHAR_TABLE_REF (ctx->specialcase_char_tables[flag], ch);
       if (STRINGP (prop))
         {
           struct Lisp_String *str = XSTRING (prop);
@@ -144,12 +144,21 @@ case_character_impl (struct casing_str_buf *buf,
   /* Handle simple, one-to-one case.  */
   if (flag == CASE_DOWN)
     cased = downcase (ch);
-  else if (!NILP (ctx->titlecase_char_table)
-          && CHARACTERP (prop
-                         = CHAR_TABLE_REF (ctx->titlecase_char_table, ch)))
-    cased = XFASTINT (prop);
   else
-    cased = upcase (ch);
+    {
+      bool cased_is_set = false;
+      if (!NILP (ctx->titlecase_char_table))
+       {
+         prop = CHAR_TABLE_REF (ctx->titlecase_char_table, ch);
+         if (CHARACTERP (prop))
+           {
+             cased = XFASTINT (prop);
+             cased_is_set = true;
+           }
+       }
+      if (!cased_is_set)
+       cased = upcase (ch);
+    }
 
   /* And we’re done.  */
  done:
@@ -167,7 +176,7 @@ case_character_impl (struct casing_str_buf *buf,
    The rule does not conflict with any other casing rules so while it is
    a conditional one, it is independent of language.  */
 
-enum { GREEK_CAPITAL_LETTER_SIGMA = 0x03A }; /* Σ */
+enum { GREEK_CAPITAL_LETTER_SIGMA = 0x03A3 }; /* Σ */
 enum { GREEK_SMALL_LETTER_FINAL_SIGMA = 0x03C2 }; /* ς */
 
 /* Based on CTX, case character CH accordingly.  Update CTX as necessary.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]