make_number/XINT/XUINT conversions; EQ/== fixes; ==Qnil -> NILP
authorKen Raeburn <raeburn@raeburn.org>
Wed, 5 Apr 2000 17:29:31 +0000 (17:29 +0000)
committerKen Raeburn <raeburn@raeburn.org>
Wed, 5 Apr 2000 17:29:31 +0000 (17:29 +0000)
src/ChangeLog
src/dispnew.c
src/fileio.c
src/fns.c
src/keyboard.c
src/lread.c
src/minibuf.c
src/print.c
src/search.c
src/term.c

index 19932e9..4a7a96e 100644 (file)
@@ -1,3 +1,20 @@
+2000-04-05  Ken Raeburn  <raeburn@gnu.org>
+
+       * dispnew.c (allocate_matrices_for_frame_redisplay,
+       direct_output_forward_char): Use X(U)INT and make_number as needed
+       to convert between (unsigned) int values and lisp integers.
+       * keyboard.c (read_key_sequence): Likewise.
+       * lread.c (substitute_object_recurse): Likewise.
+       * fns.c (concat, hash_lookup, hash_remove): Likewise.
+       * minibuf.c (do_completion, Fminibuffer_complete_word,
+       Fminibuffer_completion_help): Likewise.
+       * term.c (produce_special_glyphs): Likewise.
+
+       * fileio.c (Fwrite_region): Use EQ when comparing lisp objects.
+       * print.c (print_preprocess, print_object): Likewise.
+
+       * search.c (compile_pattern): Use NILP when checking for nil.
+
 2000-04-04  Gerd Moellmann  <gerd@gnu.org>
 
        * window.c (compare_window_configurations): Signal an error
index 0059060..1936501 100644 (file)
@@ -1756,8 +1756,8 @@ allocate_matrices_for_frame_redisplay (window, x, y, ch_dim,
   
          /* Width and height MUST be chosen so that there are no
             holes in the frame matrix.  */
-         dim.width = w->width;
-         dim.height = w->height;
+         dim.width = XINT (w->width);
+         dim.height = XINT (w->height);
 
          /* Will matrix be re-allocated?  */
          if (x != w->desired_matrix->matrix_x
@@ -3372,7 +3372,7 @@ direct_output_forward_char (n)
   struct glyph_row *row;
 
   /* Give up if point moved out of or into a composition.  */
-  if (check_point_in_composition (current_buffer, w->last_point,
+  if (check_point_in_composition (current_buffer, XINT (w->last_point),
                                  current_buffer, PT))
     return 0;
 
index b68ebfc..3af7816 100644 (file)
@@ -4461,7 +4461,7 @@ This does code conversion according to the value of\n\
 
   filename = Fexpand_file_name (filename, Qnil);
 
-  if (! NILP (mustbenew) && mustbenew != Qexcl)
+  if (! NILP (mustbenew) && !EQ (mustbenew, Qexcl))
     barf_or_query_if_file_exists (filename, "overwrite", 1, 0, 1);
 
   if (STRINGP (visit))
@@ -4600,7 +4600,7 @@ This does code conversion according to the value of\n\
                     S_IREAD | S_IWRITE);
 #else  /* not DOS_NT */
   desc = emacs_open (fn, O_WRONLY | O_TRUNC | O_CREAT
-                    | (mustbenew == Qexcl ? O_EXCL : 0),
+                    | (EQ (mustbenew, Qexcl) ? O_EXCL : 0),
                     auto_saving ? auto_save_mode_bits : 0666);
 #endif /* not DOS_NT */
 #endif /* not VMS */
index 4d97232..ebbcf22 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -840,7 +840,7 @@ concat (nargs, args, target_type, last_special)
        {
          this = args[textprops[argnum].argnum];
          copy_text_properties (make_number (textprops[argnum].from),
-                               XSTRING (this)->size, this,
+                               make_number (XSTRING (this)->size), this,
                                make_number (textprops[argnum].to), val, Qnil);
        }
     }
@@ -3950,7 +3950,7 @@ hash_lookup (h, key, hash)
       if (EQ (key, HASH_KEY (h, i))
          || (h->cmpfn
              && h->cmpfn (h, key, hash_code,
-                          HASH_KEY (h, i), HASH_HASH (h, i))))
+                          HASH_KEY (h, i), XUINT (HASH_HASH (h, i)))))
        break;
       idx = HASH_NEXT (h, i);
     }
