1999-09-08  Jason Evans  <jasone@canonware.com>

	* src/thread.c (sem_timedwait): Add.

	* src/mem.c (mem_calloc): Don't initialize memory to 0xa5 bytes,
	since calloc() is supposed to return zeroed memory.
	(mem_set_oom_handler): Add.

1999-08-18  Jason Evans  <jasone@canonware.com>

	* test/c_libstash_a.c: Test whether libstash works correctly
	without calling libstash_init().

	* src/mem.c: Make mem methods safe to call with a NULL cw_mem_t
	pointer again.  This breakage was created by the race condition
	fixes made on 9 August 1999.

1999-08-12  Jason Evans  <jasone@canonware.com>

	* src/buf.c (buf_{g,s}et_uint{32,64}): Fix endianness problems.

	* include/libstash/treen.h (treen_new): Convert to treen_new() and
	treen_new_r().

	* include/libstash/oh.h (oh_new): Convert to oh_new() and oh_new_r().

	* include/libstash/list.h (list_new): Convert to list_new() and
	list_new_r().

	* include/libstash/buf.h (buf_new): Convert to buf_new() and
	buf_new_r().

	* include/libstash/bhp.h (bhp_new): Convert to bhp_new() and
	bhp_new_r().

	* src/buf.c (bufc_get_size): Add.

1999-08-09  Jason Evans  <jasone@canonware.com>

	* src/mem.c (mem_{m,c}alloc): Pass the key to oh_item_search()
	rather than the mem pointer.  This only affects the debug versions
	of libstash.
	(mem_{m,c,re}alloc, mem_free): Move the mem lock to encompass the
	calls to the malloc functions in order to avoid race conditions.
	This only affects the debug versions of libstash.

	* src/pezz.c (pezz_get_e): Pass the key to oh_item_search() rather
	than the pezz pointer.  This only affects the debug versions of
	libstash.

1999-07-31  Jason Evans  <jasone@canonware.com>

	* include/libstash/pezz.h (_cw_pezz_{get,put}): Add.  Use these
	macros instead of pezz_{get,put}(), except when passing function
	pointers around.  This allows the debugging versions of libstash
	to track pezz allocations (and leaks).

	* include/libstash/out.h: Add buf printing capability.

1999-07-30  Jason Evans  <jasone@canonware.com>

	* include/libstash/libstash.h: Add cw_fp{32,64,96,128}_t typedefs.

	* src/out.c: Rework internals significantly.  Performance is
	approximately 5 times better.  Tests now show the `out' printing
	performance to be within a factor of two of `log' (which is a
	simple printf wrapper).  Not much more performance can be squeezed
	out of `out'.  The remaining overhead is due to the generalized
	grammar of the format specifiers, which is necessary in order to
	provide a reasonable extensible interface.

	* include/libstash/out.h: Remove several specifier types.

1999-07-29  Jason Evans  <jasone@canonware.com>

	* configure.in (_LIBSTASH_MAX_IOV): Add lseek() call to fix test.
	The test previously worked on FreeBSD and Solaris, but not Linux.

	* src/out.c : Promote 1 and 2 byte va_list arguments to 4 bytes to
	avoid problems on (at least) Solaris.

	* configure.in (_LIBSTASH_MAX_IOV): Add test to detect the maximum
	iovec size compatible with readv()/writev().

	* : The `log' class is now deprecated.  The `out' class replaces it.

	* src/out.c (out_put_l): Add.
	(out_put_fl): Add.

1999-07-28  Jason Evans  <jasone@canonware.com>

	* src/libstash.c (libstash_init): Turn "pezz_error" dbg symbol on
	for the debugging versions of libstash.

	* src/log.c (log_l[e]printf): Use strftime() instead of manually
	building timestamp string for improved portability.

	* src/out.c (out_p_put_fvle): Use strftime() instead of manually
	building timestamp string for improved portability.

1999-07-26  Jason Evans  <jasone@canonware.com>

	* Makefile.{gnu,bsd}.in: Quiet noise caused by dependency updating.

1999-07-25  Jason Evans  <jasone@canonware.com>

	* src/mem.c (mem_[mc]alloc): Don't abort() if hash insertion fails
	due to the library user not consistently using the mem class for
	allocation.

	Add a mutex to the mem class to avoid race conditions when
	inserting and deleting keys in the hash table.

