Declare Lisp_Object Q* variables to be 'static' if not exproted.
[bpt/emacs.git] / src / syntax.c
index 0a1525b..96d50f9 100644 (file)
@@ -95,7 +95,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define ST_COMMENT_STYLE (256 + 1)
 #define ST_STRING_STYLE (256 + 2)
 
-Lisp_Object Qsyntax_table_p, Qsyntax_table, Qscan_error;
+static Lisp_Object Qsyntax_table_p;
+static Lisp_Object Qsyntax_table, Qscan_error;
 
 /* Used as a temporary in SYNTAX_ENTRY and other macros in syntax.h,
    if not compiled with GCC.  No need to mark it, since it is used
@@ -138,6 +139,7 @@ static EMACS_INT find_start_begv;
 static int find_start_modiff;
 
 
+INFUN (Fsyntax_table_p, 1);
 static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int);
 static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object);
 static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int);
@@ -175,7 +177,8 @@ update_syntax_table (EMACS_INT charpos, int count, int init,
                     Lisp_Object object)
 {
   Lisp_Object tmp_table;
-  int cnt = 0, invalidate = 1;
+  unsigned cnt = 0;
+  int invalidate = 1;
   INTERVAL i;
 
   if (init)
@@ -1219,7 +1222,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
   register EMACS_INT from_byte = CHAR_TO_BYTE (from);
   register enum syntaxcode code;
   int ch0, ch1;
-  Lisp_Object func, script, pos;
+  Lisp_Object func, pos;
 
   immediate_quit = 1;
   QUIT;
@@ -1259,7 +1262,6 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
        }
       else
        {
-         script = CHAR_TABLE_REF (Vchar_script_table, ch0);
          while (1)
            {
              if (from == end) break;
@@ -1310,7 +1312,6 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
        }
       else
        {
-         script = CHAR_TABLE_REF (Vchar_script_table, ch1);
          while (1)
            {
              if (from == beg)
@@ -1338,7 +1339,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
   return from;
 }
 
-DEFUN ("forward-word", Fforward_word, Sforward_word, 0, 1, "^p",
+DEFUE ("forward-word", Fforward_word, Sforward_word, 0, 1, "^p",
        doc: /* Move point forward ARG words (backward if ARG is negative).
 Normally returns t.
 If an edge of the buffer or a field boundary is reached, point is left there
@@ -1367,9 +1368,7 @@ and the function returns nil.  Field boundaries are not noticed if
   return val == orig_val ? Qt : Qnil;
 }
 \f
-Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int);
-
-DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
+DEFUE ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
        doc: /* Move point forward, stopping before a char not in STRING, or at pos LIM.
 STRING is like the inside of a `[...]' in a regular expression
 except that `]' is never special and `\\' quotes `^', `-' or `\\'
@@ -1384,7 +1383,7 @@ Returns the distance traveled, either zero or positive.  */)
   return skip_chars (1, string, lim, 1);
 }
 
-DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0,
+DEFUE ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0,
        doc: /* Move point backward, stopping after a char not in STRING, or at pos LIM.
 See `skip-chars-forward' for details.
 Returns the distance traveled, either zero or negative.  */)
@@ -1542,7 +1541,8 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
 
              if (c <= c2)
                {
-                 while (c <= c2)
+                 unsigned lim2 = c2 + 1;
+                 while (c < lim2)
                    fastmap[c++] = 1;
                  if (! ASCII_CHAR_P (c2))
                    string_has_eight_bit = 1;
@@ -1682,7 +1682,8 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
                }
              if (! ASCII_CHAR_P (c))
                {
-                 while (leading_code <= leading_code2)
+                 unsigned lim2 = leading_code2 + 1;
+                 while (leading_code < lim2)
                    fastmap[leading_code++] = 1;
                  if (c <= c2)
                    {
@@ -1714,9 +1715,9 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
          for (i = 0; i < n_char_ranges; i += 2)
            {
              int c1 = char_ranges[i];
-             int c2 = char_ranges[i + 1];
+             unsigned lim2 = char_ranges[i + 1] + 1;
 
-             for (; c1 <= c2; c1++)
+             for (; c1 < lim2; c1++)
                {
                  int b = CHAR_TO_BYTE_SAFE (c1);
                  if (b >= 0)