@@ -4017,7 +4017,7 @@ hash_remove (h, key)
       if (EQ (key, HASH_KEY (h, i))
          || (h->cmpfn
              && h->cmpfn (h, key, hash_code,
-                          HASH_KEY (h, i), HASH_HASH (h, i))))
+                          HASH_KEY (h, i), XUINT (HASH_HASH (h, i)))))
        {
          /* Take entry out of collision chain.  */
          if (NILP (prev))
index 1a9d751..9409b63 100644 (file)
@@ -7863,8 +7863,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
                      pos = XCDR (string);
                      string = XCAR (string);
                      
-                     if (pos >= 0
-                         && pos < XSTRING (string)->size
+                     if (XINT (pos) >= 0
+                         && XINT (pos) < XSTRING (string)->size
                          && (map = Fget_text_property (pos, Qlocal_map,
                                                        string),
                              !NILP (map)))
index 5554eac..4d2895c 100644 (file)
@@ -2334,7 +2334,7 @@ substitute_object_recurse (object, placeholder, subtree)
     case Lisp_Vectorlike:
       {
        int i;
-       int length = Flength(subtree);
+       int length = XINT (Flength(subtree));
        for (i = 0; i < length; i++)
          {
            Lisp_Object idx = make_number (i);
index 1d57681..cbc856e 100644 (file)
@@ -1579,7 +1579,7 @@ do_completion ()
   Lisp_Object last;
   struct gcpro gcpro1, gcpro2;
 
-  completion = Ftry_completion (Ffield_string (ZV),
+  completion = Ftry_completion (Ffield_string (make_number (ZV)),
                                Vminibuffer_completion_table,
                                Vminibuffer_completion_predicate);
   last = last_exact_completion;
@@ -1602,7 +1602,7 @@ do_completion ()
     }
 
   /* compiler bug */
-  tem = Fstring_equal (completion, Ffield_string(ZV));
+  tem = Fstring_equal (completion, Ffield_string(make_number (ZV)));
   completedp = NILP (tem);
   if (completedp)
     {
@@ -1611,7 +1611,7 @@ do_completion ()
     }
 
   /* It did find a match.  Do we match some possibility exactly now? */
-  tem = test_completion (Ffield_string(ZV));
+  tem = test_completion (Ffield_string (make_number (ZV)));
   if (NILP (tem))
     {
       /* not an exact match */
@@ -1635,7 +1635,7 @@ do_completion ()
   last_exact_completion = completion;
   if (!NILP (last))
     {
-      tem = Ffield_string (ZV);
+      tem = Ffield_string (make_number (ZV));
       if (!NILP (Fequal (tem, last)))
        Fminibuffer_completion_help ();
     }
@@ -1760,10 +1760,10 @@ a repetition of this command will exit.")
   Lisp_Object val;
 
   /* Allow user to specify null string */
-  if (Ffield_beginning (ZV, Qnil) == ZV)
+  if (XINT (Ffield_beginning (make_number (ZV), Qnil)) == ZV)
     goto exit;
 
-  if (!NILP (test_completion (Ffield_string (ZV))))
+  if (!NILP (test_completion (Ffield_string (make_number (ZV)))))
     goto exit;
 
   /* Call do_completion, but ignore errors.  */
@@ -1811,7 +1811,7 @@ Return nil if there is no valid completion, else t.")
   /* We keep calling Fbuffer_string rather than arrange for GC to
      hold onto a pointer to one of the strings thus made.  */
 
-  completion = Ftry_completion (Ffield_string (ZV),
+  completion = Ftry_completion (Ffield_string (make_number (ZV)),
                                Vminibuffer_completion_table,
                                Vminibuffer_completion_predicate);
   if (NILP (completion))
@@ -1824,7 +1824,7 @@ Return nil if there is no valid completion, else t.")
     return Qnil;
 
 #if 0 /* How the below code used to look, for reference. */
-  tem = Ffield_string (ZV);
+  tem = Ffield_string (make_number (ZV));
   b = XSTRING (tem)->data;
   i = ZV - 1 - XSTRING (completion)->size;
   p = XSTRING (completion)->data;
@@ -1843,7 +1843,7 @@ Return nil if there is no valid completion, else t.")
     int buffer_nchars, completion_nchars;
 
     CHECK_STRING (completion, 0);
-    tem = Ffield_string (ZV);
+    tem = Ffield_string (make_number (ZV));
     GCPRO2 (completion, tem);
     /* If reading a file name,
        expand any $ENVVAR refs in the buffer and in TEM.  */
@@ -1896,7 +1896,7 @@ Return nil if there is no valid completion, else t.")
   }
 #endif /* Rewritten code */
   
-  prompt_end_charpos = Ffield_beginning (make_number (ZV), Qnil);
+  prompt_end_charpos = XINT (Ffield_beginning (make_number (ZV), Qnil));
 
   {
     int prompt_end_bytepos;
@@ -1910,7 +1910,7 @@ Return nil if there is no valid completion, else t.")
   if (i == XSTRING (completion)->size)
     {
       GCPRO1 (completion);
-      tem = Ftry_completion (concat2 (Ffield_string (ZV), build_string (" ")),
+      tem = Ftry_completion (concat2 (Ffield_string (make_number (ZV)), build_string (" ")),
                             Vminibuffer_completion_table,
                             Vminibuffer_completion_predicate);
       UNGCPRO;
@@ -1921,7 +1921,7 @@ Return nil if there is no valid completion, else t.")
        {
          GCPRO1 (completion);
          tem =
-           Ftry_completion (concat2 (Ffield_string (ZV), build_string ("-")),
+           Ftry_completion (concat2 (Ffield_string (make_number (ZV)), build_string ("-")),
                             Vminibuffer_completion_table,
                             Vminibuffer_completion_predicate);
          UNGCPRO;
@@ -2156,7 +2156,7 @@ DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_co
   Lisp_Object completions;
 
   message ("Making completion list...");
-  completions = Fall_completions (Ffield_string (ZV),
+  completions = Fall_completions (Ffield_string (make_number (ZV)),
                                  Vminibuffer_completion_table,
                                  Vminibuffer_completion_predicate,
                                  Qt);
index d56dcaf..6603525 100644 (file)
@@ -1118,7 +1118,7 @@ print_preprocess (obj)
       if (! NILP (Vprint_circle) || SYMBOLP (obj))
        {
          for (i = 0; i < print_number_index; i++)
-           if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj)
+           if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i), obj))
              {
                /* OBJ appears more than once.  Let's remember that.  */
                PRINT_NUMBER_STATUS (Vprint_number_table, i) = Qt;
@@ -1218,7 +1218,7 @@ print_object (obj, printcharfun, escapeflag)
          /* With the print-circle feature.  */
          int i;
          for (i = 0; i < print_number_index; i++)
-           if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj)
+           if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i), obj))
              {
                if (NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i)))
                  {
@@ -1506,7 +1506,7 @@ print_object (obj, printcharfun, escapeflag)
                      {
                        int i;
                        for (i = 0; i < print_number_index; i++)
-                         if (PRINT_NUMBER_OBJECT (Vprint_number_table, i) == obj)
+                         if (EQ (PRINT_NUMBER_OBJECT (Vprint_number_table, i), obj))
                            {
                              if (NILP (PRINT_NUMBER_STATUS (Vprint_number_table, i)))
                                {
index eda4199..34dcc7e 100644 (file)
@@ -218,7 +218,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
         XSTRING in those cases.  However, compile_pattern_1 is only
         applied to the cache entry we pick here to reuse.  So nil
         should never appear before a non-nil entry.  */
-      if (cp->regexp == Qnil)
+      if (NILP (cp->regexp))
        goto compile_it;
       if (XSTRING (cp->regexp)->size == XSTRING (pattern)->size
          && !NILP (Fstring_equal (cp->regexp, pattern))
index 5ee9428..eaac25c 100644 (file)
@@ -1893,7 +1893,7 @@ produce_special_glyphs (it, what)
   temp_it.dp = NULL;
   temp_it.what = IT_CHARACTER;
   temp_it.len = 1;
-  temp_it.object = 0;
+  temp_it.object = make_number (0);
   bzero (&temp_it.current, sizeof temp_it.current);
 
   if (what == IT_CONTINUATION)