1999-07-21  Jason Evans  <jasone@canonware.com>

	* src/out.c (out_p_metric_int, out_p_render_int): Use modulus and
	division to generate text versions of integers, rather than the
	amazingly slow out_p_add()-based method.  This speeds up integer
	printing by approximatly two orders of magnitude.

1999-07-20  Jason Evans  <jasone@canonware.com>

	* src/out.c (spec_p_has_specifier): Return -1 if there is a '['
	anywhere in the string, since "[[" needs interpreted as well as
	specifiers.

	* src/res.c (res_dump): Add file mode argument to open() call.
	This bug was introduced by the conversion from `log' to `out'.

	* src/mem.c (mem_malloc, mem_calloc, mem_realloc): Fix error
	printing logic that caused erroneous allocation failure messages
	if libstash_init() hadn't been called.

1999-07-18  Jason Evans  <jasone@canonware.com>

	* : Convert use of log_*() to out_*().

1999-07-17  Jason Evans  <jasone@canonware.com>

	* test/c_out_a.c: Add unit tests for the out class.

1999-07-16  Jason Evans  <jasone@canonware.com>

	* : Add the out (extendible printf-alike) class.

1999-07-12  Jason Evans  <jasone@canonware.com>

	* src/oh.c (oh_item_delete, oh_item_search, oh_item_get_iterate,
	oh_item_delete_iterate): Deal gracefully with NULL r_* arguments.

1999-07-08  Jason Evans  <jasone@canonware.com>

	* src/bhp.c (bhp_del_min): Call bhpi_delete(), not _cw_free(),
	when cleaning up a bhpi instance.

1999-07-06  Jason Evans  <jasone@canonware.com>

	* src/bhp.c (bhp_delete): Delete the tree.

	* test/c_bhp_b.c: Add unit tests for the bhp class.

	* src/bhp.c (bhp_union): Don't try to delete a_b while owning its lock.

1999-06-20  Jason Evans  <jasone@canonware.com>

	* src/mq.c: Rewrite mq, using ring instead of list.

1999-06-18  Jason Evans  <jasone@canonware.com>

	* include/libstash/thread.h (thd_sigmask): Add.

1999-06-17  Jason Evans  <jasone@canonware.com>

	* include/libstash/oh.h: Remove unnecessary first parameter to the
	primary hashing function prototype.

	* include/libstash/buf.h : Modify the buf structure to include
	static arrays that are used unless the number of bufel's excedes
	the static arrays' size.  This makes buf_new() faster, since three
	malloc() calls are avoided.  It also avoids additional memory
	allocation for typical buf's, and improves cache locality.
	Finally, buf_new() cannot fail if space for the buf is passed in,
	which simplifies error handling.

	* src/mem.c (mem_calloc): Set the allocation size correctly, so
	that when setting "uninitialized" memory to 0xa5 bytes, valid data
	isn't overwritten.  This bug only occurred in the debug versions
	of libstash.

	* src/bhp.c: Binomial heaps are now functional.  Add bhpi_*()
	methods to facilitate cached allocation of heap node containers.
	Fix a number of locking bugs and convert from read/write locks to
	mutexes.  Completely rewrite bhp_p_merge().  Fix a recursion bug
	in bhp_p_dump().

	* src/mq.c: Add the mq (message queue) class.

1999-06-16  Jason Evans  <jasone@canonware.com>

	* include/libstash/thread.h (thd_yield): Add.

1999-06-15  Jason Evans  <jasone@canonware.com>

	* src/oh.c : When the items_ring or spares_ring becomes empty, set
	the pointer to NULL to avoid munging the two rings together.

1999-05-27  Jason Evans  <jasone@canonware.com>
	
	* src/buf.c (buf_{ap,pre}pend_bufc): Correctly set bufel magic.
	This only affects the debug versions of libstash.

1999-05-20  Jason Evans  <jasone@canonware.com>

	* src/buf.c : Eliminate the bufel class.  The bufel structure
	still exists, but is only used internally by buf.  All operations
	on bufel's that had methods are now inlined.

	Make API changes to buf to adjust to the lack of bufel
	(buf_{pre,ap}pend_bufel() --> buf_{pre,ap}pend_bufc()).

	Require calling of bufc_delete() even after prepending or
	appending to a buf.  This is necessary to ensure that the
	reference count for the bufc never reaches zero before the user is
	done using it explicitly.

