Fix minor problems found by static checking.
[bpt/emacs.git] / src / composite.c
index f494f45..d402d5a 100644 (file)
@@ -967,7 +967,6 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT
 }
 
 static Lisp_Object _work_val;
-static int _work_char;
 
 /* 1 iff the character C is composable.  Characters of general
    category Z? or C? are not composable except for ZWNJ and ZWJ. */
@@ -976,9 +975,8 @@ static int _work_char;
   ((C) > ' '                                                           \
    && ((C) == 0x200C || (C) == 0x200D                                  \
        || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)),  \
-          (SYMBOLP (_work_val)                                         \
-           && (_work_char = SDATA (SYMBOL_NAME (_work_val))[0]) != 'C' \
-           && _work_char != 'Z'))))
+          (INTEGERP (_work_val)                                        \
+           && (XINT (_work_val) <= UNICODE_CATEGORY_So)))))
 
 /* Update cmp_it->stop_pos to the next position after CHARPOS (and
    BYTEPOS) where character composition may happen.  If BYTEPOS is
@@ -1027,6 +1025,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
   /* FIXME: Bidi is not yet handled well in static composition.  */
   if (charpos < endpos
       && find_composition (charpos, endpos, &start, &end, &prop, string)
+      && start >= charpos
       && COMPOSITION_VALID_P (start, end, prop))
     {
       cmp_it->stop_pos = endpos = start;
@@ -1677,7 +1676,6 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit,
        }
       BACKWARD_CHAR (cur, stop);
     }
-  return 0;
 }
 
 /* Return the adjusted point provided that point is moved from LAST_PT
@@ -1938,8 +1936,7 @@ syms_of_composite (void)
 {
   int i;
 
-  Qcomposition = intern_c_string ("composition");
-  staticpro (&Qcomposition);
+  DEFSYM (Qcomposition, "composition");
 
   /* Make a hash table for static composition.  */
   {
@@ -1998,11 +1995,8 @@ valid.
 The default value is the function `compose-chars-after'.  */);
   Vcompose_chars_after_function = intern_c_string ("compose-chars-after");
 
-  Qauto_composed = intern_c_string ("auto-composed");
-  staticpro (&Qauto_composed);
-
-  Qauto_composition_function = intern_c_string ("auto-composition-function");
-  staticpro (&Qauto_composition_function);
+  DEFSYM (Qauto_composed, "auto-composed");
+  DEFSYM (Qauto_composition_function, "auto-composition-function");
 
   DEFVAR_LISP ("auto-composition-mode", Vauto_composition_mode,
               doc: /* Non-nil if Auto-Composition mode is enabled.