Merge remote-tracking branch 'origin/master' into for-steve
[sxemacs] / src / elhash.c
index c4f6466..3e9aa75 100644 (file)
@@ -29,13 +29,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 #include "category.h"
 #include "seq.h"
 #include "dict.h"
+#include "ent/ent.h"
 
 Lisp_Object Qhash_tablep;
 static Lisp_Object Qhashtable, Qhash_table;
 static Lisp_Object Qweakness, Qvalue, Qkey_or_value, Qkey_and_value;
 static Lisp_Object Vall_weak_hash_tables;
 static Lisp_Object Qrehash_size, Qrehash_threshold;
-static Lisp_Object Q_size, Q_test, Q_weakness;
+static Lisp_Object Q_size, Q_weakness;
+Lisp_Object Q_test;
 static Lisp_Object Q_rehash_size, Q_rehash_threshold;
 
 /* obsolete as of 19990901 in xemacs-21.2 */
@@ -264,7 +266,6 @@ static void
 print_hash_table(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 {
        hash_table_t ht = XHASH_TABLE(obj);
-       char buf[128];
 
        write_c_string(print_readably ? "#s(hash-table" : "#<hash-table",
                       printcharfun);
@@ -283,23 +284,21 @@ print_hash_table(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 
        if (ht->count || !print_readably) {
                if (print_readably)
-                       sprintf(buf, " size %lu", (unsigned long)ht->count);
+                       write_fmt_str(printcharfun, " size %lu", (unsigned long)ht->count);
                else
-                       sprintf(buf, " size %lu/%lu",
-                               (unsigned long)ht->count,
-                               (unsigned long)ht->size);
-               write_c_string(buf, printcharfun);
+                       write_fmt_str(printcharfun, " size %lu/%lu",
+                                     (unsigned long)ht->count,
+                                     (unsigned long)ht->size);
        }
 
        if (ht->weakness != HASH_TABLE_NON_WEAK) {
-               sprintf(buf, " weakness %s",
-                       (ht->weakness == HASH_TABLE_WEAK ? "key-and-value" :
-                        ht->weakness == HASH_TABLE_KEY_WEAK ? "key" :
-                        ht->weakness == HASH_TABLE_VALUE_WEAK ? "value" :
-                        ht->weakness ==
-                        HASH_TABLE_KEY_VALUE_WEAK ? "key-or-value" :
-                        "you-d-better-not-see-this"));
-               write_c_string(buf, printcharfun);
+               write_fmt_str(printcharfun, " weakness %s",
+                             (ht->weakness == HASH_TABLE_WEAK ? "key-and-value" :
+                              ht->weakness == HASH_TABLE_KEY_WEAK ? "key" :
+                              ht->weakness == HASH_TABLE_VALUE_WEAK ? "value" :
+                              ht->weakness ==
+                              HASH_TABLE_KEY_VALUE_WEAK ? "key-or-value" :
+                              "you-d-better-not-see-this"));
        }
 
        if (ht->count)
@@ -307,10 +306,8 @@ print_hash_table(Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 
        if (print_readably)
                write_c_string(")", printcharfun);
-       else {
-               sprintf(buf, " 0x%x>", ht->header.uid);
-               write_c_string(buf, printcharfun);
-       }
+       else
+               write_fmt_str(printcharfun, " 0x%x>", ht->header.uid);
 }
 
 static void finalize_hash_table(void *header, int for_disksave)
@@ -1440,7 +1437,7 @@ void prune_weak_hash_tables(void)
                                                remhash_1(ht, entries, e);
                                                if (!HENTRY_CLEAR_P(e)) {
                                                        goto again;
-                                                       
+
                                                }
                                        }
                                }