1999-05-18  Jason Evans  <jasone@canonware.com>

	* include/libstash/buf.h : Remove bufpool.  pezz provides similar
	functionality, and has generally more desireable runtime
	characteristics.

1999-05-17  Jason Evans  <jasone@canonware.com>

	* src/pezz.c: Completely re-write the pezz class, such that all
	buffers are carved from blocks of memory, and new blocks are
	allocated as needed.  The previous implementation only used one
	block of memory, then resorted to individual buffer allocations
	once the block was fully utilized.

1999-05-10  Jason Evans  <jasone@canonware.com>

	* test/verify.in: Add.  verify.in provides support for regression
	testing as well as performance comparison between versions.

1999-05-03  Jason Evans  <jasone@canonware.com>

	* src/buf.c: Add buf_set_{uint{8,32,64},range}().

	* : Memory allocation is no longer guaranteed safe (NULL can be
	returned).  This makes it possible to catch memory errors and
	continue processing.  Many, many functions changed, including
	almost all class conststructors.

1999-04-28  Jason Evans  <jasone@canonware.com>

	* src/res.c: Remove static buffers.

	* src/mem.c: For the debug libraries, memset() newly allocated space
	to 0xa5, and newly freed memory to 0x5a.

	* src/buf.c (buf_p_get_data_position): Simplify (and improve
	performance of) the binary search code.

1999-04-16  Jason Evans  <jasone@canonware.com>

	* src/buf.c (buf_get_iovec): Add a_is_sys_iovec argument.

	* src/locks.c (jtl): Use a ring instead of a list.

	* src/oh.c: Use rings instead of lists.

1999-04-11  Jason Evans  <jasone@canonware.com>

	* src/pezz.c (pezz_get_buffer_size): Add.

	* src/buf.c (buf_p_get_data_position): Completely rewrite binary
	search to improve performance.

1999-04-10  Jason Evans  <jasone@canonware.com>

	* include/libstash/pezz.h (cw_pezz_t): Split memory buffers and
	ring elements into separate memory chunks to simplify memory
	management.

	* src/buf.c (buf_get_uint32): Fix endianness bug.
	(buf_get_uint64): Fix endianness bug.

	* include/libstash/buf.h (cw_buf_t): Split "array" into
	"bufel_array" and "cumulative_index".  For large data sets, this
	may improve cache locality of the binary search through the
	cumulative index.  Benchmarks show no slowdown for data sets that
	fit entirely in L2 cache.

	(cw_bufel_t): Add "bufc_buf" in order to decrease the amount of
	pointer chasing necessary when looking up data buffers.  This may
	improve performance for large data sets.  Benchmarks show no
	slowdown for data sets that fit entirely in L2 cache.

	* src/buf.c (buf_get_num_bufels): Add.
	(buf_p_get_data_position): Cache index of last bufel looked at
	with the hope that most lookups of buf data have some locality.
	Benchmarking shows this to typically improve lookup speeds by a
	factor of 2 to 5.

1999-04-09  Jason Evans  <jasone@canonware.com>

	* src/pezz.c: Add the pezz class.

	* src/oh.c (oh_item_delete): Deal with NULL pointer for a_key
	and/or a_data.
	(oh_item_search): Deal with NULL pointer for a_data.
	(oh_item_get_iterate): Deal with NULL pointer for a_data.
	(oh_item_delete_iterate): Deal with NULL pointer for a_data.
	(oh_h1_direct): Bit shift right until one 1 bit has been shifted
	out.  This should increase the variation for keys that tend to
	have lots of 0 bits at the low end, thus spreading distribution,
	at least with smaller hash tables.

	* configure.in: Add --disable-shared.

	* src/ring.c: Add the ring class.

1999-04-05  Jason Evans  <jasone@canonware.com>

	* src/buf.c (buf_get_uint32, buf_get_uint64): Don't try to deal
	with endianness.

	* include/libstash/libstash.h (_cw_ntohq, _cw_htonq): Swap words
	as well as bytes, if little endian.

1999-03-29  Jason Evans  <jasone@canonware.com>

	* src/list.c (list_catenate_list): Add.

