X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;ds=inline;f=src%2Felhash.c;h=3e9aa756306c8c6091c5b988f4bf1c1d48cc7d96;hb=8169c5886ae90461017c67b917566d519600f285;hp=c4f64669828b3c40929ee010f95c847685f686cc;hpb=c879e5b17b3d5fef34ab58fc66e1cbb4269e5bb4;p=sxemacs diff --git a/src/elhash.c b/src/elhash.c index c4f6466..3e9aa75 100644 --- a/src/elhash.c +++ b/src/elhash.c @@ -29,13 +29,15 @@ along with this program. If not, see . */ #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" : "#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; - + } } }