Add arch tagline
[bpt/emacs.git] / src / fns.c
index 9f7e422..e0da65a 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1,7 +1,7 @@
 /* Random utility Lisp functions.
    Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997,
                  1998, 1999, 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007 Free Software Foundation, Inc.
+                 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -727,7 +727,10 @@ concat (nargs, args, target_type, last_special)
                thisindex++;
              }
            else
-             elt = AREF (this, thisindex++);
+             {
+               elt = AREF (this, thisindex);
+               thisindex++;
+             }
 
            /* Store this element into the result.  */
            if (toindex < 0)
@@ -737,7 +740,10 @@ concat (nargs, args, target_type, last_special)
                tail = XCDR (tail);
              }
            else if (VECTORP (val))
-             AREF (val, toindex++) = elt;
+             {
+               ASET (val, toindex, elt);
+               toindex++;
+             }
            else
              {
                CHECK_NUMBER (elt);
@@ -780,8 +786,8 @@ concat (nargs, args, target_type, last_special)
 }
 \f
 static Lisp_Object string_char_byte_cache_string;
-static int string_char_byte_cache_charpos;
-static int string_char_byte_cache_bytepos;
+static EMACS_INT string_char_byte_cache_charpos;
+static EMACS_INT string_char_byte_cache_bytepos;
 
 void
 clear_string_char_byte_cache ()
@@ -789,16 +795,16 @@ clear_string_char_byte_cache ()
   string_char_byte_cache_string = Qnil;
 }
 
-/* Return the character index corresponding to CHAR_INDEX in STRING.  */
+/* Return the byte index corresponding to CHAR_INDEX in STRING.  */
 
-int
+EMACS_INT
 string_char_to_byte (string, char_index)
      Lisp_Object string;
-     int char_index;
+     EMACS_INT char_index;
 {
-  int i_byte;
-  int best_below, best_below_byte;
-  int best_above, best_above_byte;
+  EMACS_INT i_byte;
+  EMACS_INT best_below, best_below_byte;
+  EMACS_INT best_above, best_above_byte;
 
   best_below = best_below_byte = 0;
   best_above = SCHARS (string);
@@ -853,14 +859,14 @@ string_char_to_byte (string, char_index)
 \f
 /* Return the character index corresponding to BYTE_INDEX in STRING.  */
 
-int
+EMACS_INT
 string_byte_to_char (string, byte_index)
      Lisp_Object string;
-     int byte_index;
+     EMACS_INT byte_index;
 {
-  int i, i_byte;
-  int best_below, best_below_byte;
-  int best_above, best_above_byte;
+  EMACS_INT i, i_byte;
+  EMACS_INT best_below, best_below_byte;
+  EMACS_INT best_above, best_above_byte;
 
   best_below = best_below_byte = 0;
   best_above = SCHARS (string);
@@ -924,7 +930,7 @@ string_make_multibyte (string)
      Lisp_Object string;
 {
   unsigned char *buf;
-  int nbytes;
+  EMACS_INT nbytes;
   Lisp_Object ret;
   USE_SAFE_ALLOCA;
 
@@ -958,7 +964,7 @@ string_to_multibyte (string)
      Lisp_Object string;
 {
   unsigned char *buf;
-  int nbytes;
+  EMACS_INT nbytes;
   Lisp_Object ret;
   USE_SAFE_ALLOCA;
 
@@ -1370,7 +1376,7 @@ The value is actually the tail of LIST whose car is ELT.  */)
      Lisp_Object list;
 {
   register Lisp_Object tail;
-  for (tail = list; !NILP (tail); tail = XCDR (tail))
+  for (tail = list; CONSP (tail); tail = XCDR (tail))
     {
       register Lisp_Object tem;
       CHECK_LIST_CONS (tail, list);
@@ -1421,7 +1427,7 @@ The value is actually the tail of LIST whose car is ELT.  */)
   if (!FLOATP (elt))
     return Fmemq (elt, list);
 
-  for (tail = list; !NILP (tail); tail = XCDR (tail))
+  for (tail = list; CONSP (tail); tail = XCDR (tail))
     {
       register Lisp_Object tem;
       CHECK_LIST_CONS (tail, list);
@@ -1741,7 +1747,7 @@ to be sure of changing the value of `foo'.  */)
     {
       Lisp_Object tail, prev;
 
-      for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail))
+      for (tail = seq, prev = Qnil; CONSP (tail); tail = XCDR (tail))
        {
          CHECK_LIST_CONS (tail, seq);
 
@@ -4239,7 +4245,7 @@ hash_clear (h)
        }
 
       for (i = 0; i < ASIZE (h->index); ++i)
-       AREF (h->index, i) = Qnil;
+       ASET (h->index, i, Qnil);
 
       h->next_free = make_number (0);
       h->count = 0;
@@ -4779,12 +4785,13 @@ DEFUN ("hash-table-p", Fhash_table_p, Shash_table_p, 1, 1, 0,
 
 
 DEFUN ("clrhash", Fclrhash, Sclrhash, 1, 1, 0,
-       doc: /* Clear hash table TABLE.  */)
+       doc: /* Clear hash table TABLE and return it.  */)
      (table)
      Lisp_Object table;
 {
   hash_clear (check_hash_table (table));
-  return Qnil;
+  /* Be compatible with XEmacs.  */
+  return table;
 }
 
 
@@ -5200,9 +5207,10 @@ invoked by mouse clicks and mouse menu items.  */);
 
   DEFVAR_BOOL ("use-file-dialog", &use_file_dialog,
     doc: /* *Non-nil means mouse commands use a file dialog to ask for files.
-This applies to commands from menus and tool bar buttons.  The value of
-`use-dialog-box' takes precedence over this variable, so a file dialog is only
-used if both `use-dialog-box' and this variable are non-nil.  */);
+This applies to commands from menus and tool bar buttons even when
+they are initiated from the keyboard.  The value of `use-dialog-box'
+takes precedence over this variable, so a file dialog is only used if
+both `use-dialog-box' and this variable are non-nil.  */);
   use_file_dialog = 1;
 
   defsubr (&Sidentity);