1999-03-27  Jason Evans  <jasone@canonware.com>

	* src/oh.c (oh_h1_string): Add.  (Was private.)
	(oh_h1_direct): Add.
	(oh_key_compare_string): Add.  (Was private.)
	(oh_key_compare_direct): Add.

1999-03-26  Jason Evans  <jasone@canonware.com>

	* src/list.c (list_remove): Rename to list_remove_container().
	(list_remove_item): Add.

1999-03-25  Jason Evans  <jasone@canonware.com>

	* include/libstash/buf.h (bufc_set_buffer): Add const qualifier to
	a_buffer argument.

1999-03-24  Jason Evans  <jasone@canonware.com>

	* src/buf.c (buf_prepend_bufel): Don't try to append a bufel that
	has a NULL bufc pointer.

1999-03-22  Jason Evans  <jasone@canonware.com>

	* include/libstash/buf_p.h: Set _LIBSTASH_BUF_ARRAY_MIN_SIZE to 1
	in all cases.  Since the array grows exponentially and never
	shrinks, setting the array to a larger size potentially wastes
	space, and saves little effort.

1999-03-17  Jason Evans  <jasone@canonware.com>

	* include/libstash/libstash.h: Fix wretched hack to make TRUE and
	FALSE work.

1999-03-14  Jason Evans  <jasone@canonware.com>

	* src/list.c (list_get_next): Add.
	(list_get_prev): Add.

1999-03-10  Jason Evans  <jasone@canonware.com>

	* src/buf.c (buf_p_catenate_buf): Call buf_p_copy_array() with the
	same arguments in the optimized library as in the debug library
	(other than the extra argument).

1999-03-08  Jason Evans  <jasone@canonware.com>

	* src/buf.c (buf_get_uint8): Fix locking bug.
	(buf_get_uint32): Fix locking bug.
	(buf_get_uint64): Fix locking bug.
	(bufpool_delete): Fix memory leak (Delete the spare buffers list).

1999-03-07  Jason Evans  <jasone@canonware.com>

	* include/libstash/dbg.h (dbg_is_registered): Revert change made
	on 1999-03-01, since the change was not a valid approach, given
	what the dbg class is being used for.

1999-03-04  Jason Evans  <jasone@canonware.com>

	* src/buf.c (buf_p_catenate_buf): Fix an off-by-one bug that
	corrupted the array of a_a if bufel merging was successful.

	* include/libstash/libstash.h: Remove namespace mangling, since it
	serves little purpose, other than obfuscation and complexity.

	* src/buf.c (buf_p_copy_array): Add.  When copying parts of a
	buf's internal array, do one to three memcpy()'s, depending on
	position of the source and destination.  The previous
	implementation naively iterated through the array elements to
	copy, with one memcpy() per element.

1999-03-01  Jason Evans  <jasone@canonware.com>

	* src/mem.c : Add sophisticated logging and checking to the mem class.

	* include/libstash/buf.h : Add public interface for the bufc class.

1999-02-27  Jason Evans  <jasone@canonware.com>

	* include/libstash/dbg.h (dbg_is_registered): Compile to (FALSE)
	for non-debug libraries.

	* include/libstash/buf_p.h (_LIBSTASH_BUF_ARRAY_MIN_SIZE): Set to
	a more reasonable value (64).

1999-02-26  Jason Evans  <jasone@canonware.com>

	* src/buf.c : Complete testing.

1999-02-25  Jason Evans  <jasone@canonware.com>

	* src/mem.c : Add intelligence and logging to mem class that
	detects memory leaks due to never free()ing.

1999-02-24  Jason Evans  <jasone@canonware.com>

	* : Fully implement and partially test buf, bufel, and bufpool.

1999-02-22  Jason Evans  <jasone@canonware.com>

	* : Make libstash_init() and libstash_shutdown() optional.  Avoid
	a memory leak if libstash_init() is called multiple times.

	* : Structural changes to make libstash more friendly with other
	libraries, such as glib.  Change g_* to cw_g_* to avoid namespace
	collisions with glib.  Break libstash.h.in into libstash.h and
	libstash_defs.h.in to allow using #undef in libstash.h.  Make
	cw_bool_t work, even in the presence of cpp definitions of TRUE
	and/or FALSE.

1999-02-18  Jason Evans  <jasone@canonware.com>

	* Makefile: Change _STASH_* to _LIBSTASH_*.

1999-02-15  Jason Evans  <jasone@canonware.com>

	* Makefile.bsd.in : Add Makefile for BSD make.

1999-02-12  Jason Evans  <jasone@canonware.com>

	* src/buf.c: Major rewrite of buf and bufel.  Provide a more
	abstract interface to make using it less painful than before.
	Untested, and some functions unimplemented.

1999-02-03  Jason Evans  <jasone@canonware.com>

	* include/libstash/libstash.h.in (_cw_ntohq): Add.
	(_cw_htonq): Add.

	* src/buf.c (buf_rm_tail_bufel): Add.

1999-02-02  Jason Evans  <jasone@canonware.com>

	* test/c_buf_a.c: Add test for bufel_append_bufel().

	* src/buf.c (bufel_append_bufel): Add.

1999-01-13  Jason Evans  <jasone@canonware.com>

	* include/libstash/log.h: Use __FUNCTION__ in macros.

1999-01-12  Jason Evans  <jasone@canonware.com>

	* src/buf.c (bufel_set_size): Allow truncating a bufel with no
	valid data, even if the begin and end offsets need to be moved
	back.

1998-12-28  Jason Evans  <jasone@canonware.com>

	* : Convert "*_o" variables to "*".

1998-12-25  Jason Evans  <jasone@canonware.com>

	* src/log.c (log_nprintf): Add.

1998-12-04  Jason Evans  <jasone@canonware.com>

	* src/list.c (list_insert_after): Set the list's tail if inserting
	at the end of the list.
	: Use the list_item methods inside of list instead of mucking with
	list_item internals.

	* test/c_list_a.c: Add unit tests for the list_item and list
	public methods.

	* src/list.c (list_item_set): Remove pointer check for a_data.
	(list_delete): Stop trying to free what the data pointers point
	to, and delete the list_item's instead.

1998-12-03  Jason Evans  <jasone@canonware.com>

	* include/libstash/list.h (list_insert_before): Add.

1998-12-02  Jason Evans  <jasone@canonware.com>

	* src/list.c (list_delete): Fix a bug that caused a_list_o->count
	to be decremented twice each time an item was removed.

1998-11-30  Jason Evans  <jasone@canonware.com>

	* Makefile.in: Fold .d* and .o* dependency trees together.  This
	keeps dependency files from being built until an object file is
	built.  The dependency file is always up to date, except in the
	case where the object file would be rebuilt anyway, and this
	causes a rebuild of the dependency file, so everything is fine.
	(EXTRALIBS): Add @LDFLAGS@ to EXTRALIBS.
	(%): Suffix for CTESTS dependency file should be ".d".

1998-11-29  Jason Evans  <jasone@canonware.com>

	* src/locks.c: Added function comments.

	* src/buf.c (bufel_set_beg_offset): Add return value.
	(bufel_set_end_offset): Ditto.
	(bufel_set_size): Fixed an edge condition bug where TRUE was
	returned if (a_size == a_bufel->end_offset).
	(bufel_set_data_ptr): Allow a_buf to equal NULL.

1998-11-27  Jason Evans  <jasone@canonware.com>

	* src/bhp.c (bhp_dump): Implemented.  This needs to go away when
	debugging is complete, or else hooks need to be added for setting
	priority and data printing functions.
	(bhp_p_dump): Added in support of bhp_dump().

	* test/c_cnd_a.c: Don't rely on being able to lock a mutex in one
	thread and unlock it in another thread.

	* : Rename the tests to semi-meaningful names.

1998-11-23  Jason Evans  <jasone@canonware.com>

	* configure.in (CFLAGS): Added -lsocket -lnsl to LIBS for Solaris.

1998-11-22  Jason Evans  <jasone@canonware.com>

	* src/buf.c (bufel_set_data_ptr): Add so that a bufel can be
	handed a buffer and avoid copying.
	(bufel_get_valid_data_size): Add so that it doesn't require two
	funtion calls to determine how much valid data there is.

	* test/c19981014a.c: Get rid of the parts of the test that could
	potentially cause incorrect failures on big endian machines.

	* src/buf.c (bufel_[gs]et_uint8): Endianness shouldn't matter for
	byte access, so simplify the code and ignore endianness.

	* Makefile.in (clean): obj/*/*.p* never exists, so don't delete it.

	* src/lex.c: Clarify the documentation for the '|' character in
	regular expressions and fix a typo.
