CHips L MINI SHELL

CHips L pro

Current Path : /usr/share/doc/libnih-1.0.1/
Upload File :
Current File : //usr/share/doc/libnih-1.0.1/ChangeLog

2010-02-04  Scott James Remnant  <scott@netsplit.com>

	* NEWS: Release 1.0.1

	* nih/logging.c (__abort_msg): Make a weak symbol reference.
	(nih_log_abort_message): Check whether __abort_msg has an address
	before saving.
	* nih/tests/test_logging.c (__abort_msg): Make a weak symbol reference.
	(test_log_message): Skip __abort_msg tests if there is no address
	for it.

2010-02-03  Scott James Remnant  <scott@netsplit.com>

	* nih/libnih.ver: Add missing export for __nih_* so you can build
	test cases; not bumping the library age here since this isn't an API
	change but a bug.

	* nih-dbus-tool/Makefile.am ($(com_netsplit_Nih_Test_object_OUTPUTS)):
	($(com_netsplit_Nih_Test_proxy_OUTPUTS)): Make compatible with
	am-silent-rules by using $(AM_V_GEN) and combining the mkdir and
	nih-dbus-tool lines.

	* configure.ac: Bump copyright year to 2010.
	* NEWS: Begin new release.

2009-11-29  Scott James Remnant  <scott@netsplit.com>

	* configure.ac (AM_INIT_AUTOMAKE): Drop dist-bzip2, since we don't
	use them.

	* configure.ac: Bump version to 1.0.1

2009-11-28  Scott James Remnant  <scott@netsplit.com>

	* NEWS: Release 1.0.0

	* nih-dbus-tool/main.c (source_file_path, header_file_path): Use a
	not reached assertion rather than an initial one, to avoid gcc
	warnings.
	* nih/tests/test_string.c (test_array_addp),
	* nih/tests/test_logging.c (test_log_message): Add a couple more
	initialisations for gcc, found with -O2

	* TODO: Update.

	* nih/tests/test_error.c (test_raise_error, test_pop_context): Also
	unlink core.PID form of core file, and unlink a valgrind core of the
	same name as well while we're in there.
	* nih/tests/test_child.c (test_poll): Do the same here, except it
	turns out that under valgrind we might still have NIH_CHILD_KILLED
	but a core file - always clean up core files anyway.

	* nih/libnih.supp, nih-dbus/libnih-dbus.supp: Valgrind got a whole
	bunch more strict in the 3.5 release.  That's a good thing because
	we catch more errors, but it means it's somewhat picker about things
	like our reference allocations.  Redo the suppressions against 3.5,
	taking an opportunity to clean up the files and insert documentation
	as to why they are there.
	* nih/tests/test_signal.c (test_poll): The two signal structures
	allocated in this function were not being freed at the end.
	* nih/tests/test_watch.c (test_reader): On termination of this test
	we were not freeing the last path copied.
	* nih-dbus/tests/test_dbus_connection.c (test_connect, test_bus)
	(test_setup): Free signal handlers before exiting the child,
	unlike other test cases we can't make these children of any other
	object since we don't actually have one!
	* nih-dbus-tool/tests/test_annotation.c (test_start_tag)
	(test_end_tag): Missing call to discard the NULL reference from the
	various objects after pushing onto the stack.
	* nih-dbus-tool/tests/test_parse.c (test_stack_push): Thanks to
	the updated valgrind, I can now see that this test case wasn't updated
	for the new nih_alloc() behaviour.  We now need to free the object
	even after it's been referenced, because it still has our NULL
	reference.
	(test_start_tag, test_end_tag): Also need to discard the NULL
	reference in each of these cases.

2009-11-24  Scott James Remnant  <scott@netsplit.com>

	* nih/logging.c (nih_log_message): Split the abort message saving
	out into its own function.
	(nih_log_abort_message): This makes it easier to suppress.
	* nih/libnih.supp: Add suppressions.

	* NEWS: Update.

	* nih/libnih.supp: Add new tmpfile suppression

	* nih-dbus-tool/interface.c (interface_proxy_get_all_function),
	* nih-dbus-tool/method.c (method_proxy_function),
	* nih-dbus-tool/property.c (property_proxy_get_function)
	(property_proxy_set_function): The dbus_connection_send_with_reply()
	function can return TRUE without setting a pending_call in the case
	of a non-connected connection.  Convert this into the
	DBUS_ERROR_DISCONNECTED error to match send_with_reply_and_block
	* nih-dbus-tool/tests/test_interface.c (test_proxy_get_all_function),
	* nih-dbus-tool/tests/test_method.c (test_proxy_function),
	* nih-dbus-tool/tests/test_property.c (test_proxy_get_function)
	(test_proxy_set_function),
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_ordinary_method)
	(test_nameless_method, test_async_method, test_byte_to_str)
	(test_str_to_byte, test_boolean_to_str, test_str_to_boolean)
	(test_int16_to_str, test_str_to_int16, test_uint16_to_str)
	(test_str_to_uint16, test_int32_to_str, test_str_to_int32)
	(test_uint32_to_str, test_str_to_uint32, test_int64_to_str)
	(test_str_to_int64, test_uint64_to_str, test_str_to_uint64)
	(test_double_to_str, test_str_to_double)
	(test_object_path_to_str, test_str_to_object_path)
	(test_signature_to_str, test_str_to_signature)
	(test_struct_to_str, test_str_to_struct)
	(test_int32_array_to_str, test_str_to_int32_array)
	(test_str_array_to_str, test_str_to_str_array)
	(test_int32_array_array_to_str, test_str_to_int32_array_array)
	(test_struct_array_to_str, test_str_to_struct_array)
	(test_dict_entry_array_to_str, test_str_to_dict_entry_array)
	(test_get_byte, test_set_byte, test_get_boolean)
	(test_set_boolean, test_get_int16, test_set_int16)
	(test_get_uint16, test_set_uint16, test_get_int32)
	(test_set_int32, test_get_uint32, test_set_uint32)
	(test_get_int64, test_set_int64, test_get_uint64)
	(test_set_uint64, test_get_double, test_set_double)
	(test_get_string, test_set_string, test_get_object_path)
	(test_set_object_path, test_get_signature, test_set_signature)
	(test_get_structure, test_set_structure, test_get_int32_array)
	(test_set_int32_array, test_get_str_array, test_set_str_array)
	(test_get_int32_array_array, test_set_int32_array_array)
	(test_get_struct_array, test_set_struct_array)
	(test_get_dict_entry_array, test_set_dict_entry_array)
	(test_get_all): Add test cases for sending to a disconnected
	connection and getting the error reply back straight away.
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_structure.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_array.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_structure.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_array.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_standard.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_structure.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_methods.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_signals.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_properties.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_only_properties.c:
	Update expected function output to match.
	* nih-dbus-tool/tests/test_interface.c (test_proxy_get_all_sync_function),
	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function),
	* nih-dbus-tool/tests/test_property.c (test_proxy_get_sync_function)
	(test_proxy_set_sync_function),
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_ordinary_method_sync)
	(test_nameless_method_sync, test_async_method_sync)
	(test_byte_to_str_sync, test_str_to_byte_sync)
	(test_boolean_to_str_sync, test_str_to_boolean_sync)
	(test_int16_to_str_sync, test_str_to_int16_sync)
	(test_uint16_to_str_sync, test_str_to_uint16_sync)
	(test_int32_to_str_sync, test_str_to_int32_sync)
	(test_uint32_to_str_sync, test_str_to_uint32_sync)
	(test_int64_to_str_sync, test_str_to_int64_sync)
	(test_uint64_to_str_sync, test_str_to_uint64_sync)
	(test_double_to_str_sync, test_str_to_double_sync)
	(test_object_path_to_str_sync, test_str_to_object_path_sync)
	(test_signature_to_str_sync, test_str_to_signature_sync)
	(test_struct_to_str_sync, test_str_to_struct_sync)
	(test_int32_array_to_str_sync, test_str_to_int32_array_sync)
	(test_str_array_to_str_sync, test_str_to_str_array_sync)
	(test_int32_array_array_to_str_sync)
	(test_str_to_int32_array_array_sync)
	(test_struct_array_to_str_sync, test_str_to_struct_array_sync)
	(test_dict_entry_array_to_str_sync)
	(test_str_to_dict_entry_array_sync, test_get_byte_sync)
	(test_set_byte_sync, test_get_boolean_sync)
	(test_set_boolean_sync, test_get_int16_sync)
	(test_set_int16_sync, test_get_uint16_sync)
	(test_set_uint16_sync, test_get_int32_sync, test_set_int32_sync)
	(test_get_uint32_sync, test_set_uint32_sync)
	(test_get_int64_sync, test_set_int64_sync, test_get_uint64_sync)
	(test_set_uint64_sync, test_get_double_sync)
	(test_set_double_sync, test_get_string_sync)
	(test_set_string_sync, test_get_object_path_sync)
	(test_set_object_path_sync, test_get_signature_sync)
	(test_set_signature_sync, test_get_structure_sync)
	(test_set_structure_sync, test_get_int32_array_sync)
	(test_set_int32_array_sync, test_get_str_array_sync)
	(test_set_str_array_sync, test_get_int32_array_array_sync)
	(test_set_int32_array_array_sync, test_get_struct_array_sync)
	(test_set_struct_array_sync, test_get_dict_entry_array_sync)
	(test_set_dict_entry_array_sync, test_get_all_sync):
	Add test cases for a sync() function on a disconnected connection,
	which should return the same error internally inside D-Bus.

	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c: These
	tests weren't passing under valgrind, because I got lazy and gave
	up.  Most of the reason was that the main signal handler wasn't
	freed; fix that by attaching the signal to the D-Bus object.

	* nih/test_process.h (TEST_CHILD, TEST_CHILD_WAIT): Flush standard
	output and error before forking, to avoid the typical strange
	buffering issues when piping to less.

	* nih/alloc.c (NihAllocCtx): The recent alignment changes mean
	there's always 4 bytes of spare space in this structure, use those
	to remember the allocation size rather than relying on malloc()
	to do it.  This makes us more portable to alternative (and debugging)
	malloc implementations.
	(nih_alloc, nih_realloc): Update the size field
	(nih_alloc_size): Just return the size field.

	* TODO: Update.

2009-11-21  Scott James Remnant  <scott@netsplit.com>

	* nih/option.c: Add a note that --debug is deliberately hidden.

	* nih/macros.h (NIH_ALIGN_SIZE): Fix rounding to be twice size
	of size_t, or alignment of long long - which is what we decided
	in the bug.
	* nih/alloc.c (NIH_ALLOC_SIZE): Formatting.

	* nih/Makefile.am (libnih_la_LDFLAGS): Bump version
	* nih-dbus/Makefile.am (libnih_dbus_la_LDFLAGS): Bump version

	* configure.ac (AC_PRERQ): Update to 2.62
	(AM_INIT_AUTOMAKE): Update to 1.11, add color-tests and silent-rules
	to the options
	(AM_SILENT_RULES): Explicitly make silent rules the default
	(AM_MAINTAINER_MODE): Add, but with "enable" as the default, so
	distributions may turn it off with --disable-maintainer-mode
	(AM_GNU_GETTEXT_VERSION): Update to 0.17
	* HACKING: Update requirements; document that we support the
	standard options.

2009-11-21  John Cater  <katre50@gmail.com>

	* nih/macros.h (NIH_ALIGN_SIZE): Add macro to guess at the maximum
	alignment of a type
	* nih/alloc.c (NIH_ALLOC_SIZE): Define the size of the context
	based off its size and the maximum alignment macro, thus hopefully
	ensuring the following pointer is generically aligned
	(NIH_ALLOC_CTX, NIH_ALLOC_PTR): Redefine based on NIH_ALLOC_SIZE
	(nih_alloc, nih_realloc, nih_alloc_size): Use NIH_ALLOC_SIZE
	instead of sizeof (NihAllocCtx)

2009-11-21  Scott James Remnant  <scott@netsplit.com>

	* NEWS: Update

	* nih-dbus-tool/main.c: Add option to supply the package name
	and store in a global variable for the output code to access.
	* nih-dbus-tool/output.c (output_preamble): Use the supplied package
	name in preference to "libnih" when generating preamble comments.
	(output_sentinel): Use the supplied package name in preference to
	"libnih" when generating header sentinels.
	* nih-dbus-tool/output.h: Add variable declaration
	* m4/Makefile.am (nih_dbus_tool_LDADD): Turns out that this doesn't
	link with libnih-dbus at all

	* nihify: Remove the script to copy into other source directories

	* nih/libnih.ver, nih-dbus/libnih-dbus.ver: Update versions

	* nih-dbus-tool/Makefile.am (bin_PROGRAMS): Always install the tool
	(dist_man_MANS): Always install the manual page
	(EXTRA_DIST): We don't need to distribute the manual page with this
	now

	* nih/libnih.pc.in, nih-dbus/libnih-dbus.pc.in: Source to pkg-config
	data files
	* configure.ac: Generate the actual pkg-config files from the sources
	* nih/Makefile.am (lib_LTLIBRARIES): Always install libnih.la
	(include_HEADERS): Always install the header files
	(pkgconfig_DATA): Install the pkg-config file
	(EXTRA_DIST): Distribute the source to it
	* nih-dbus/Makefile.am (lib_LTLIBRARIES): Always install libnih-dbus.la
	(include_HEADERS): Always install the header files
	(pkgconfig_DATA): Install the pkg-config file
	(EXTRA_DIST): Distribute the source to it

	* Makefile.am: Always build libnih-dbus and nih-dbus-tool

	* m4/misc.m4, m4/compiler.m4, m4/linker.m4: Merge together into
	a single libnih.m4 file for easier aclocal inclusion.
	* m4/libnih.m4 (NIH_INIT): Drop this macro, libnih shouldn't need
	software to call any special macros other than the ones they
	probably need anyway.
	* m4/libs.m4: Drop this source and the NIH_LIB_DBUS macro, since
	we'll always build this
	* m4/Makefile.am: Unconditionally install the new macro file
	* configure.ac: Replace NIH_INIT with the bits we actually want to
	check for here.

	* README: Remove the usage instructions, since this is going to
	be an ordinary shared library; rewrite the Dependencies section
	language to be better; add a Cross-compiling section.

	* configure.ac: Since this library is now being used in several
	places, it's time to start caring about API and stop compiling it
	statically into things.  Bump version to 1.0.0.  Bug fixes without
	any API changes will be named 1.0.x; backwards compatible API
	changes 1.x.0, etc.
	* NEWS: Bump version to 1.0.0
	* TODO: Update with missing bits for 1.0 and plans for 1.1/2.0

2009-10-03  Scott James Remnant  <scott@netsplit.com>

	* m4/libs.m4 (NIH_LIB_DBUS): Allow an external nih-dbus-tool to
	be used by setting NIH_DBUS_TOOL when calling configure; when
	cross-compiling, if this is not set, look for it in the PATH and
	warn if we fall back to using our built copy.
	* nih-dbus-tool/Makefile.am ($(com_netsplit_Nih_Test_object_OUTPUTS)): 
	($(com_netsplit_Nih_Test_proxy_OUTPUTS)): Use an externally built
	nih-dbus-tool for the tests if given, not strictly right but the
	best we can do when cross-compiling (when we probably won't run
	"make check" anyway)

	* nih/file.c (nih_dir_walk_sort): Add static function to replace
	alphasort() which we can't call anymore.  It would be deeply ironic
	to bitch about glibc breaking API in the libnih changelog.
	(nih_dir_walk_scan): Replace alphasort() with nih_dir_walk_sort()

2009-08-11  Johan Kiviniemi  <johan@kiviniemi.name>

	* nih/logging.c: Expose the glibc-internal __abort_msg symbol
	so that we can set it.
	(nih_log_message): Save a copy of any fatal or higher log message
	into this variable; assuming that abort() is the next function call
	as is the case for nih_assert()

2009-08-11  Scott James Remnant  <scott@netsplit.com>

	* nih/test_alloc.h (TEST_ALLOC_NOT_PARENT): Add the opposite test
	for a known parent, making sure that something is not a parent.

2009-08-04  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_alloc.c (test_ref, test_unref): Add tests for
	multiple identical parents.
	* nih/alloc.h: Document that we specifically permit multiple
	references between two objects.

	* configure.ac: 0.4.0 is a bit far, and the nih_alloc() changes are
	largely minor in effect outside the library; let's call this 0.3.5
	* NEWS: Change version

	* nih-dbus-tool/node.c (node_start_tag): Make node object local.
	(node_end_tag): Replace use of nih_unref_only with a simple
	nih_ref()/nih_unref() pair
	* nih-dbus-tool/interface.c (interface_start_tag): Make interface
	object local
	* nih-dbus-tool/method.c (method_start_tag): Make method object
	local.
	* nih-dbus-tool/signal.c (signal_start_tag): Make signal object
	local.
	* nih-dbus-tool/argument.c (argument_start_tag): Make argument
	object local.
	* nih-dbus-tool/property.c (property_start_tag): Make property
	object local.
	* nih-dbus-tool/tests/test_type.c (test_of): Replace
	TEST_ALLOC_ORPHAN(ptr) with TEST_ALLOC_PARENT(ptr, NULL)
	* nih-dbus-tool/tests/test_demarshal.c (test_demarshal): Replace
	TEST_ALLOC_ORPHAN(ptr) with TEST_ALLOC_PARENT(ptr, NULL)
	* nih-dbus-tool/tests/test_node.c (test_end_tag): 
	Replace TEST_ALLOC_ORPHAN(ptr) with TEST_ALLOC_PARENT(ptr, NULL)
	(test_start_tag, test_end_tag): Discard stack objects after pushing
	* nih-dbus-tool/tests/test_interface.c (test_start_tag)
	(test_end_tag): Discard stack objects after pushing
	* nih-dbus-tool/tests/test_method.c (test_start_tag)
	(test_end_tag): Discard stack objects after pushing
	* nih-dbus-tool/tests/test_signal.c (test_start_tag)
	(test_end_tag): Discard stack objects after pushing
	* nih-dbus-tool/tests/test_property.c (test_start_tag)
	(test_end_tag): Discard stack objects after pushing
	* nih-dbus-tool/tests/test_argument.c (test_start_tag)
	(test_end_tag): Discard stack objects after pushing

	* nih/io.c (nih_io_read_message): Replace use of nih_unref_only
	with a simple nih_ref()/nih_unref() pair
	(nih_io_write): Use nih_local for the message, we either reference
	it when we send or we throw it away on returning.
	* nih/tests/test_io.c (test_watcher): After sending the message
	we need to discard it, it's only referenced not stolen now.
	(test_read_message): Replace TEST_ALLOC_ORPHAN(msg) with
	TEST_ALLOC_PARENT(msg, NULL)

	* nih/tests/test_string.c (test_sprintf, test_vsprintf)
	(test_strdup, test_strndup): Replace TEST_ALLOC_ORPHAN(ptr)
	checks with TEST_ALLOC_PARENT(ptr, NULL)
	(test_array_addp): Fix bad uses of TEST_ALLOC_FAIL on data
	allocated outside of the loop, necessary now that the pointer
	won't be "stolen" by the function merely referenced

	* nih/alloc.c (nih_alloc_ref_new): Allow parent to be NULL, when
	it is we store NULL in ref->parent and leave the children_entry
	as an empty list node.
	(NIH_ALLOC_CTX): Context for a NULL pointer is NULL
	(nih_alloc): Always allocate a reference, even when the parent is
	NULL creating a NULL ref
	(nih_discard): Lookup a NULL reference and free that before checking
	for existing references.
	(nih_ref, nih_unref, nih_alloc_ref_lookup): Allow parent to be NULL
	(nih_unref_only): We don't need this function anymore so drop
	(nih_alloc_parent): Since NULL can be a parent, this now looks
	that up - there's no function for "has a parent"
	* nih/alloc.h: Remove nih_unref_only prototype, update documentation
	* nih/test_alloc.h (TEST_ALLOC_PARENT): Update documentation to
	reflect that NULL is valid again
	(TEST_ALLOC_ORPHAN): Drop this macro.
	* nih/tests/test_alloc.c (test_new, test_alloc, test_realloc):
	Replace TEST_ALLOC_ORPHAN checks with TEST_ALLOC_PARENT (ptr, NULL)
	(test_ref): Make sure that the NULL reference is not removed by
	adding another; add new test for adding a new NULL reference.
	(test_unref): Add tests for removing the NULL reference and
	freeing or leaving the object.
	(test_parent): Add test for looking up NULL Parent
	* nih/libnih.supp: Add suppressions for nih_alloc_ref_new in the
	appropriate places.
	* NEWS: Update

2009-08-03  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_set_string_sync)
	(test_set_object_path_sync, test_set_signature_sync): Fix the incorrect
	parent tests to actually check for the specific parent rather than
	just a parent.

2009-08-02  Scott James Remnant  <scott@netsplit.com>

	* configure.ac: Bump version to 0.4.0
	* NEWS: Begin new release

	* NEWS: Release 0.3.2

2009-07-29  Michael Biebl  <mbiebl@gmail.com>

	* nih/child.h: Remove unnecessary sys/ptrace.h and linux/ptrace.h
	headers, that prevent compilation on ia64.

2009-07-22  Michael Biebl  <mbiebl@gmail.com>

	* nih-dbus-tool/Makefile.am (dist_man_MANS): Don't install the
	manpages unless INSTALL_NIH, take care to make sure they're still
	distributed.

2009-07-15  Scott James Remnant  <scott@netsplit.com>

	* m4/libs.m4 (NIH_LIB_DBUS): Now that D-Bus 1.2.16 proper has been
	released, update our version requirements to that.
	* README: Update documentation.

2009-07-14  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_main.c (test_init): Add a test for being called
	as a login shell.
	* nih/main.c (nih_main_init_full): Check for and skip initial dash.

2009-07-11  Scott James Remnant  <scott@netsplit.com>

	* configure.ac: Bump version to 0.3.2
	* NEWS: Begin new release

2009-07-09  Scott James Remnant  <scott@netsplit.com>

	* NEWS: Release 0.3.1

	* m4/libs.m4 (NIH_LIB_DBUS): Increase D-Bus dependency to current
	GIT HEAD (1.2.15)
	* README: Update documentation.
	* NEWS: Note the change.

	* nih-dbus-tool/demarshal.c (demarshal_array): Always initialise
	all arrays to NULL first, and then only allocate the arrays after
	to avoid gcc's uninitialised warnings.
	* nih-dbus-tool/tests/test_demarshal.c (test_demarshal): Update
	expected output to match
	* nih-dbus-tool/tests/expected/test_method_proxy_notify_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_notify_function_array.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_no_input.c:
	Update the method tests expected output too

	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c (test_new_struct_array)
	(test_new_dict_entry_array): Initialise alloc-safe variables to
	NULL to avoid gcc warning

	* nih-dbus/dbus_connection.c (nih_dbus_timeout_toggled): Use the
	monotonic clock to recalculate the timer
	* nih-dbus/Makefile.am (libnih_dbus_la_LIBS): Rename to _LIBADD
	(libnih_dbus_la_LIBADD): Link with librt

	* nih/timer.c (nih_timer_add_timeout, nih_timer_add_periodic)
	(nih_timer_poll): Use a monotonic clock for timers, not the realtime
	clock.
	* nih/main.c (nih_main_loop): Calculate select time based on the
	monotonic clock.
	* nih/Makefile.am (libnih_la_LIBADD): Link with librt

	* README: Bump the recommended D-Bus

2009-07-08  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c (nih_dir_walk_scan): Should compare against DT_DIR
	not use S_ISDIR

	* NEWS: Update.

	* nih/file.h (NihFileFilter): Add an is_dir argument
	* nih/file.c (nih_dir_walk_scan): Pass the new argument
	* nih/watch.c (nih_watch_handle): Pass the extra argument
	* nih/tests/test_file.c (my_filter): Add the extra argument but
	ignore
	* nih/tests/test_watch.c (my_filter): Add here too

2009-07-03  Scott James Remnant  <scott@netsplit.com>

	* nih/error.h (NihError): Declare this a slightly odd way to
	permit the members to be directly embedded in sub-classes rather
	than referring back through an accessor variable.
	* nih-dbus/dbus_error.h (nih_dbus_error): Embed the NihError
	members directly using the new macro.
	* nih-dbus/dbus_error.c (nih_dbus_error_raise)
	(nih_dbus_error_raise_printf): Just set number and message directly;
	cast before raising.
	* nih-dbus/dbus_object.c (nih_dbus_object_property_get)
	(nih_dbus_object_property_get_all, nih_dbus_object_property_set): 
	Access message through the dbus_err cast.
	* nih-dbus/tests/test_dbus_error.c (test_error_raise)
	(test_error_raise_printf): Test directly accessing the number
	and message.

2009-07-02  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/tests/test_dbus_proxy.c (test_connect): We can end up
	with a lot of stray signals with these tests, so open and close
	the connections for each one.

	* NEWS: Update.
	* TODO: Update.

	* nih-dbus-tool/interface.c (interface_proxy_get_all_function)
	(interface_proxy_get_all_sync_function),
	* nih-dbus-tool/method.c (method_proxy_function)
	(method_proxy_sync_function),
	* nih-dbus-tool/property.c (property_proxy_get_function)
	(property_proxy_set_function, property_proxy_get_sync_function)
	(property_proxy_set_sync_function): Set the auto_start flag in
	new method calls that we create.
	* tests/expected/test_interface_proxy_get_all_function_standard.c,
	* tests/expected/test_interface_proxy_get_all_sync_function_standard.c,
	* tests/expected/test_interface_proxy_get_all_sync_function_structure.c,
	* tests/expected/test_method_proxy_function_array.c,
	* tests/expected/test_method_proxy_function_deprecated.c,
	* tests/expected/test_method_proxy_function_no_args.c,
	* tests/expected/test_method_proxy_function_standard.c,
	* tests/expected/test_method_proxy_function_structure.c,
	* tests/expected/test_method_proxy_sync_function_array_input.c,
	* tests/expected/test_method_proxy_sync_function_deprecated.c,
	* tests/expected/test_method_proxy_sync_function_no_args.c,
	* tests/expected/test_method_proxy_sync_function_no_input.c,
	* tests/expected/test_method_proxy_sync_function_no_output.c,
	* tests/expected/test_method_proxy_sync_function_standard.c,
	* tests/expected/test_method_proxy_sync_function_structure_input.c,
	* tests/expected/test_method_proxy_sync_function_structure_output.c,
	* tests/expected/test_property_proxy_get_function_standard.c,
	* tests/expected/test_property_proxy_get_function_deprecated.c,
	* tests/expected/test_property_proxy_get_sync_function_standard.c,
	* tests/expected/test_property_proxy_get_sync_function_structure.c,
	* tests/expected/test_property_proxy_get_sync_function_deprecated.c,
	* tests/expected/test_property_proxy_set_function_standard.c,
	* tests/expected/test_property_proxy_set_function_structure.c,
	* tests/expected/test_property_proxy_set_function_array.c,
	* tests/expected/test_property_proxy_set_function_deprecated.c,
	* tests/expected/test_property_proxy_set_sync_function_standard.c,
	* tests/expected/test_property_proxy_set_sync_function_structure.c,
	* tests/expected/test_property_proxy_set_sync_function_array.c,
	* tests/expected/test_property_proxy_set_sync_function_deprecated.c,
	* tests/expected/test_node_proxy_functions_standard.c,
	* tests/expected/test_node_proxy_functions_no_methods.c,
	* tests/expected/test_node_proxy_functions_no_signals.c,
	* tests/expected/test_node_proxy_functions_no_properties.c,
	* tests/expected/test_node_proxy_functions_only_properties.c,
	* tests/expected/test_node_proxy_functions_structure.c,
	* tests/expected/test_output_proxy_standard.c:
	Update expected output.
	
	* nih-dbus/dbus_proxy.h (NihDBusProxy): Add an auto_start member
	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_new): Initialise auto_start
	member to TRUE (the D-Bus default).
	* nih-dbus/tests/test_dbus_proxy.c (test_new): Add checks for
	auto-start being TRUE.
	* nih-dbus-tool/signal.c (signal_proxy_function): Look up connection
	and path through the proxy object; if the proxy object has a name,
	compare the signal sender against the OWNER of that name, not the
	name.
	* nih-dbus-tool/tests/test_signal.c (test_proxy_function): Drop
	parent argument from calls to nih_dbus_proxy_connect.  Add test
	cases for signal catching on peer-to-peer and well-known name (we
	were previously just using unique).
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_new_byte)
	(test_new_boolean, test_new_int16, test_new_uint16)
	(test_new_int32, test_new_uint32, test_new_int64)
	(test_new_uint64, test_new_double, test_new_string)
	(test_new_object_path, test_new_signature, test_new_struct)
	(test_new_int32_array, test_new_str_array)
	(test_new_int32_array_array, test_new_struct_array)
	(test_new_dict_entry_array): Drop the parent argument from calls
	to nih_dbus_proxy_connect
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_standard.c,
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_structure.c,
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_standard.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_methods.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_properties.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_structure.c,
	* nih-dbus-tool/tests/expected/test_output_proxy_standard.c:
	Update expected output

	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_new): Track the name whenever
	one is given, not just when we have a lost handler.
	(nih_dbus_proxy_name_track): lost_handler is not compulsory
	(nih_dbus_proxy_name_owner_changed): Make the lost handler optional
	(nih_dbus_proxy_destroy): name tracking must be cleaned up when
	there's a name, not a lost handler
	* nih-dbus/tests/test_dbus_proxy.c (test_name_owner_changed): Add
	tests for both well-known and unique names with both being tracked.
	(test_name_owner_changed): Add a test case for tracking a unique
	name.

	* nih-dbus/dbus_proxy.h (NihDBusProxySignal): Go back to just
	holding a reference to the proxy in the connected signal, we need
	its name owner tracking.
	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_connect): Keep a reference
	to the proxy, don't copy the members in; be allocated as a child
	of the proxy.

	* nih-dbus/tests/test_dbus_proxy.c (test_connect): Add a test
	case for connecting to a signal by well-known name, rather than
	just unique name

	* nih-dbus-tool/output.c (output): Don't know where the word
	"Forward" came from in this comment, delete it.
	* nih-dbus-tool/tests/expected/test_output_proxy_standard.c,
	* nih-dbus-tool/tests/expected/test_output_object_standard.c: 
	Delete from the expected output as well.

	* nih-dbus-tool/main.c: Add a --default-interface argument that
	takes the place of setting the Symbol annotation to "".  This is
	much cleaner, and allows the user of the code to decide, not the
	author of the interface.

	* nih-dbus-tool/interface.c (interface_annotation): Don't allow
	the symbol annotation to be empty again.
	(interface_end_tag): Which means that the symbol can never be
	empty when we get to here.
	* nih-dbus-tool/tests/test_interface.c (test_annotation): Drop the
	test case for the empty annotation.
	(test_end_tag): And drop the empty string test case.

	* nih-dbus/tests/test_dbus_object.c (test_object_property_get)
	(test_object_property_set): We actually want "Access Denied" returned
	instead of "No Such Method".
	* nih-dbus/dbus_object.c (nih_dbus_object_property_get)
	(nih_dbus_object_property_set): Rework so that we can return
	"access denied".

	* nih-dbus/tests/test_dbus_object.c (test_object_property_get)
	(test_object_property_set, test_object_property_get): Add some test
	cases for property access.

	* TODO: Update.

	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_get_all)
	(test_get_all_sync): End-to-end test of the proxy get_all functions.

	* nih-dbus-tool/interface.c (interface_proxy_get_all_notify_function)
	(interface_proxy_get_all_sync_function): We can't use continue to
	repeat the loop, because there might be inner loops.  Use the
	local label trick.
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_notify_function_standard.c,
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_notify_function_structure.c,
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_sync_function_standard.c,
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_sync_function_structure.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_standard.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_methods.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_signals.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_only_properties.c,
	* nih-dbus-tool/tests/expected/test_output_proxy_standard.c: Update
	expected output for test cases

2009-07-01  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_struct_to_str)
	(test_struct_to_str_sync, test_str_to_struct)
	(test_str_to_struct_sync, test_struct_array_to_str)
	(test_struct_array_to_str_sync, test_str_to_struct_array)
	(test_str_to_struct_array_sync, test_dict_entry_array_to_str)
	(test_dict_entry_array_to_str_sync)
	(test_str_to_dict_entry_array)
	(test_str_to_dict_entry_array_sync, test_new_struct)
	(test_new_struct_array, test_new_dict_entry_array)
	(test_get_structure, test_get_structure_sync)
	(test_set_structure, test_set_structure_sync)
	(test_get_struct_array, test_get_struct_array_sync)
	(test_set_struct_array, test_set_struct_array_sync)
	(test_get_dict_entry_array, test_get_dict_entry_array_sync)
	(test_set_dict_entry_array, test_set_dict_entry_array_sync): Proxy
	test functions for structures, arrays of structures, and arrays
	of dictionary entries in converstion, signal and property get/set
	form.

	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c (my_test_get_struct_array)
	(my_test_get_dict_entry_array): Be consistent about what generates
	a D-Bus error and what generates a generic error.
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c (test_get_struct_array)
	(test_get_dict_entry_array): Update to match.

	* nih-dbus-tool/tests/com.netsplit.Nih.Test.xml: Add methods, signals
	and properties that take a structure, an array of structures and an
	array of dictionary entries to the tests.
	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.h: Add structure
	definition for the property we store behind the scenes, add extern
	variables for the structure and structure/dictionary array properties
	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c (my_test_struct_to_str)
	(my_test_str_to_struct, my_test_struct_array_to_str)
	(my_test_str_to_struct_array, my_test_dict_entry_array_to_str)
	(my_test_str_to_dict_entry_array, my_test_get_structure)
	(my_test_set_structure, my_test_get_struct_array)
	(my_test_set_struct_array, my_test_get_dict_entry_array)
	(my_test_set_dict_entry_array): Add implementation for the structure
	and structure/dictionary array conversion functions and property
	get/set functions.  Signal emission is implemented entirely by the
	binding tool.
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c (test_struct_to_str)
	(test_str_to_struct, test_struct_array_to_str)
	(test_str_to_struct_array, test_dict_entry_array_to_str)
	(test_str_to_dict_entry_array, test_new_struct)
	(test_new_struct_array, test_new_dict_entry_array)
	(test_get_structure, test_set_structure, test_get_struct_array)
	(test_set_struct_array, test_get_dict_entry_array)
	(test_set_dict_entry_array): Add new test cases for structures,
	structure arrays and dictionaries.

2009-06-30  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/test_node.c (test_proxy_functions): Structures
	of readable properties come after all writable ones

	* nih-dbus-tool/tests/com.netsplit.Nih.Test.xml: Can't just call the
	property "double" now it ends up in a structure, apply an annotation
	to change the symbol.
	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c (my_test_get_double)
	(my_test_set_double): Rename
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_get_double)
	(test_get_double_sync, test_set_double, test_set_double_sync): Call
	the renamed functions.

	* nih-dbus-tool/tests/test_marshal.c (test_marshal): Add missing test
	cases for arrays of dictionary entries.
	* nih-dbus-tool/tests/marshal_factory.c: Generate a dict entry test
	* nih-dbus-tool/tests/marshal_code.h: Add the expected structure type
	and prototypes.
	* nih-dbus-tool/tests/test_demarshal.c (test_demarshal): Add missing
	test cases for arrays of dictionary entries.
	* nih-dbus-tool/tests/demarshal_code.h: Add the expected structure
	type and prototypes.
	* nih-dbus-tool/tests/demarshal_factory.c: Generate a dict entry test

	* nih-dbus-tool/marshal.c, nih-dbus-tool/demarshal.c,
	* nih-dbus-tool/node.c, nih-dbus-tool/method.c, nih-dbus-tool/signal.c,
	* nih-dbus-tool/property.c: Add missing mention of @structs in
	function documentation.

	* nih-dbus-tool/tests/test_interface.c (test_proxy_get_all_function)
	(test_proxy_get_all_notify_function)
	(test_proxy_get_all_sync_function): Include a mix of readwrite, read
	and writable properties in the test - only the first two should
	appear in the output.

	* nih-dbus-tool/output.c (output): Source should include string.h and
	stdint.h for the following code, header should include stdint.h
	* nih-dbus-tool/tests/expected/test_output_proxy_standard.c:
	Add the headers and the get_all functions to the expected output
	* nih-dbus-tool/tests/expected/test_output_proxy_standard.h: 
	Add the headers, properties structure and get_all function prototypes
	to the expected output
	* nih-dbus-tool/tests/expected/test_output_object_standard.c,
	* nih-dbus-tool/tests/expected/test_output_object_standard.h,
	* nih-dbus-tool/tests/expected/test_output_object_no_interfaces.c,
	* nih-dbus-tool/tests/expected/test_output_object_no_interfaces.h,
	* nih-dbus-tool/tests/expected/test_output_proxy_no_interfaces.c: 
	* nih-dbus-tool/tests/expected/test_output_proxy_no_interfaces.h: 
	Add the headers to the expected output

	* nih/test_files.h (TEST_EXPECTED_STR): Don't just compare the start
	of the string, make sure we compare the whole string - easiest way
	is to check the length first
	(TEST_EXPECTED_FILE): Make sure the files are the same length

	* nih-dbus-tool/node.c (node_proxy_functions): If there are
	properties, include the async and sync versions of the get_all
	function.  These define all the property structs, so the only ones
	we need are the write-only ones.
	* nih-dbus-tool/tests/test_node.c (test_proxy_functions): Add
	the expected externs, prototypes, typedefs and structs for the
	get_all function.
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_standard.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_methods.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_signals.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_only_properties.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_structure.c:
	Add the "get_all" function expected output.

2009-06-29  Scott James Remnant  <scott@netsplit.com>

	* nih/test_files.h (TEST_EXPECTED_STR): Display the full original
	string, not just the first part.

	* nih-dbus-tool/interface.c (interface_proxy_get_all_function)
	(interface_proxy_get_all_notify_function)
	(interface_proxy_get_all_sync_function): Add functions to generate
	proxy methods that get all of the properties of the given interface,
	returned as members of a structure.
	* nih-dbus-tool/interface.h: Add prototypes.
	* nih-dbus-tool/tests/interface_factory.c: Call the new functions
	to generate other functions that we can test
	* nih-dbus-tool/tests/interface_code.h: Expected structure definitions,
	typedefs and prototypes for generated code.
	* nih-dbus-tool/tests/test_interface.c (test_proxy_get_all_function)
	(test_proxy_get_all_notify_function)
	(test_proxy_get_all_sync_function): Test both the generator functions
	themselves and the code that they generate.
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_function_standard.c,
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_notify_function_standard.c,
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_notify_function_structure.c,
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_sync_function_standard.c,
	* nih-dbus-tool/tests/expected/test_interface_proxy_get_all_sync_function_structure.c:
	Expected output from generators
	* nih-dbus-tool/Makefile.am (check_PROGRAMS): Build the interface
	factory binary
	(test_interface_SOURCES): Depend on the header file
	(nodist_test_interface_SOURCES): Build and link the generated source
	(test_interface_LDADD): Need to link to libnih-dbus.la
	(interface_factory_SOURCES, interface_factory_LDFLAGS)
	(interface_factory_LDADD, tests/interface_code.c): Details to build
	interface factory binary
	(CLEANFILES): Make sure we clean up
	(EXTRA_DIST): Distribute expected files

2009-06-28  Scott James Remnant  <scott@netsplit.com>

	* nih/test_files.h (TEST_EXPECTED_STR, TEST_EXPECTED_FILE): It's
	getting increasingly annoying to have very large strings containing
	C source which we compare, add a couple of macros to let us compare
	a string or file against the contents of a file under tests/expected
	* nih-dbus-tool/tests/test_method.c,
	* nih-dbus-tool/tests/test_signal.c,
	* nih-dbus-tool/tests/test_property.c,
	* nih-dbus-tool/tests/test_node.c,
	* nih-dbus-tool/tests/test_output.c: Cut out the embedded C source
	into separate files
	* nih-dbus-tool/tests/expected/test_method_object_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_object_function_no_input.c,
	* nih-dbus-tool/tests/expected/test_method_object_function_no_output.c,
	* nih-dbus-tool/tests/expected/test_method_object_function_structure_input.c,
	* nih-dbus-tool/tests/expected/test_method_object_function_structure_output.c,
	* nih-dbus-tool/tests/expected/test_method_object_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_method_object_function_async.c,
	* nih-dbus-tool/tests/expected/test_method_object_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_method_reply_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_reply_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_method_reply_function_structure.c,
	* nih-dbus-tool/tests/expected/test_method_reply_function_array.c,
	* nih-dbus-tool/tests/expected/test_method_reply_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_structure.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_array.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_notify_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_notify_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_notify_function_structure.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_notify_function_array.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_standard.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_no_input.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_no_output.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_structure_input.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_structure_output.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_array_input.c,
	* nih-dbus-tool/tests/expected/test_method_proxy_sync_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_signal_object_function_standard.c,
	* nih-dbus-tool/tests/expected/test_signal_object_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_signal_object_function_structure.c,
	* nih-dbus-tool/tests/expected/test_signal_object_function_array.c,
	* nih-dbus-tool/tests/expected/test_signal_object_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_standard.c,
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_no_args.c,
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_structure.c,
	* nih-dbus-tool/tests/expected/test_signal_proxy_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_object_get_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_object_get_function_structure.c,
	* nih-dbus-tool/tests/expected/test_property_object_get_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_object_set_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_object_set_function_structure.c,
	* nih-dbus-tool/tests/expected/test_property_object_set_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_notify_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_notify_function_structure.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_notify_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_structure.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_array.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_notify_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_notify_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_sync_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_sync_function_structure.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_get_sync_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_sync_function_standard.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_sync_function_structure.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_sync_function_array.c,
	* nih-dbus-tool/tests/expected/test_property_proxy_set_sync_function_deprecated.c,
	* nih-dbus-tool/tests/expected/test_node_interfaces_array_object.c,
	* nih-dbus-tool/tests/expected/test_node_interfaces_array_proxy.c,
	* nih-dbus-tool/tests/expected/test_node_interfaces_array_none.c,
	* nih-dbus-tool/tests/expected/test_node_object_functions_standard.c,
	* nih-dbus-tool/tests/expected/test_node_object_functions_no_methods.c,
	* nih-dbus-tool/tests/expected/test_node_object_functions_no_signals.c,
	* nih-dbus-tool/tests/expected/test_node_object_functions_no_properties.c,
	* nih-dbus-tool/tests/expected/test_node_object_functions_only_properties.c,
	* nih-dbus-tool/tests/expected/test_node_object_functions_structure.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_standard.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_methods.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_signals.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_no_properties.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_only_properties.c,
	* nih-dbus-tool/tests/expected/test_node_proxy_functions_structure.c,
	* nih-dbus-tool/tests/expected/test_output_proxy_standard.c,
	* nih-dbus-tool/tests/expected/test_output_proxy_standard.h,
	* nih-dbus-tool/tests/expected/test_output_proxy_no_interfaces.c,
	* nih-dbus-tool/tests/expected/test_output_proxy_no_interfaces.h,
	* nih-dbus-tool/tests/expected/test_output_object_standard.c,
	* nih-dbus-tool/tests/expected/test_output_object_standard.h,
	* nih-dbus-tool/tests/expected/test_output_object_no_interfaces.c,
	* nih-dbus-tool/tests/expected/test_output_object_no_interfaces.h:
	Expected output texts
	* nih-dbus-tool/Makefile.am (EXTRA_DIST): Distribute the expected
	source files

	* nih-dbus-tool/output.c (output): Pass a structs list to calls to
	node_output_functions() and node_proxy_functions() and place the
	formatted output in the header file before the typedefs.
	* nih-dbus-tool/tests/test_output.c (test_output): Make sure we
	test having a structure in both proxy and object mode.

	* nih-dbus-tool/node.c (node_object_functions)
	(node_proxy_functions): Call the various function generators with
	a structs list, which we copy up into our own new structs argument.
	* nih-dbus-tool/node.h: Add structs arguments to prototypes
	* nih-dbus-tool/tests/test_node.c (test_object_functions)
	(test_proxy_functions): Pass the structs argument in; make sure the
	structures are passed back as well without duplicating the definitions
	when we have multiple functions that declare them.

2009-06-26  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/property.c (property_object_get_function)
	(property_object_set_function)
	(property_proxy_get_notify_function)
	(property_proxy_set_function, property_proxy_get_sync_function)
	(property_proxy_set_sync_function):  Call marshal() and demarshal()
	with the extra arguments, obtaining most of them from our arguments
	including the Interface and Property structures.  Copy back the list
	of structures returned into a new structs argument that these
	functions accept.
	(property_proxy_get_function)
	(property_proxy_set_notify_function): Add the extra structs argument
	for consistency, though we don't do anything with it
	* nih-dbus-tool/property.h: Update prototypes to add new argument
	* nih-dbus-tool/tests/test_property.c (test_object_get_function)
	(test_object_set_function, test_proxy_get_notify_function)
	(test_proxy_set_function, test_proxy_get_sync_function)
	(test_proxy_set_sync_function): Pass in the structs array, add tests
	to make sure that members of this array are passed back when the
	property is a structure
	(test_proxy_get_function, test_proxy_set_notify_function): Pass in
	the structs array, no need to tests passing back because none ever
	will be,
	* nih-dbus-tool/tests/property_factory.c: Pass expected structs
	list when generating the code.

	* nih-dbus-tool/symbol.c (symbol_typedef): Allow the postfix to
	be NULL (property structures)
	* nih-dbus-tool/tests/test_symbol.c (test_typedef): Add tests for
	without postfix with/without other arguments.

	* nih-dbus-tool/signal.c (signal_object_function)
	(signal_proxy_function): Call marshal() and demarshal() with the
	extra arguments, obtaining most of them from our arguments including
	the Interface and Signal structures.  Copy back the list of
	structures returned into a new structs argument that these functions
	accept.
	* nih-dbus-tool/signal.h: Update prototypes to add new argument
	* nih-dbus-tool/tests/test_signal.c (test_object_function)
	(test_proxy_function): Pass in the structs array, add tests to
	make sure that members of this array are passed back when the signal
	has structure arguments
	* nih-dbus-tool/tests/signal_factory.c: Pass expected structs list
	when generating the code.

	* nih-dbus-tool/method.c (method_object_function)
	(method_reply_function, method_proxy_function)
	(method_proxy_notify_function, method_proxy_sync_function): Call
	marshal() and demarshal() with the extra arguments, obtaining most
	of them from our arguments including the Interface and Method
	structures.  Copy back the list of structures returned into a new
	structs argument that these functions accept.
	* nih-dbus-tool/method.h: Update prototypes to add new argument
	* nih-dbus-tool/tests/test_method.c (test_object_function)
	(test_reply_function, test_proxy_function)
	(test_proxy_notify_function, test_proxy_sync_function): Pass in the
	structs array, add tests to make sure that members of this array
	are passed back when the method has array arguments
	* nih-dbus-tool/tests/method_factory.c: Pass expected structs list
	when generating the code.

	* nih-dbus-tool/demarshal.c (demarshal_struct): Generate the structure
	name using symbol_typedef() rather than expecting type_of() to do
	it for us.  To do this we need extra arguments giving us the
	interface, member and variable symbol names.  Create a TypeStruct
	for it, adding members as we go, and return it via the extra structs
	list.
	(demarshal_array): Take the same extra arguments as demarshal_struct()
	so we can support arrays of structures, pass them to our recursive
	demarshal() call and make sure we pass structs back up.  Create a
	custom symbol for the structure array, so that it becomes
	"PrefixInterfaceMemberArgElement".
	(demarshal_basic): Take the extra arguments for consistency, though
	we don't do anything with them.
	(demarshal): Take the extra arguments, pass down to the static
	functions.
	* nih-dbus-tool/demarshal.h: Update prototypes.
	* nih-dbus-tool/tests/test_demarshal.c (test_demarshal): Pass in
	strings and structs list, check the structs list contents on the
	way out
	* nih-dbus-tool/tests/demarshal_factory.c (demarshal_function): Pass
	expected structs and structs list when generating the code.
	* nih-dbus-tool/tests/demarshal_code.h: Changes required in the name
	of the expected structures
	* nih-dbus-tool/Makefile.am (demarshal_factory_LDADD): Link to symbol

	* nih-dbus-tool/marshal.c (marshal_struct): Generate the structure
	name using symbol_typedef() rather than expecting type_of() to do
	it for us.  To do this we need extra arguments giving us the
	interface, member and variable symbol names.  Create a TypeStruct
	for it, adding members as we go, and return it via the extra structs
	list.
	(marshal_array): Take the same extra arguments as marshal_struct()
	so we can support arrays of structures, pass them to our recursive
	marshal() call and make sure we pass structs back up.  Create a
	custom symbol for the structure array, so that it becomes
	"PrefixInterfaceMemberArgElement".
	(marshal_basic): Take the extra arguments for consistency, though
	we don't do anything with them.
	(marshal): Take the extra arguments, pass down to the static
	functions.
	* nih-dbus-tool/marshal.h: Update prototypes.
	* nih-dbus-tool/tests/test_marshal.c (test_marshal): Pass in strings
	and structs list, check the structs list contents on the way out
	* nih-dbus-tool/tests/marshal_factory.c (marshal_function): Pass
	expected structs and structs list when generating the code.
	* nih-dbus-tool/tests/marshal_code.h: Changes required in the name
	of the expected structures
	* nih-dbus-tool/Makefile.am (marshal_factory_LDADD): Link to symbol

	* nih-dbus-tool/type.c (type_of): Simplify type_of() so that it
	only works for basic types.
	* nih-dbus-tool/tests/test_type.c (test_of): Remove complex types

	* nih-dbus-tool/type.h (TypeStruct): Add another type for structure
	definitions, we need to know the name and a list of members.
	* nih-dbus-tool/type.c (type_struct_new, type_struct_to_string):
	Function to allocate the new type and convert it to a string
	definition.
	* nih-dbus-tool/tests/test_type.c (test_struct_new)
	(test_struct_to_string): Add tests for the two new functions.
	* nih-dbus-tool/Makefile.am (test_type_LDADD): Link to indent & symbol
	(test_marshal_LDADD, test_demarshal_LDADD): These need to link to
	symbol as well.

	* nih-dbus/dbus_proxy.h: Since we use INT_MAX in a macro, we need
	to include limits.h

2009-06-23  Scott James Remnant  <scott@netsplit.com>

	* COPYING: Change licence to version 2 of the GNU GPL.
	All files have been updated to reflect this.

2009-06-21  Scott James Remnant  <scott@netsplit.com>

	* configure.ac: Bump version to 0.3.1
	* NEWS: Begin new release.

2009-06-17  Scott James Remnant  <scott@netsplit.com>

	* NEWS: Release 0.3.0

	* nih-dbus-tool/tests/test_interface.c (test_annotation): Add test
	case for an empty symbol annotation
	* nih-dbus-tool/interface.c (interface_annotation): Explicitly allow
	the symbol to be empty

	* configure.ac: Bump version up to 0.3.0, I think the nih-dbus-tool
	changes are enough to warrant it

	* nih/tests/test_error.c (test_pop_context): Initialise pid to avoid
	gcc issue where it believes the value can be uninitialised
	(test_raise_error): Initialise errors and pid.
	* nih-dbus/tests/test_dbus_connection.c (test_connect): Initialise
	variables allocated inside test constructs.
	* nih-dbus/tests/test_dbus_message.c (test_message_error): Initialise
	variables
	* nih-dbus/tests/test_dbus_proxy.c (test_name_owner_changed): More
	initialisation
	* nih-dbus-tool/tests/test_main.c (test_mode_option): Have to
	initialise ret.
	* nih-dbus-tool/tests/test_node.c (test_start_tag): And another
	* nih-dbus-tool/tests/test_interface.c (test_start_tag): One more
	* nih-dbus-tool/tests/test_method.c (test_start_tag)
	(test_end_tag, test_annotation): Bunch more ret initialises.
	(test_object_function, test_reply_function, test_proxy_function)
	(test_proxy_notify_function): Various other variables
	* nih-dbus-tool/tests/test_signal.c (test_start_tag): Another ret
	* nih-dbus-tool/tests/test_property.c (test_object_get_function)
	(test_object_set_function, test_proxy_get_notify_function)
	(test_proxy_set_notify_function): More miscellaneous ones
	* nih-dbus-tool/tests/test_argument.c (test_start_tag): Another ret
	* nih-dbus-tool/tests/test_annotation.c (test_start_tag): Yet another
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c: Even more
	in this one.

	* nih-dbus-tool/method.c (method_object_function): Don't translate
	the string we return to the caller.
	* nih-dbus-tool/property.c (property_object_set_function): Likewise
	don't translate.
	* nih-dbus-tool/tests/test_method.c (test_object_function): Update
	expected output in tests.
	* nih-dbus-tool/tests/test_property.c (test_object_set_function):
	Likewise
	* nih-dbus-tool/tests/test_node.c (test_object_functions): Likewise
	* nih-dbus-tool/tests/test_output.c (test_output): Likewise.
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c: Too many
	to count in this source file

	* nih-dbus-tool/Makefile.am (test_com_netsplit_Nih_Test_object_SOURCES)
	(test_com_netsplit_Nih_Test_proxy_SOURCES): Finally decided that we're
	not going to ship these built sources, we'd just regenerate them every
	build anyway because nih-dbus-tool will have changed.  Make them
	nodist.
	(AM_CPPFLAGS): Which means we also need to include files from the
	build directory, as well as the source directory
	(BUILT_SOURCES): Change explanation of why it's in built sources
	(CLEANFILES): Clean after build.

	* nih/tests/test_error.c (test_raise_error, test_pop_context): Unlink
	the core file after the assert tests.

	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c,
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c,
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c: #include
	quoted paths will only look in the source directory or current
	working directory, for out of tree builds the current working
	directory won't contain the header so we need to prefix with tests/
	so we can lookup from the source directory
	* nih-dbus-tool/tests/marshal_factory.c,
	* nih-dbus-tool/tests/demarshal_factory.c,
	* nih-dbus-tool/tests/method_factory.c,
	* nih-dbus-tool/tests/signal_factory.c,
	* nih-dbus-tool/tests/property_factory.c: Update generated code to
	prefix includes with tests/

	* nih/tests/test_error.c (test_raise_error, test_pop_context):
	Make sure we don't expect the filename to be always relative,
	e.g. out-of-tree builds.

2009-06-16  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/marshal.c (marshal_array, marshal_struct): In the
	array of structures situation, we can't just close the container
	because it's not been completed - instead we use the new abandon
	function to free the resources while hosing the message.
	* nih-dbus-tool/property.c (property_object_get_function)
	(property_proxy_set_function, property_proxy_set_sync_function):
	Likewise abandon the variant container, strictly speaking probably
	not required but worthwhile for consistenc
	* nih-dbus-tool/tests/test_marshal.c (test_marshal): Update the
	output checks to match
	* nih-dbus-tool/tests/test_method.c (test_object_function)
	(test_proxy_function, test_proxy_sync_function): More output updates
	* nih-dbus-tool/tests/test_signal.c (test_object_function): Update
	the output check
	* nih-dbus-tool/tests/test_property.c (test_object_get_function)
	(test_proxy_set_function, test_proxy_set_sync_function): Yet more
	* nih-dbus-tool/tests/test_node.c (test_object_functions)
	(test_proxy_functions): More output updates.
	* nih-dbus-tool/tests/test_output.c (test_output): Also update the
	top-level output

	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c: Update the
	property functions to raise the no memory error where appropriate,
	also include code to return D-Bus and generic errors for testing.
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c (test_get_byte)
	(test_get_boolean, test_get_int16, test_get_uint16)
	(test_get_int32, test_get_uint32, test_get_int64)
	(test_get_uint64, test_get_string, test_get_object_path)
	(test_get_signature, test_get_int32_array, test_get_str_array)
	(test_get_int32_array_array): Add tests for the get function returning
	an D-Bus error and a generic error.
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_get_byte)
	(test_get_boolean, test_get_int16, test_get_uint16, test_get_int32)
	(test_get_uint32, test_get_int64, test_get_uint64, test_get_double)
	(test_get_string, test_get_object_path, test_get_signature)
	(test_get_int32_array, test_get_int32_array_array): Add D-Bus error
	and generic error test cases to the async functions, making sure that
	the error handler is raised.
	(test_get_byte_sync, test_get_boolean_sync, test_get_int16_sync)
	(test_get_uint16_sync, test_get_int32_sync)
	(test_get_uint32_sync, test_get_int64_sync)
	(test_get_uint64_sync, test_get_double_sync, test_get_string_sync)
	(test_get_object_path_sync, test_get_signature_sync)
	(test_get_int32_array_sync, test_get_str_array_sync)
	(test_get_int32_array_array_sync): Also add D-Bus and generic error
	test cases to the sync functions, which are slightly harder to test
	because of the need for a separate server process; still, this tests
	the error return code.

	* nih-dbus-tool/tests/test_node.c (test_object_functions): Update the
	output tests to expect the error raises.
	* nih-dbus-tool/tests/test_output.c (test_output): Update the output
	tests to match as well.

	* nih-dbus-tool/property.c (property_object_get_function): Raise the
	no memory error when we return.
	* nih-dbus-tool/tests/test_property.c (test_object_get_function): Make
	sure that the output matches, and test the generated function with
	normal output, out of memory, dbus error and generic error returns.

	* nih-dbus/dbus_object.c (nih_dbus_object_property_get): It makes
	sense to be able to return an error when getting a property, at the
	very least it might be a PolicyKit authorisation error.
	(nih_dbus_object_property_get_all): If we get an error while getting
	any property, we have to return that error to the user, such is the
	manner in which D-Bus messages have to be built.
	* nih-dbus/tests/test_dbus_object.c (test_object_property_get):
	Update function to test for property getter functions returning
	errors.
	(test_object_property_get_all): Include a couple of test cases
	here too.

	* TODO (dbus): Update on no_reply, still not completely clear what
	we should do with this annotation as the results are surprising

	* nih-dbus-tool/method.c (method_end_tag): Ignore the NoReply
	annotation if the method has output arguments; ignore the Async
	annotation if the method is NoReply.
	* nih-dbus-tool/tests/test_method.c (test_end_tag): Make sure the
	annotations are amended and warnings emitted as appropriate.

	* nih-dbus-tool/node.c (node_object_functions): Don't generate reply
	functions for non-async method implementations
	* nih-dbus-tool/tests/test_node.c (test_object_functions): Make the
	peek method async so that's the only one that should have a reply
	function.  Also add an output value to another method to check
	ordinary return values.
	* nih-dbus-tool/tests/test_output.c (test_output): Apply the same
	changes to this test as well.

	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c: Turns out
	I was using the wrong timeout value everywhere, this is why macros are
	useful -- replace the wrong "0" with NIH_DBUS_TIMEOUT_DEFAULT

	* nih-dbus/dbus_proxy.h (NIH_DBUS_TIMEOUT_DEFAULT)
	(NIH_DBUS_TIMEOUT_NEVER): Add macros so we don't have to remember
	what the timeout magic numbers are

	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c: Use
	TEST_FUNCTION with proper function names instead of TEST_GROUP

2009-06-15  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.h,
	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c, 
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_object.c,
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c: Completely
	rewrite these tests using TEST_DBUS, making sure we test as much of the
	newly generated code as possible.

	* nih-dbus-tool/tests/com.netsplit.Nih.Test.xml: Various slight
	updates to better test the newer code; add arrays of arrays to the
	tests; rename "data" to "value" to avoid clash with data argument;
	remove the glue we won't use it anymore.

	* nih-dbus-tool/Makefile.am ($(com_netsplit_Nih_Test_proxy_OUTPUTS)):
	Use "proxy" as the prefix again, "your" just looks silly.

	* nih-dbus-tool/type.c (type_strcat_assert): And now the other
	corner case we found, size arrays can be NULL if the first element
	of the array is NULL.
	* nih-dbus-tool/tests/test_type.c (test_strcat_assert): Add tests
	* nih-dbus-tool/method.c (method_reply_function)
	(method_proxy_function, method_proxy_sync_function),
	* nih-dbus-tool/signal.c (signal_object_function),
	* nih-dbus-tool/property.c (property_proxy_set_function)
	(property_proxy_set_sync_function): Think-o, we can't look at the
	previous iterated we have to look at the last function argument

	* nih-dbus-tool/type.c (type_strcat_assert): We're starting to get
	a lot of corner cases in that simple assert block, separate it out
	so we don't have to repeatedly get it wrong.
	* nih-dbus-tool/type.h: Add prototype
	* nih-dbus-tool/tests/test_type.c (test_strcat_assert): The all
	important tests.
	* nih-dbus-tool/method.c (method_reply_function)
	(method_proxy_function, method_proxy_sync_function): Use the new
	function.
	* nih-dbus-tool/signal.c (signal_object_function): Likewise.
	* nih-dbus-tool/property.c (property_proxy_set_function)
	(property_proxy_set_sync_function): Likewise.

	* nih-dbus-tool/method.c (method_reply_function)
	(method_proxy_function, method_proxy_sync_function): Input array
	arguments of basic types (those with a size_t argument following)
	may be NULL if that size_t argument is zero.  Check for this when
	adding asserts.
	* nih-dbus-tool/tests/test_method.c (test_reply_function)
	(test_proxy_function, test_proxy_sync_function): Add test cases for
	an array input argument to make sure we generate the right assert
	* nih-dbus-tool/signal.c (signal_object_function): Needs exactly
	the same patch
	* nih-dbus-tool/tests/test_signal.c (test_object_function): Add
	the test case for this one too.
	* nih-dbus-tool/property.c (property_proxy_set_function)
	(property_proxy_set_sync_function): We also need the same patch
	for this one too.
	* nih-dbus-tool/tests/test_property.c (test_proxy_set_function)
	(test_proxy_set_sync_function): And test as well

2009-06-14  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_connect): Total thinko with
	the API; I'd expected the signal structures to be public, but we
	don't generally want that.  Better just to take a signal name.
	* nih-dbus/dbus_proxy.h: Update prototype.
	* nih-dbus/tests/test_dbus_proxy.c (test_connect): Update tests
	(test_signal_destroy): Also update this one
	* nih-dbus-tool/tests/test_signal.c (test_proxy_function): Also update

2009-06-13  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/output.c (output): Need dbus_pending_data.h in the
	header too for the error handler typedef.
	* nih-dbus-tool/tests/test_output.c (test_output): Add to tests

2009-06-11  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/test_output.c (test_output): We want an extra
	line between extern variables and functions, but only when there are
	both.
	* nih-dbus-tool/output.c (output): Adjust the code to make that so

	* nih/child.h,
	* nih/io.h,
	* nih/logging.h,
	* nih/main.h,
	* nih/signal.h: Make sure we prefix variables with "extern"

	* nih-dbus-tool/node.c (node_interfaces_array): Make the structure
	prototypes that we export "extern", since they go in the header
	file.
	* nih-dbus-tool/tests/test_node.c (test_interfaces_array): Make sure
	that the returned variable types all include "extern" in the lists,
	but not in the output.
	* nih-dbus-tool/tests/test_output.c (test_output): Update the output
	checks of the headers to expect extern in front of variables.

2009-06-10  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/signal.c (signal_proxy_function): Eliminate the
	proxy passthrough and use proxied members directly.
	* nih-dbus-tool/tests/test_signal.c (test_proxy_function): Update
	expected output of tests to match.
	* nih-dbus-tool/tests/test_node.c (test_proxy_functions): Update
	expected output.
	* nih-dbus-tool/tests/test_output.c (test_output): Update as well

	* nih-dbus-tool/tests/test_signal.c (test_proxy_function): Pass
	the extra arguments to nih_dbus_proxy_connect(), which means we
	actually move the data pointer to the connect call now.

	* nih-dbus/dbus_proxy.h (NihDBusProxySignal): Rather than reference
	the proxy itself, copy the members that we want out of it.
	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_connect): Accept a parent
	argument, as well as a separate data argument, copy the members
	from proxy into the object, taking a reference to the connection
	as we do so.
	(nih_dbus_proxy_signal_destroy): Don't forget to unref the connection
	(nih_dbus_proxy_signal_rule): Take members directly
	* nih-dbus/tests/test_dbus_proxy.c (test_connect): Call the function
	with the two new arguments, update tests to check for the new members
	(test_signal_destroy): Call with the two new arguments.

	* nih-dbus-tool/property.c (property_proxy_set_sync_function): Add
	a parent argument to the methods, even though we never use it;
	otherwise it's irritatingly inconsistent with methods and property
	get functions.
	* nih-dbus-tool/tests/property_code.h: Adjust the expected prototype
	* nih-dbus-tool/tests/test_property.c (test_proxy_set_sync_function):
	Adjust expected output to include the parent argument
	* nih-dbus-tool/tests/test_node.c (test_proxy_functions): Update
	expected output to match
	* nih-dbus-tool/tests/test_output.c (test_output): Update as well

	* nih-dbus/dbus_proxy.h (NihDBusSignalhandler): Remove the proxy
	argument.
	* nih-dbus/tests/test_dbus_proxy.c (my_signal_handler): Remove the
	argument from here too

	* nih-dbus-tool/signal.c (signal_proxy_function): Don't pass the
	proxy to the signal handler function; we don't pass it for method
	or property reply handlers because we don't have it, it's inconsitent
	to pass it here as well - we can always make a new proxy for the origin
	after all.
	* nih-dbus-tool/tests/signal_code.h: Update typedef
	* nih-dbus-tool/tests/test_signal.c (test_proxy_function): Update
	the tests
	* nih-dbus-tool/tests/test_node.c (test_proxy_functions): Update
	expected output
	* nih-dbus-tool/tests/test_output.c (test_output): Update expected
	output.

	* nih-dbus-tool/method.c (method_proxy_notify_function): Symbol
	name for a notify function should be implementation, it's static
	(method_proxy_function): Call with the implementation name
	* nih-dbus-tool/tests/method_code.h: Update name of notify function
	we expect to be generated
	* nih-dbus-tool/tests/method_factory.c: Updadate the name of the
	notify function we'll supply in the test
	* nih-dbus-tool/tests/test_method.c (test_proxy_notify_function): 
	Rename notify function in output and when we call it
	(test_proxy_function): Rename notify function in output
	* nih-dbus-tool/tests/test_node.c (test_proxy_functions): Update
	expected output
	* nih-dbus-tool/tests/test_output.c (test_output): Update expected
	output

	* NEWS: Update
	* TODO: Update

	* nih-dbus-tool/tests/com.netsplit.Nih.Test.xml: Update to newer
	XML format, using annotations instead of namespaces.  Add a couple
	of extra tests cases, and in particular add properties.
	* nih-dbus-tool/Makefile.am ($(com_netsplit_Nih_Test_object_OUTPUTS)): 
	($(com_netsplit_Nih_Test_proxy_OUTPUTS)): Use the C version of the
	nih-dbus-tool to generate the output; currently not compatible with
	the tests, but should generate good code.  Be sure to make the
	output directory first (out of tree builds)
	(nodist_test_marshal_SOURCES, nodist_test_demarshal_SOURCES)
	(nodist_test_method_SOURCES, nodist_test_signal_SOURCES)
	(nodist_test_property_SOURCES): We don't want to distribute the
	*_code.c files so move them into a nodist prefixed
	(MAINTAINERCLEANFILES): BUILT_SOURCES are always maintainer-clean,
	so drop this
	(EXTRA_DIST): Sources are always distributed, so drop the outputs
	from this leaving only the XML
	(tests/marshal_code.c, tests/demarshal_code.c)
	(tests/method_code.c, tests/signal_code.c)
	(tests/property_code.c): Drop the temporary output, no need for it
	(CLEANFILES): Specify by expanding the nodist_*_SOURCES variables

	* nih-dbus-tool/nih_dbus_tool.py: Drop the python version

	* TODO: Update.

	* nih-dbus-tool/main.c: Actually output the source and header files

	* nih-dbus-tool/main.c: Generate the source and header paths earlier,
	using an nih_local string so we don't have to free.  Make sure we
	close the input file descriptor.  Don't put meaningless content into
	the errors we output.

	* nih-dbus-tool/main.c (mode_option): Rather than set a random enum,
	just use TRUE/FALSE as the output and node methods do.
	* nih-dbus-tool/tests/test_main.c (test_mode_option): Update.

	* nih-dbus-tool/man/nih-dbus-tool.1: Make a start on a man page for
	the tool.

	* nih-dbus-tool/output.c (output): Primary function to output C
	source and header files for a node in either object or proxy mode.
	(output_preamble): Support function to generate the preamble comment
	(output_sentinel): Support function to generate the header sentinel
	(output_write): Support file to write out to the file descriptor
	* nih-dbus-tool/output.h: Headers
	* nih-dbus-tool/tests/test_output.c: Tests for the code
	* nih-dbus-tool/Makefile.am (nih_dbus_tool_SOURCES): Compile and link
	the new source file
	(TESTS): Run the new tests
	(test_output_SOURCES, test_output_LDFLAGS, test_output_LDADD): Details
	for the new tests

	* nih-dbus-tool/type.c (type_func_to_typedef, type_func_layout):
	Use type_var_to_string instead of doing things by hand.

	* nih-dbus-tool/tests/test_type.c (test_func_layout): Noticed that
	I have no test cases for no arguments or returning void, extend the
	existing cases.
	* nih-dbus-tool/type.c (type_func_layout): Glad I did that - I didn't
	cope with no arguments.

	* nih-dbus-tool/type.c (type_func_to_typedef): We need to be able to
	lay typedefs out individually, thus add this function.
	* nih-dbus-tool/type.h: Add prototype
	* nih-dbus-tool/tests/test_type.c (test_func_to_typedef): Add tests

2009-06-09  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/node.c (node_object_functions)
	(node_proxy_functions): Implement functions that call all the
	necessary other functions to return C code for a node's object or
	proxy implementations.
	* nih-dbus-tool/node.h: Add prototypes.
	* nih-dbus-tool/tests/test_node.c (test_object_functions)
	(test_proxy_functions): Test cases for the functions.

2009-06-04  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/main.c: Change the default output mode to proxy,
	which makes a bit more sense for the majority case.

	* nih-dbus-tool/signal.c (signal_proxy_function): Name the signal
	functions _signal to match _method
	* nih-dbus-tool/tests/signal_code.h: Update to match
	* nih-dbus-tool/tests/test_signal.c (test_proxy_function): Update

	* nih-dbus-tool/node.c (node_interfaces_array): The last member
	should be just NULL, it's an array of pointers.
	* nih-dbus-tool/tests/test_node.c (test_interfaces_array): Adjust
	test case output to match.

	* nih-dbus/dbus_object.c (nih_dbus_object_introspect): Cope with
	name-less arguments.
	* nih-dbus/tests/test_dbus_object.c (test_object_introspect): Update
	input and expected return string.

	* nih-dbus-tool/interface.c (interface_end_tag): If the symbol is
	given as "", set it to NULL.
	* nih-dbus-tool/tests/test_interface.c (test_end_tag): Add a test
	case for the empty symbol.

	* nih-dbus-tool/node.c (node_interfaces_array): Generate the array
	of interfaces for a given node.
	* nih-dbus-tool/node.h: Add prototype.
	* nih-dbus-tool/tests/test_node.c (test_interfaces_array): Add tests
	for the new function

	* nih-dbus-tool/interface.c (interface_methods_array)
	(interface_signals_array, interface_properties_array): Return the
	prototype with the name set, and thus don't return a static argument
	array.
	(interface_struct): Rewrite to reuse the name and insert the static
	* nih-dbus-tool/interface.h: Update prototypes
	* nih-dbus-tool/tests/test_interface.c (test_methods_array)
	(test_signals_array, test_properties_array): Adjust to match

	* nih-dbus-tool/interface.c (interface_methods_array)
	(interface_signals_array): Restructure to expect prototypes to be
	returned from the args array functions, using that to get the name
	of those and generally making things a bit more readable.  Make
	static along the way too.

	* nih-dbus-tool/tests/test_interface.c (test_struct): Make sure the
	returned items aren't arrays.

	* nih-dbus-tool/signal.c (signal_args_array): Return the prototype
	with the name set, and thus don't return a static argument array.
	* nih-dbus-tool/signal.h: Update prototype
	* nih-dbus-tool/tests/test_signal.c (test_args_array): Adjust to match

	* nih-dbus-tool/method.c (method_args_array): Return the prototype
	with the name set, and thus don't return a static argument array.
	* nih-dbus-tool/method.h: Update prototype
	* nih-dbus-tool/tests/test_method.c (test_args_array): Adjust to match

	* nih-dbus-tool/type.h (type_var): Add an array member.
	* nih-dbus-tool/type.c (type_var_new): Initialise array to FALSE.
	(type_var_to_string, type_var_layout): Append [] if the var is an
	array
	* nih-dbus-tool/tests/test_type.c (test_var_new): Check array is FALSE
	(test_var_to_string, test_var_layout): Add checks for array

	* nih-dbus-tool/interface.c (interface_struct): Generate a structure
	variable for an interface, along with the members code.
	* nih-dbus-tool/interface.h: Add prototype
	* nih-dbus-tool/tests/test_interface.c (test_struct): Tests.

2009-06-03  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/method.c (method_args_array): Add missing NihDBusArg
	* nih-dbus-tool/tests/test_method.c (test_args_array): Update
	expected test output
	* nih-dbus-tool/signal.c (signal_args_array): Add missing NihDBusArg
	* nih-dbus-tool/tests/test_signal.c (test_args_array): Update
	expected test output
	* nih-dbus-tool/interface.c (interface_methods_array)
	(interface_signals_array, interface_properties_array): Add missing
	NihDBusMethod, NihDBusSignal and NihDBusProperty type names.
	* nih-dbus-tool/tests/test_interface.c (test_methods_array)
	(test_signals_array, test_properties_array): Update expected
	test output

	* nih-dbus-tool/interface.c (interface_properties_array): Generate
	the array of properties for an interface
	* nih-dbus-tool/interface.h: Add prototype
	* nih-dbus-tool/tests/test_interface.c (test_properties_array): Tests

	* nih-dbus-tool/method.c (method_args_array): Use method_args instead
	of args to distinguish from signals.
	* nih-dbus-tool/tests/test_method.c (test_args_array): Update.
	* nih-dbus-tool/signal.c (signal_args_array): Use signal_args instead
	of args to distinguish from methods.
	* nih-dbus-tool/tests/test_signal.c (test_args_array): Update.
	* nih-dbus-tool/interface.c (interface_methods_array)
	(interface_signals_array): Update to match
	* nih-dbus-tool/tests/test_interface.c (test_methods_array)
	(test_signals_array): Also update.

	* nih-dbus-tool/interface.c (interface_signals_array): Generate the
	array of signals for an interface, including the arguments.
	* nih-dbus-tool/interface.h: Add prototype
	* nih-dbus-tool/tests/test_interface.c (test_signals_array): Tests.

	* nih-dbus-tool/interface.c (interface_methods_array): Generate the
	array of methods for an interface, including the arguments.
	* nih-dbus-tool/interface.h: Add prototype
	* nih-dbus-tool/tests/test_interface.c (test_methods_array): Tests.

	* nih-dbus-tool/signal.c (signal_args_array): Generate the array
	of arguments for a signal.
	* nih-dbus-tool/signal.h: Add prototype.
	* nih-dbus-tool/tests/test_signal.c (test_args_array): Tests.

	* nih-dbus-tool/method.c (method_args_array): Generate the array
	of arguments for a method.
	* nih-dbus-tool/method.h: Add prototype.
	* nih-dbus-tool/tests/test_method.c (test_args_array): Tests.

	* nih-dbus-tool/symbol.c (symbol_impl): Allow the symbol name and
	postfix to be NULL, as is the case for structure definitions.
	* nih-dbus-tool/tests/test_symbol.c (test_impl): Extend test cases
	to cover new cases.

2009-06-02  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/property.c (property_object_get_function)
	(property_object_set_function, property_proxy_get_function)
	(property_proxy_get_notify_function)
	(property_proxy_set_function)
	(property_proxy_set_notify_function)
	(property_proxy_get_sync_function)
	(property_proxy_set_sync_function): Rather than accepting precanned
	names, accept prefix, interface and property and generate them every
	time.
	* nih-dbus-tool/property.h: Update prototypes.
	* nih-dbus-tool/tests/property_factory.c: Create an interface and
	pass it to the functions.
	* nih-dbus-tool/tests/property_code.h: Prototypes all change
	* nih-dbus-tool/tests/test_property.c: Update tests.

	* nih-dbus-tool/signal.c (signal_object_function)
	(signal_proxy_function): Rather than accepting precanned names, accept
	prefix, interface and signal and generate them every time
	* nih-dbus-tool/signal.h: Update prototypes.
	* nih-dbus-tool/tests/signal_factory.c: Create an interface and
	pass it to the functions
	* nih-dbus-tool/tests/signal_code.h: Filter function name changes
	as a result.
	* nih-dbus-tool/tests/test_signal.c: Update tests.

	* nih-dbus-tool/method.c (method_object_function)
	(method_reply_function, method_proxy_function)
	(method_proxy_notify_function, method_proxy_sync_function): Rather
	than accepting precanned names, accept prefix, interface and method
	and generate them every time.
	* nih-dbus-tool/method.h: Update prototypes.
	* nih-dbus-tool/tests/method_factory.c: Create an interface and pass
	it to the functions
	* nih-dbus-tool/tests/method_code.h: A couple of names of generated
	functions change as a result (becoming proper)
	* nih-dbus-tool/tests/test_method.c: Update tests

	* nih-dbus-tool/interface.c (interface_lookup_method): Move to method.c
	(interface_lookup_signal): Move to signal.c
	(interface_lookup_property): Move to property.c
	* nih-dbus-tool/interface.h: Also move prototypes
	* nih-dbus-tool/tests/test_interface.c: Also move test cases
	* nih-dbus-tool/method.c (interface_lookup_method): Rename
	to method_lookup
	* nih-dbus-tool/method.h: Update prototype.
	* nih-dbus-tool/tests/test_method.c (test_lookup_method): Rename
	to test_lookup
	* nih-dbus-tool/signal.c (interface_lookup_signal): Rename
	to signal_lookup
	* nih-dbus-tool/signal.h: Update prototype.
	* nih-dbus-tool/tests/test_signal.c (test_lookup_signal): Rename
	to test_lookup
	* nih-dbus-tool/property.c (interface_lookup_property): Rename
	to property_lookup
	* nih-dbus-tool/property.h: Update prototype
	* nih-dbus-tool/tests/test_property.c (test_lookup_property): Rename
	to test_lookup

	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_name_owner_changed): Add
	missing DBUS_TYPE_INVALID sentinel to the dbus_message_get_args()
	call.

2009-05-29  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/test_node.c (test_lookup_interface): Extend
	test case to look for NULL
	* nih-dbus-tool/node.c (node_lookup_interface): Allow NULL symbol
	lookup, which returns an Interface with a NULL symbol (ie. the
	default).

	* nih-dbus-tool/symbol.c (symbol_impl, symbol_extern)
	(symbol_typedef): Name generation functions
	(symbol_strcat_interface, symbol_strcat_title): Utility functions
	used for the above
	* nih-dbus-tool/symbol.h: Add prototypes
	* nih-dbus-tool/tests/test_symbol.c (test_impl, test_extern)
	(test_typedef): Test cases for the new functions

2009-05-27  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/method.c (method_proxy_sync_function): sync function
	returns an integer, so should not be malloc
	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function):
	Remove from tests as well

	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function):
	Do the child process stuff before creating the proxy, otherwise
	it holds a reference to the connection.
	* nih-dbus-tool/tests/test_property.c (test_proxy_get_sync_function)
	(test_proxy_set_sync_function): Likewise.

2009-05-26  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/nih_dbus_tool.py: Rename conn to connection
	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c: Update conn
	to connection here too

	* nih-dbus-tool/tests/test_method.c,
	* nih-dbus-tool/tests/test_signal.c, 
	* nih-dbus-tool/tests/test_property.c: Update variable names in
	test cases too

	* nih-dbus-tool/method.c,
	* nih-dbus-tool/signal.c,
	* nih-dbus-tool/property.c: Update accessor of message, proxy and
	object functions

	* nih-dbus/tests/test_dbus_message.c,
	* nih-dbus/tests/test_dbus_object.c,
	* nih-dbus/tests/test_dbus_pending_data.c,
	* nih-dbus/tests/test_dbus_proxy.c: Update to match conn/connection

	* nih-dbus/dbus_proxy.c: rename conn to connection
	* nih-dbus/dbus_proxy.h (NihDBusProxy): rename conn to connection

	* nih-dbus/dbus_object.c: rename conn to connection
	* nih-dbus/dbus_object.h (NihDBusObject): rename conn to connection
 
	* nih-dbus/dbus_pending_data.c: rename conn to connection
	* nih-dbus/dbus_pending_data.h (NihDBusPendingData): rename conn
	to connection

	* nih-dbus/dbus_message.c: rename conn to connection
	* nih-dbus/dbus_message.h (NihDBusMessage): rename conn to connection

	* nih-dbus/dbus_interface.h: Rename conn arguments to connection.

	* nih-dbus/dbus_connection.c: Rename conn arguments/variables to
	connection, for style-wise stuff
	* nih-dbus/dbus_connection.h: Update prototypes

	* nih-dbus-tool/signal.c (signal_proxy_function): Function to
	generate D-Bus connection filter functions to catch signal
	messages and pass them to a handler
	* nih-dbus-tool/signal.h: Add prototype
	* nih-dbus-tool/tests/signal_factory.c: Call the function to
	generate a filter function for testing
	* nih-dbus-tool/tests/signal_code.h: Expected prototype for
	generated function, and the typedef it casts handler functions to
	* nih-dbus-tool/tests/test_signal.c (test_proxy_function): Test
	cases for the function and the generated function

	* nih-dbus/dbus_interface.h (NihDBusSignalFilter): Rename the
	message argument to signal, since we use message for the context

2009-05-25  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/dbus_interface.h (NihDBusSignal): Add filter function
	member, which is a D-Bus connection filter that will call a proxied
	handler function.
	(NihDBusProxySignal): add advanced typedef
	(NihDBusSignalFilter): typedef for signal filter function

	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_connect): Function to
	connect a signal handler to a proxy using the filter function
	defined in the NihDBusSignal structure.
	(nih_dbus_proxy_signal_destroy): Destructor for a proxied signal
	that removes the match on the bus daemon and the filter
	(nih_dbus_proxy_signal_rule): Function to generate signal rule
	* nih-dbus/dbus_proxy.h (NihDBusProxySignal): Structure with the
	information we need about a connected signal.
	(NihDBusSignalHandler): Typedef for signal handler function we
	accept for nih_dbus_proxy_connect()
	* nih-dbus/tests/test_dbus_proxy.c (test_connect)
	(test_signal_destroy): Test the new functions

	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_destroy)
	(nih_dbus_proxy_name_track): If we don't pass a DBusError to
	dbus_bus_remove_match() then it won't wait for the reply, which
	leaks a method call reply elsewhere.

2009-05-24  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/test_method.c (test_proxy_function)
	(test_proxy_sync_function),
	* nih-dbus-tool/tests/test_property.c (test_proxy_get_function)
	(test_proxy_set_function, test_proxy_get_sync_function)
	(test_proxy_set_sync_function),
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c (test_method_dispatch): 
	Update arguments to nih_dbus_proxy_new() calls

	* nih-dbus/dbus_proxy.h (NihDBusProxy): Add owner member to
	store the unique name of the proxied object, also add a handler
	function for the owner dropping off the bus and a data pointer to
	pass to it.
	(NihDBusLostHandler): typedef for lost handler function
	* nih-dbus/dbus_proxy.c (nih_dbus_proxy_new): Accept the lost handler
	and data members, setting in the function.  If the lost handler is
	passed (which may only be passed if name is not NULL) then we'll
	track that name on the bus.
	(nih_dbus_proxy_destroy): We need a destructor to tear down and
	remove bus matches and connection filters, and also unreference the
	connection.
	(nih_dbus_proxy_name_track): Set up tracking for a name, which is
	far more complicated than it needs to be; arranges for the
	NameOwnerChanged signal to be received, and obtains the current owner
	of the name.
	(nih_dbus_proxy_name_rule): Function to generate the match rule
	used for the NameOwnerChanged signal.
	(nih_dbus_proxy_name_owner_changed): Handle the NameOwnerChanged
	rule, updating the owner member of the proxy and calling the lost
	handler if the name becomes NULL.
	* nih-dbus/dbus_interface.h: Add a pre-declaration for the
	NihDBusProxy typedef since we'll need to pass this to signal filter
	functions defined here later on

2009-05-22  Scott James Remnant  <scott@netsplit.com>

	* nih/inotify.h: Remove this wrapper, we require a libc with
	inotify support.
	* m4/misc.m4 (NIH_INIT): Remove the check for sys/inotify.h
	* nih/watch.c, 
	* nih/watch.h,
	* nih/tests/test_watch.c: Update includes.
	* nih/Makefile.am (nihinclude_HEADERS): Remove inotify.h

	* COPYING: Change licence from GPL-2+ to MIT.
	All files have been updated to reflect this.

2009-05-21  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/dbus_object.h: Separate out the actual structure
	definitions for an interface, the overlap is getting difficult
	to manage and they're shared with proxies anyway.
	* nih-dbus/dbus_interface.h: File for the separated out interfaces
	* nih-dbus/libnih-dbus.h: Include new header
	* nih-dbus/Makefile.am (nihdbusinclude_HEADERS): Ship and install it

2009-05-19  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/signal.c (signal_emit_function): Rename to
	signal_object_function for consistency
	* nih-dbus-tool/signal.h: Update header
	* nih-dbus-tool/tests/signal_factory.c: Update.
	* nih-dbus-tool/tests/test_signal.c (test_emit_function): Rename to
	test_object_function to match; update

	* nih-dbus-tool/method.c (method_proxy_sync_function): Also
	following the property code, rework method calls to return an
	integer as well - which means some tricksy cleanup code in the
	case of argument errors now we don't have a top-level message
	to free.
	* nih-dbus-tool/tests/method_code.h: Update the expected prototype
	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function):
	Update the tests to match

	* nih-dbus-tool/method.c (method_proxy_notify_function): Of course,
	that's only useful if the notify function handles there being no
	reply handler, so put an if around the calling of it.
	* nih-dbus-tool/tests/test_method.c (test_proxy_notify_function):
	Update the output tests to look for the if.  Add test cases for
	that as well.

	* nih-dbus-tool/method.c (method_proxy_function): Make the same
	modification that we made to the property functions, allowing the
	reply handler to be NULL as long as the error handler isn't
	* nih-dbus-tool/tests/test_method.c (test_proxy_function): Adjust
	the output test functions, and also add a test in for no reply
	handler but an error handler

	* nih-dbus-tool/property.c (property_proxy_set_function)
	(property_proxy_set_notify_function): Functions to generate functions
	to make an asynchronous method call to set the value of a property.
	* nih-dbus-tool/property.h: Add prototypes
	* nih-dbus-tool/tests/property_factory.c: Use the functions to
	generate functions for testing purposes
	* nih-dbus-tool/tests/property_code.h: Expected prototypes of
	generated functions, along with the handler typedef that we need
	* nih-dbus-tool/tests/test_property.c (test_proxy_set_function)
	(test_proxy_set_notify_function): Test the functions and the
	generated code

2009-05-18  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/dbus_pending_data.c (nih_dbus_pending_data_new): Allow
	handler to be NULL.
	* nih-dbus/tests/test_dbus_pending_data.c (test_new): Make sure
	that NULL is permitted.

	* nih-dbus-tool/property.c (property_proxy_get_function)
	(property_proxy_get_notify_function): Functions to generate functions
	to make an asynchronous method call to get the value of a property.
	* nih-dbus-tool/property.h: Add prototypes
	* nih-dbus-tool/tests/property_factory.c: Use the functions to
	generate functions for testing purposes
	* nih-dbus-tool/tests/property_code.h: Expected prototypes of
	generated functions, along with the handler typedef that we need
	* nih-dbus-tool/tests/test_property.c (test_proxy_get_function)
	(test_proxy_get_notify_function): Test the functions and the
	generated code

	* nih-dbus-tool/property.c (property_proxy_get_sync_function)
	(property_proxy_set_sync_function): Make sure we clean up in
	cases of out-of-memory for the interface name and property name
	arguments.
	* nih-dbus-tool/tests/test_property.c (test_proxy_get_sync_function)
	(test_proxy_set_sync_function): Adjust test cases to match

	* nih-dbus-tool/method.c (method_proxy_notify_function): No need
	to use NIH_MUST when we're in an emomem loop.
	* nih-dbus-tool/tests/test_method.c (test_proxy_notify_function): 
	Update output tests to match.

	* nih-dbus-tool/property.c (property_proxy_get_sync_function)
	(property_proxy_set_sync_function): Functions to generate functions
	to make a synchronous method call to get or set the value of a
	property respectively.
	* nih-dbus-tool/property.h: Add prototypes
	* nih-dbus-tool/tests/property_factory.c: Call the two functions
	to generate functions for testing
	* nih-dbus-tool/tests/property_code.h: Prototypes for expected
	generated functions
	* nih-dbus-tool/tests/test_property.c (test_proxy_get_sync_function)
	(test_proxy_set_sync_function): Test the code generator and the
	generated code.

2009-05-17  Scott James Remnant  <scott@netsplit.com>

	* NEWS: Add entry for move of nih-dbus errors

2009-05-15  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_error.c (test_raise_no_memory): Fix missing
	nih_error_get ()
	(test_raise_error): Free the second error
	* nih/libnih.supp: Suppress the abort()-related leak

	* nih-dbus-tool/method.c (method_object_function): Rename externs
	to handlers
	* nih-dbus-tool/method.h: Update prototype
	* nih-dbus-tool/tests/method_factory.c: Update calls
	* nih-dbus-tool/tests/test_method.c (test_object_function): Update
	variable names in tests

	* nih-dbus-tool/method.c (method_reply_function)
	(method_proxy_sync_function): Remove the unused externs parameters
	* nih-dbus-tool/method.h: Update prototypes
	* nih-dbus-tool/tests/method_factory.c: Don't pass when we don't
	use them
	* nih-dbus-tool/tests/test_method.c (test_reply_function)
	(test_proxy_sync_function): Remove the empty list checks

	* nih-dbus-tool/property.c (property_object_get_function)
	(property_object_set_function): Rename externs to handlers
	* nih-dbus-tool/property.h: Update prototypes
	* nih-dbus-tool/tests/property_factory.c: Update calls
	* nih-dbus-tool/tests/test_property.c (test_object_get_function)
	(test_object_set_function): Update variable names in tests.

	* nih-dbus-tool/signal.c (signal_emit_function): Remove the externs
	parameter, which is not used.
	* nih-dbus-tool/signal.h: Update prototype
	* nih-dbus-tool/tests/signal_factory.c: Drop externs handling
	* nih-dbus-tool/tests/test_signal.c (test_emit_function): Drop
	tests for empty externs list

	* nih/errors.h: Remove the D-Bus errors from this file
	* nih-dbus/errors.h: Place them in a new file.
	* nih-dbus/libnih-dbus.h: Include the new header
	* nih-dbus/Makefile.am (nihdbusinclude_HEADERS): Install the new
	header.
	* nih-dbus/dbus_error.c,
	* nih-dbus/dbus_object.c: 
	* nih-dbus/tests/test_dbus_connection.c,
	* nih-dbus/tests/test_dbus_error.c,
	* nih-dbus-tool/tests/method_factory.c,
	* nih-dbus-tool/tests/signal_factory.c,
	* nih-dbus-tool/tests/property_factory.c,
	* nih-dbus-tool/tests/test_method.c,
	* nih-dbus-tool/tests/test_property.c,
	* nih-dbus-tool/tests/test_com.netsplit.Nih.Test_proxy.c: Update
	headers included
	* nih-dbus-tool/nih_dbus_tool.py (Output.sourceFile): Update generated
	includes.

	* nih-dbus/dbus_object.h (NihDBusPropertySetter): Change prototype
	to return an int, instead of a handler result.  This allows us to
	introduce interesting new SetMany-like methods later.
	* nih-dbus/dbus_object.c (nih_dbus_object_property_set): Expand
	the function to do the reply handling here, this actually makes
	things much better for the ENOMEM case.
	* nih-dbus/tests/test_dbus_object.c (test_object_property_set): 
	Adjust test cases to match
	
	* nih-dbus-tool/property.c (property_object_set_function): Rework
	the prototype of property setter functions, we just want to return
	int and have the nih-dbus core deal with sending the reply.
	* nih-dbus-tool/tests/property_code.h: Update prototype.
	* nih-dbus-tool/tests/test_property.c (test_object_set_function):
	Update tests to match

	* nih-dbus-tool/method.c (method_object_function): Push an error
	context around the handler call
	* nih-dbus-tool/tests/test_method.c (test_object_function): Adjust
	tests to expect the error context

	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function): Make
	sure the methods aren't marked to expect no reply (completeness)

	* nih-dbus-tool/method.c (method_proxy_sync_function): Fix nih_strcat
	call to not overwrite variable with return value

	* nih-dbus-tool/method.c (method_proxy_function)
	(method_proxy_notify_function): Functions to generate the two
	functions required for an asynchronous method call, the first makes
	the call and the second is the pending call notify function for it
	that calls the reply handler.
	* nih-dbus-tool/method.h: Prototypes.
	* nih-dbus-tool/tests/method_factory.c: Call both functions to
	generate functions for testing
	* nih-dbus-tool/tests/method_code.h: Expected prototypes for the
	generated functions.
	* nih-dbus-tool/tests/test_method.c (test_proxy_function)
	(test_proxy_notify_function): Test the code generator and the
	generated code.

2009-05-14  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/dbus_pending_data.c (nih_dbus_pending_data_new): Allocate
	a new NihDBusPendingData structure, referencing the D-Bus connection.
	(nih_dbus_pending_data_destroy): Unreference the attached connection.
	* nih-dbus/dbus_pending_data.h: Function typedefs, structure and
	function prototype.
	* nih-dbus/tests/test_dbus_pending_data.c: Test suite.	
	* nih-dbus/libnih-dbus.h: Include the header
	* nih-dbus/Makefile.am (libnih_dbus_la_SOURCES): Build and link
	the new source file
	(nihdbusinclude_HEADERS): Install the header
	(TESTS): Run the test suite
	(test_dbus_pending_data_SOURCES, test_dbus_pending_data_LDFLAGS)
	(test_dbus_pending_data_LDADD): Test suite details.

	* nih-dbus/dbus_object.c (nih_dbus_object_new): Add a comment to
	explain why we don't reference the connection in NihDBusObject.
	* nih-dbus/dbus_object.h (NihDBusObject): Document that no
	reference is held on @conn

2009-05-13  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/method.c (method_proxy_sync_function): Rename the
	message local to method_call and the msg local to message to match
	other functions.
	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function): 
	Update tests to match

	* nih-dbus-tool/method.c (method_proxy_sync_function): Unreference
	the D-Bus method call we're building, not the message we'll return.
	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function):
	Adjust output functions to account for the change.

	* nih-dbus-tool/method.c (method_object_function): We can't just
	use a do { .. } while (0) loop and continue in the case of ENOMEM
	because that won't work for arrays.  Instead use a local label to
	goto the continuation of an outer loop like we do in
	method_proxy_sync_function()
	* nih-dbus-tool/tests/test_method.c (test_object_function): Adjust
	output tests to account for the change.

	* nih-dbus-tool/tests/test_method.c (test_object_function)
	(test_reply_function): Add tests for argument-less methods.
	* nih-dbus-tool/tests/test_signal.c (test_emit_function): Add
	test for argument-less signal, and missing test for deprecated
	signals.
	* nih-dbus-tool/tests/test_property.c (test_object_get_function)
	(test_object_set_function): Add missing tests for deprecated
	properties.
	* nih-dbus-tool/method.c (method_object_function)
	(method_reply_function): Build the assert block up as we go
	* nih-dbus-tool/signal.c (signal_emit_function): Build up the
	assert block as we go.

	* nih-dbus-tool/method.c (method_proxy_sync_function): Generate a
	function to make a synchronous method call to a remote D-Bus object.
	* nih-dbus-tool/method.h: Prototype.
	* nih-dbus-tool/tests/method_factory.c: Use the function to
	generate a function for testing
	* nih-dbus-tool/tests/method_code.h: Add expected prototype of
	generated function.
	* nih-dbus-tool/tests/test_method.c (test_proxy_sync_function): Test
	the generator function and the generated function.

	* nih-dbus/dbus_message.c (nih_dbus_message_new): Pass parent to
	nih_new() not NULL.

	* nih/error.h (nih_error_raise_no_memory): Finally succum and
	add this macro.
	(nih_return_no_memory_error): Use that macro in this.
	* nih/tests/test_error.c (test_raise_no_memory): Add test case.

2009-05-12  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/method_factory.c,
	* nih-dbus-tool/tests/signal_factory.c,
	* nih-dbus-tool/tests/property_factory.c: Use the returned externs
	list for the prototypes, rather than hard-coding them.

	* nih-dbus-tool/type.c (type_to_static, type_to_extern): Methods
	to prepend "static" and "extern" onto a type.
	* nih-dbus-tool/type.h: Prototypes.
	* nih-dbus-tool/tests/test_type.c (test_to_static)
	(test_to_extern): Test the methods.

	* nih-dbus-tool/tests/test_parse.c (test_parse_xml): Update due to
	change in error from D-Bus 1.2.14

	* nih-dbus-tool/method.c (method_object_function)
	(method_reply_function): Replace the hand-coded function layout code
	with a call to type_func_to_string()
	* nih-dbus-tool/tests/test_method.c (test_object_function)
	(test_reply_function): Adjust tests to account for the indentation
	differences.
	* nih-dbus-tool/signal.c (signal_emit_function): Replace code
	* nih-dbus-tool/tests/test_signal.c (test_emit_function): Adjust tests
	* nih-dbus-tool/property.c (property_object_get_function)
	(property_object_set_function): Replace code
	* nih-dbus-tool/tests/test_property.c (test_object_get_function)
	(test_object_set_function): Adjust tests

2009-05-11  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/property.c (property_get_function, property_set_function):
	Accept list arguments for prototypes and externs, filling them in.
	* nih-dbus-tool/property.h: Adjust prototypes.
	* nih-dbus-tool/tests/property_factory.c: Pass in the prototypes
	and extern lists, but don't actually use them just yet.
	* nih-dbus-tool/tests/test_property.c (test_get_function)
	(test_set_function): Add tests for returned prototype, including
	a test for not having a deprecated attribute.

	* nih-dbus-tool/signal.c (signal_reply_function): Accept list
	arguments for prototypes and externs, filling in the prototypes
	one.
	* nih-dbus-tool/signal.h: Adjust prototype.
	* nih-dbus-tool/tests/signal_factory.c: Pass in the prototypes
	and extern lists, but don't actually use them just yet.
	* nih-dbus-tool/tests/test_signal.c (test_reply_function): Add
	tests for returned prototype, including a test for not having a
	deprecated attribute.

	* nih-dbus-tool/demarshal.c (demarshal_array),
	* nih-dbus-tool/marshal.c (marshal_array),
	* nih-dbus-tool/method.c (method_object_function)
	(method_reply_function),
	* nih-dbus-tool/signal.c (signal_emit_function),
	* nih-dbus-tool/property.c (property_object_get_function)
	(property_object_set_function): Line-up variable blocks.
	* nih-dbus-tool/tests/test_demarshal.c (test_demarshal),
	* nih-dbus-tool/tests/test_marshal.c (test_marshal),
	* nih-dbus-tool/tests/test_method.c (test_object_function)
	(test_reply_function): 
	* nih-dbus-tool/tests/test_signal.c (test_emit_function): 
	* nih-dbus-tool/tests/test_property.c (test_object_get_function): 
	Adjust string output checks for the slight difference in indentation

	* nih-dbus-tool/type.c (type_func_to_string, type_func_layout):
	Functions to convert TypeFunc entries into strings.
	* nih-dbus-tool/type.h: Add prototypes.
	* nih-dbus-tool/tests/test_type.c (test_func_to_string)
	(test_func_layout): Test cases for the functions.

2009-05-10  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/type.c (type_var_to_string, type_var_layout):
	Functions to convert TypeVar entries into strings.
	* nih-dbus-tool/type.h: Prototypes.
	* nih-dbus-tool/tests/test_type.c (test_var_to_string)
	(test_var_layout): Test cases.

	* nih-dbus-tool/tests/test_marshal.c (test_marshal): Make sure
	the input and local variable parents are correct, and make sure the
	lists are empty in case of memory error.
	* nih-dbus-tool/tests/test_demarshal.c (test_demarshal): Make sure
	the output and local variable parents are correct, and make sure the
	lists are empty in case of memory error.

	* nih-dbus-tool/method.c (method_reply_function): Accept list
	arguments for prototypes and externs, filling in the prototypes
	one.
	* nih-dbus-tool/method.h: Adjust prototype.
	* nih-dbus-tool/tests/method_factory.c: Pass in the prototypes
	and extern lists, but don't actually use them just yet.
	* nih-dbus-tool/tests/test_method.c (test_reply_function): Add
	tests for returned prototype, including a test for not having a
	deprecated attribute.

	* nih-dbus-tool/method.c (method_object_function): Accept list
	arguments for prototypes and externs.
	* nih-dbus-tool/method.h: Add prototype.
	* nih-dbus-tool/tests/method_factory.c: Pass in the prototypes
	and extern lists, but don't actually use them just yet.x
	* nih-dbus-tool/tests/test_method.c (test_object_function): Add
	tests for returned prototype, and add a test for not having a
	deprecated attribute

	* nih-dbus-tool/type.h (TypeFunc): Structure to represent a function
	definition.
	* nih-dbus-tool/type.c (type_func_new): Function to create a new
	TypeFunc structure.
	* nih-dbus-tool/tests/test_type.c (test_func_new): Test for the
	function.

2009-05-09  Scott James Remnant  <scott@netsplit.com>

	* nih/error.c (nih_error_steal): Add a new function to get an
	error and remove it from the context, needed for stashing errors
	while trying something else - or raising an error outside of a
	context.
	* nih/error.h: Add prototype.
	* nih/tests/test_error.c (test_steal): Add test cases.

	* nih/error.h: Update documentation.

	* TODO: Update.

	* nih/main.c (nih_main_daemonise): Don't just ignore the raised
	error when we fail to write the pid file, at least warn about it.
	* nih/tests/test_main.c (test_daemonise): Hide the output from
	nih_main_daemonise() which will usually bitch about permissions

	* nih/tests/test_io.c (test_watcher): In various tests, we close
	the file descriptor when reading or writing and check for an error
	being raised - but had forgotten that we'd get the error again
	when the structure is closed as it tries to close the descriptor
	(test_message_recv, test_message_send, test_reopen)
	(test_destroy): Add a few contexts around critical bits to make
	sure we're not leaking any other errors.

	* nih/error.c (nih_error_clear): Make an unhandled error an
	assertion failure
	* nih/tests/test_error.c (test_pop_context): Make sure the
	unhandled error is asserted
	(test_raise_error): Make sure a double-raise is asserted.

	* nih/error.c (nih_error_clear): Allow the function to be called
	when there is no current error in the context
	(nih_error_init): Register as an atexit() function so that unhandled
	errors are caught when the process exits.
	(_nih_error_raise_error, nih_error_pop_context): Don't double check,
	just call the function to clear the context.

	* nih/error.c (_nih_error_raise_error): Don't allow the same
	error to be raised twice anymore.
	* nih/tests/test_error.c (test_pop_context): No need to raise the
	error twice.
	* nih/io.c (nih_io_watcher): Don't double-raise the error.
	* nih/watch.c (nih_watch_add): Again, don't double-raise the error
	* nih/tests/test_file.c (my_error_handler): No need to double-raise
	* nih-dbus-tool/annotation.c (annotation_start_tag): Don't need
	to double-raise either

	* nih/error.h (NIH_SHOULD): We don't need to raise the error again,
	simply don't free it.
	* nih/error.c (_nih_error_raise_error): Don't accept a NULL
	filename anymore.

	* nih/error.c (_nih_error_raise, _nih_error_raise_printf)
	(_nih_error_raise_system): Don't make the error a child of the
	context.

	* nih/error.h (NihError): Add filename, line and function members
	set when the error is raised.
	(NIH_SHOULD): Re-raise using _nih_error_raise_error() directly
	passing NULL for the filename and such so it's not overwritten (this
	is a temporary hack)
	(nih_error_raise, nih_error_raise_printf)
	(nih_error_raise_system, nih_error_raise_error): Macros to wrap the
	underlying functions passing the filename, line and function name
	in which they were expanded.
	* nih/error.c (nih_error_raise, nih_error_raise_printf)
	(nih_error_raise_system, nih_error_raise_error): Rename to have
	an initial underscore, accepting filename, line and function
	arguments from the wrapping macros.
	(_nih_error_raise_error): Set the filename, line and function
	members of the raised error (we just overwrite these).
	(nih_error_clear): Report where the unhandled error came from.

	* nih/error.c (nih_error_destroy): Add destructor functions for error
	messages, this clears the error from the current error context.
	(nih_error_raise_error): Set the destructor.
	(nih_error_clear): Assert that the destructor frees the error, don't
	do it ourselves.
	(nih_error_get): Do not clear the error from the context.
	(nih_error_raise_error): Check for the error being double-raised
	which is currently permitted.

2009-05-07  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/annotation.c (annotation_start_tag): Update
	error call to nih_error_raise_error().

	* nih/tests/test_error.c (test_raise_error): Use TEST_ALLOC_FAIL
	and a separate error context for each test.

	* nih/error.c (nih_error_raise_again): Rename to nih_error_raise_error()
	(nih_error_raise, nih_error_raise_printf)
	(nih_error_raise_system): Update calling.
	* nih/error.h (NIH_SHOULD): Update calling.
	Update prototype.
	* nih/tests/test_error.c (test_raise_again): Rename and change calls.
	* nih/io.c (nih_io_watcher): Update call.
	* nih/watch.c (nih_watch_add): Update call.
	* nih/tests/test_file.c (my_error_handler): Update call.
	* nih-dbus/dbus_error.c (nih_dbus_error_raise)
	(nih_dbus_error_raise_printf): Update calls.

2009-04-28  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/marshal.c (marshal_array, marshal_struct): We
	have to close a container in out-of-memory situations, unrefing
	the message isn't sufficient.
	* nih-dbus-tool/tests/test_marshal.c (test_marshal): Make sure
	all those containers are closed.
	* nih-dbus-tool/tests/test_method.c (test_object_function)
	(test_reply_function): Make sure containers called from method
	functions are closed on error too
	* nih-dbus-tool/property.c (property_object_get_function): Close
	containers in case of out-of-memory error.
	* nih-dbus-tool/tests/test_property.c (test_object_get_function): 
	Make sure the close container code is added.

	* nih-dbus/tests/test_dbus_object.c (test_object_message): Add a
	test where the first handler declines
	(test_object_property_set): Make sure that the Set handler cannot
	decline, as we can't do the same for the Get handler.
	* nih-dbus/dbus_object.c (nih_dbus_object_message): Move onto the
	next handler if the handler declines.

	* nih-dbus-tool/Makefile.am (nih_dbus_tool_LDADD)
	(test_method_LDADD, test_signal_LDADD)
	(test_com_netsplit_Nih_Test_object_LDADD)
	(test_com_netsplit_Nih_Test_proxy_LDADD): Always put libnih.la
	after libnih-dbus.la

	* nih-dbus/dbus_object.h (NihDBusMethod): Move the method handler
	to be the last member.
	* nih-dbus/tests/test_dbus_object.c: Update.
	* nih-dbus-tool/nih_dbus_tool.py (Interface.methodsArray): Update.

	* nih-dbus/Makefile.am (libnih_dbus_la_LIBS): Include libnih.la
	as it's a dependency.
	(test_dbus_error_LDADD, test_dbus_connection_LDADD)
	(test_dbus_message_LDADD, test_dbus_object_LDADD)
	(test_dbus_proxy_LDADD, test_dbus_util_LDADD): Specify libnih-dbus.la
	first since it's what we're testing, and deps go the other way

	* nih-dbus/tests/test_dbus_object.c (test_object_introspect): Add
	a missing test case for too many arguments to the Introspect call.
	* nih-dbus/dbus_object.c (nih_dbus_object_introspect): Which reveals
	we didn't catch this.

	* nih-dbus/tests/test_dbus_object.c (test_object_property_get)
	(test_object_property_get_all, test_object_property_set): Add
	missing test cases for argument errors.

	* nih-dbus/dbus_object.c (nih_dbus_object_property_get_all): Add
	function to retrieve all properties at once.
	(nih_dbus_object_message): Call out to it.
	* nih-dbus/tests/test_dbus_object.c (test_object_property_get_all):
	Test the new function.

	* nih-dbus/dbus_object.h (NihDBusPropertyGetter)
	(NihDBusPropertySetter): Add function typedefs for property get
	and set functions.
	(NihDBusProperty): Add getter and setter members.
	* nih-dbus/dbus_object.c (nih_dbus_object_property_get)
	(nih_dbus_object_property_set): Functions to handle calling the
	getter and setter functions for a single property Get or Set method.
	(nih_dbus_object_message): Call out to the new functions.
	* nih-dbus/tests/test_dbus_object.c (test_object_property_get)
	(test_object_property_set): Test the new single property get/set
	functions.

	* nih-dbus/dbus_object.h (NihDBusMarshaller): Rename to
	NihDBusMethodHandler, since this prototype only applies to methods
	and not to properties.
	(nih_dbus_method): Change type and name of marshaller member to
	handler.
	* nih-dbus/dbus_object.c (nih_dbus_object_message): Update name
	of function pointer member we use.
	* nih-dbus/tests/test_dbus_object.c: Avoid using the word "marshal"
	and use "handler" instead.

	* nih-dbus/dbus_object.c (nih_dbus_object_introspect): Put the
	Introspect interface last, since it's the least important one;
	we always want the object's own interfaces first, followed by
	properties, followed by introspection, followed by children nodes.
	* nih-dbus/tests/test_dbus_object.c (test_object_introspect):
	Update tests to match.

	* nih-dbus/tests/test_dbus_object.c (test_object_message): Split
	out the introspection test cases into a new function.
	(test_object_introspect): Add a test for having no properties.

	* nih-dbus/tests/test_dbus_object.c (test_object_new)
	(test_object_destroy, test_object_unregister)
	(test_object_message): Convert to test using TEST_DBUS rather than
	a hodge-podge of different buses and servers.

	* nih-dbus/test_dbus.h (TEST_DBUS_DISPATCH): Equivalent to
	TEST_DBUS_MESSAGE but dispatches the message internally rather
	than stealing it.

	* nih-dbus/tests/test_dbus_connection.c (test_connect): Add tests
	for a fake disconnected signal (as much as we can test anyway).

2009-04-27  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/dbus_connection.h: Note on allocation.

	* nih-dbus/dbus_message.h: Add documentation string.

	* nih-dbus/tests/test_dbus_message.c (test_message_new): Add missing
	call to dbus_shutdown() after test case.
	(test_message_error): Rewrite using TEST_DBUS and using
	TEST_ALLOC_FAIL to check for memory issues.

	* nih-dbus/dbus_connection.h: Add documentation.

	* nih-dbus/dbus_connection.c (nih_dbus_setup): We actually want
	to attempt to setup the watch, timeout and wake-up functions each
	time through nih_dbus_setup() so it can be called in a loop in
	cases of out-of-memory so do this first before setting the main
	loop function, and unwind in case of error.
	(nih_dbus_watch_toggled): D-Bus could try and change the flags
	with a toggle?

	* nih-dbus/dbus_connection.h (NihDBusConnectHandler): Add missing
	Returns to documentation string.

	* nih-dbus/dbus_error.h: Add documentation string.

	* nih-dbus/dbus_connection.c (nih_dbus_connect, nih_dbus_bus):
	Clarify that it's ok to unreference a connection obtained with
	these functions - indeed we do so everywhere in the test suite.

	* nih-dbus/dbus_connection.c (nih_dbus_connect, nih_dbus_bus)
	(nih_dbus_server): Return ENOMEM raised on insufficient memory
	rather than the D-Bus equivalent; we don't just convert these
	everywhere because sometimes we want to know that it's the
	remote side that's out of memory and we don't want to use ENOMEM
	for that.

	* nih-dbus/tests/test_dbus_connection.c: Various cleanup fixes,
	making sure we unref everything that we use.  Increase timeout
	for method calls since things get slower when under valgrind.

	* nih-dbus/dbus_connection.c (nih_dbus_connection_disconnected):
	Push an error context while calling the handler.
	(nih_dbus_new_connection): Push an error context while calling
	the handler.

	* nih/timer.c (nih_timer_poll): The timer callback can free the
	timer, so we need to adjust the due time before we call it.  In
	the case of timeouts, we hold a reference while calling and
	always free after returning.  Also push an error context during
	it so we don't leak errors.

2009-04-24  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/tests/test_dbus_connection.c (test_connect): Add tests
	for a method call being made and its reply received through the
	main loop, and for a method call timing out within the main loop.
	This exercises the watch and timeout functions.

2009-04-23  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/tests/test_dbus_connection.c (test_server): Add tests
	for address in use,

	* nih/tests/test_logging.c (my_logger): Safely strdup the message.
	(test_set_logger, test_set_priority, test_log_message): Make sure
	all calls are wrapped with TEST_ALLOC_FAIL
	(test_logger_printf): Call TEST_ALLOC_FAIL for everything.

	* nih/Makefile.am (.PHONY): Mark tests phony.
	* nih-dbus/Makefile.am (.PHONY): Mark tests phony.
	* nih-dbus-tool/Makefile.am (.PHONY): Mark tests phony.

	* nih-dbus/Makefile.am (libnih_dbus_la_CFLAGS, AM_CFLAGS): Replace
	the former with the latter.
	(test_dbus_error_CFLAGS, test_dbus_connection_LDFLAGS)
	(test_dbus_message_CFLAGS, test_dbus_object_CFLAGS)
	(test_dbus_proxy_CFLAGS, test_dbus_util_CFLAGS): Remove.

	* nih-dbus/tests/test_dbus_connection.c: Wrap every test in
	NIH_ALLOC_FAIL, to properly make sure that we handle failure
	cases properly.
	* nih-dbus/dbus_connection.c (nih_dbus_server): Disconnect the
	server before unreferencing it.

2009-04-22  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/nih_dbus_tool.py (Method.marshalFunction): Also fix
	async method handler return to match.

	* nih-dbus-tool/tests/test_main.c,
	* nih-dbus-tool/tests/test_node.c,
	* nih-dbus-tool/tests/test_interface.c,
	* nih-dbus-tool/tests/test_method.c,
	* nih-dbus-tool/tests/test_signal.c,
	* nih-dbus-tool/tests/test_property.c,
	* nih-dbus-tool/tests/test_argument.c,
	* nih-dbus-tool/tests/test_annotation.c,
	* nih-dbus-tool/tests/test_parse.c: All tests cases should use
	TEST_ALLOC_FAIL, even the ones testing for errors.  To get around
	situations where some allocations may be repeated, but others will
	fail, check the return value to see which happened.

2009-04-21  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/tests/test_dbus_message.c (my_return_error): Return
	DBUS_HANDLED_RESULT_HANDLED otherwise the message will be ignored.

	* nih-dbus-tool/property.c (property_object_get_function)
	(property_object_set_function): Generate code for functions to get
	and set, respectively, properties using a handler function.
	* nih-dbus-tool/property.h: Add prototypes.
	* nih-dbus-tool/tests/property_factory.c: Call the two functions
	to generate their resulting property get and set functions and
	place them in a C file for testing.
	* nih-dbus-tool/tests/property_code.h: Expected prototypes for
	generated functions.
	* nih-dbus-tool/tests/test_property.c (test_object_get_function)
	(test_object_set_function): Tests for the code, and for the
	resulting generated code.
	* nih-dbus-tool/Makefile.am (check_PROGRAMS): Run the program
	to generate the C code.
	(property_factory_SOURCES)
	(property_factory_LDFLAGS, property_factory_LDADD)
	(tests/property_code.c): Details for code generator.
	(CLEANFILES): Clean up after.
	(test_property_SOURCES): Link to the generated code.

	* nih-dbus/dbus_object.c: Add missing include for previous commit.

2009-04-20  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/dbus_object.c (nih_dbus_object_message): Call the
	marshaller function inside a context so that errors aren't leaked.

	* nih-dbus/dbus_object.c (nih_dbus_object_message): We don't need
	any special handling for async functions now we have nih_local, the
	function simply needs to reference the message.  Drop the requirement
	that it returns DBUS_HANDLER_RESULT_NOT_YET_HANDLED.
	* nih-dbus-tool/method.c (method_object_function): Always return
	DBUS_HANDLER_RESULT_HANDLED, even for async methods.
	* nih-dbus-tool/tests/test_method.c (test_object_function): Replace
	tests for not yet handled with ones for the ordinary handled result.

2009-04-18  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/signal.c (signal_emit_function): Generate code for
	a function that emits a signal.
	* nih-dbus-tool/signal.h: Add prototype.
	* nih-dbus-tool/tests/signal_factory.c: Call signal_emit_function()
	to generate a signal emission function and place it in a C file
	for testing.
	* nih-dbus-tool/tests/signal_code.h: Expected prototype for generated
	function.
	* nih-dbus-tool/tests/test_signal.c (test_emit_function): Test the
	generator function and generated function.
	* nih-dbus-tool/Makefile.am (check_PROGRAMS): Run the program to
	generate the C code.
	(signal_factory_SOURCES, signal_factory_LDFLAGS)
	(signal_factory_LDADD, tests/signal_code.c): Details for generator
	(CLEANFILES): Clean up after.
	(test_signal_SOURCES): Link to the generated code.

	* nih-dbus-tool/method.c (method_object_function)
	(method_reply_function): Add missing asserts.

2009-04-17  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/test_method.c: Oops, commented out the test.

	* nih-dbus-tool/tests/test_method.c (test_object_function): Add
	test cases for the no reply expected flag on an incoming message.

	* nih-dbus-tool/method.c (method_reply_function): Generate code for
	a function that sends a reply to an asynchronous method call.
	* nih-dbus-tool/method.h: Add prototype.
	* nih-dbus-tool/tests/method_factory.c: Call method_reply_function()
	to generate a reply function and place it in a C file for testing.
	* nih-dbus-tool/tests/method_code.h: Expected prototype.
	* nih-dbus-tool/tests/test_method.c (test_reply_function): Add test
	cases for the code, the generated code, and the no reply expected
	case.

	* nih-dbus-tool/tests/test_method.c (test_object_function): Add
	tests for too many arguments in method call
	* nih-dbus-tool/method.c (method_object_function): Add a block of
	code to check for extra function arguments.

	* nih-dbus-tool/method.c (method_object_function): When the method
	is marked async, ignore the output arguments and don't try and send
	any reply - instead returning the magic "not yet handled" code.
	* nih-dbus-tool/tests/method_factory.c: Generate an async version
	of the same function for testing.
	* nih-dbus-tool/tests/method_code.h: Add prototype
	* nih-dbus-tool/tests/test_method.c (test_object_function): Test
	code generation and the generated code for an asynchronous method.

	* nih-dbus-tool/method.c (method_object_function): Generate code for
	a function that handles an incoming method call, and calls a handler
	function for it.
	* nih-dbus-tool/method.h: Add prototype.
	* nih-dbus-tool/tests/test_method.c (test_object_function): Tests
	cases for the function and the function code it generates.
	* nih-dbus-tool/tests/method_factory.c: Call method_object_function()
	to generate a function, and place it in a C file for testing.
	* nih-dbus-tool/tests/method_code.h: Prototype for generated function.
	* nih-dbus-tool/Makefile.am (check_PROGRAMS): Build the method_factory
	program when running tests
	(nih_dbus_tool_SOURCES, TESTS): Marshalling/demarshalling code now
	has to come before parsing and method code since we use it.
	(method_factory_SOURCES, method_factory_LDFLAGS)
	(method_factory_LDADD, tests/method_code.c): Run the method_factory
	tool to generate tests/method_code.c
	(test_method_SOURCES, test_method_LDADD): Link to the output of
	the method_factory tool
	(CLEANFILES): Clean up
	(test_node_LDADD, test_interface_LDADD, test_signal_LDADD)
	(test_property_LDADD, test_argument_LDADD)
	(test_annotation_LDADD, test_parse_LDADD): Add marshal/demarshal
	object files

2009-04-16  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/tests/marshal_factory.c (marshal_function): Remove
	code to get type which we never use now we have the demarshalling
	function outputs
	* nih-dbus-tool/tests/demarshal_factory.c (demarshal_function): Remove
	code to get type which we never use now we have the marshalling
	function inputs.

	* nih-dbus-tool/demarshal.c (demarshal_basic): Do not make the output
	variable a pointer, when used in method object/signal proxy mode we
	actually have this as a local variable and want the demarshalled
	value placed directly into it.
	(demarshal_array, demarshal_struct): Instead of making the output
	variable a pointer, demarshal into a local and copy that into the
	output variable.
	* nih-dbus-tool/tests/demarshal_factory.c (demarshal_function): Make
	passed in outputs pointers, copy into them after demarshalling
	* nih-dbus-tool/tests/test_demarshal.c (test_demarshal): Make sure
	that const does not appear in the inputs, or comments, but that all
	locals are still const (as they are only copies) even in source.

2009-04-15  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/marshal.c (marshal_basic): Do not make the input
	variable const, when used in method object/signal proxy mode we
	might modify the local variable before passing it to the marshalling
	code so can't have it const.
	(marshal_array, marshal_struct): Instead of making the input
	variable const, make the local we copy into const.
	* nih-dbus-tool/tests/marshal_factory.c (marshal_function): Make
	passed-in inputs const.
	* nih-dbus-tool/tests/test_marshal.c (test_marshal): Make sure that
	const does not appear in the inputs, or comments, but that all locals
	are still const (as they are only copies) even in source.

	* nih-dbus-tool/type.c (type_of): can't pass a size_t to a format
	length, and don't want to cast down to int in case of underrun

	Continue porting the D-Bus binding tool from Python to C, this code
	implements the type marshalling and demarshalling with additional
	support for arrays of arrays of fixed types and structures that the
	Python code never had.

	* nih-dbus-tool/type.c, nih-dbus-tool/type.h: Functions to identify
	C types from D-Bus type signatures, and to handle variable
	declarations
	* nih-dbus-tool/test_type.c: Test cases
	* nih-dbus-tool/marshal.c, nih-dbus-tool/marshal.h: Generate code
	to marshal data from C standard types with given variable names
	into a D-Bus message.
	* nih-dbus-tool/tests/marshal_factory.c: Generate functions that
	contain the generated code for types that we test
	* nih-dbus-tool/tests/marshal_code.h: Header for generated code
	* nih-dbus-tool/tests/test_marshal.c: Test both the output strings
	and the behaviour of the generated code
	* nih-dbus-tool/demarshal.c, nih-dbus-tool/demarshal.h: Generate
	code to demarshal data from a D-Bus message into C standard types
	with requested variable names.
	* nih-dbus-tool/tests/demarshal_factory.c: Generate functions that
	contain the generated code for types that we test
	* nih-dbus-tool/tests/demarshal_code.h: Header for generated code
	* nih-dbus-tool/tests/test_demarshal.c: Test both the output strings
	and the behaviour of the generated code
	* nih-dbus-tool/Makefile.am (nih_dbus_tool_SOURCES): Build and
	link new source files
	(TESTS): Run test cases for new source files
	(test_type_SOURCES, test_type_LDFLAGS, test_type_LDADD)
	(test_marshal_SOURCES, test_marshal_LDFLAGS, test_marshal_LDADD)
	(test_demarshal_SOURCES, test_demarshal_LDFLAGS)
	(test_demarshal_LDADD): Details for test cases.
	(check_PROGRAMS, marshal_factory_SOURCES)
	(marshal_factory_LDFLAGS, marshal_factory_LDADD)
	(tests/marshal_code.c, demarshal_factory_SOURCES)
	(demarshal_factory_LDFLAGS, demarshal_factory_LDADD)
	(tests/demarshal_code.c, CLEANFILES): In order to test the output
	code, we generate a C file containing it and link it to the test
	cases.  This gets cleaned up on "clean" rather than maintainer-clean
	
2009-04-04  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/parse.c (parse_start_tag, parse_xml): Cast return
	value of XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber to
	size_t and use %zu
	* nih-dbus-tool/node.c (node_start_tag): Likewise.
	* nih-dbus-tool/interface.c (interface_start_tag): Likewise.
	* nih-dbus-tool/method.c (method_start_tag): Likewise.
	* nih-dbus-tool/signal.c (signal_start_tag): Likewise.
	* nih-dbus-tool/property.c (property_start_tag): Likewise.
	* nih-dbus-tool/annotation.c (annotation_start_tag): Likewise.
	* nih-dbus-tool/argument.c (argument_start_tag): Likewise.
	(argument_end_tag): Use %zu for the unsigned count, not %zi

2009-03-30  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/main.c (main): open() returns less-than-zero on error
	not zero, which is standard input!

	* nih-dbus-tool/Makefile.am (test_com_netsplit_Nih_Test_object_CFLAGS)
	(test_com_netsplit_Nih_Test_proxy_CFLAGS): Remove the CFLAGS
	overrides, we set this globally in the file.

	* nih-dbus-tool/indent.c (indent): Function to indent the lines in
	a string using the specified number of tabs.
	(comment): Function to prepend the traditional " * " comment prefix
	to the lines in a string.
	* nih-dbus-tool/indent.h: Prototypes.
	* nih-dbus-tool/tests/test_indent.c: Test cases.
	* nih-dbus-tool/Makefile.am (TESTS): Build the indent test cases
	(test_indent_SOURCES, test_indent_LDFLAGS, test_indent_LDADD): Details
	for indent test cases

	* nih-dbus-tool/main.c: Re-order so that the option variables, the
	options list and the main() function can be contained inside a #if
	directive so we can test the rest.
	(source_file_path, header_file_path): Factor out the code from
	main() that generated the source and header file paths so we can
	test; at the same time, fix them so they don't cast ptrdiff_t to int
	and always output to the current working directory unless output_path
	includes one.
	* nih-dbus-tool/tests/test_main.c: Which means we can test the
	mode_option(), source_file_path() and header_file_path() functions
	* nih-dbus-tool/Makefile.am (TESTS): Build and run test_main
	(test_main_SOURCES, test_main_LDFLAGS, test_main_LDADD): usual
	details for test_main, except we use main.c as a SOURCE rather than
	linking in LDADD like we normally do
	(test_main_CFLAGS): Override CFLAGS to set -DTEST, this causes us
	to recompile main.c specially for test_main with the main() function
	#ifdef'd out.

	* nih-dbus/Makefile.am (tests): Move to the bottom of the file
	* nih/Makefile.am (tests): Move to the bottom of the file
	* nih-dbus-tool/Makefile.am (tests): Move to the bottom of the file

	Begin replacing the old Python D-Bus bindings tool with one
	written in C, starting with the code that parses the introspection
	data.

	* nih-dbus-tool/Makefile.am (bin_SCRIPTS, noinst_SCRIPTS)
	(bin_PROGRAMS, noinst_PROGRAMS): Replace the nih-dbus-tool script
	with a program that we need to compile.
	(CLEANFILES, EXTRA_DIST, do_subst, nih-dbus-tool): Drop the rules
	to generate the script by replacing bits out of the Python source
	(nih_dbus_tool_SOURCES, nih_dbus_tool_LDADD): Instead build from
	C sources, and link to libnih, libnih-dbus, expat and libdbus
	(AM_CFLAGS): Require the D-Bus CFLAGS when compiling the tool
	(AM_CPPFLAGS): Include quoted headers from the source directory
	so the test suite can get at them
	(TESTS): Add tests for the various bits of the C tool
	(tests): Rule to generate binaries for the test suite
	(test_symbol_SOURCES, test_symbol_LDFLAGS, test_symbol_LDADD)
	(test_node_SOURCES, test_node_LDFLAGS, test_node_LDADD)
	(test_interface_SOURCES, test_interface_LDFLAGS)
	(test_interface_LDADD, test_method_SOURCES, test_method_LDFLAGS)
	(test_method_LDADD, test_signal_SOURCES, test_signal_LDFLAGS)
	(test_signal_LDADD, test_property_SOURCES)
	(test_property_LDFLAGS, test_property_LDADD)
	(test_argument_SOURCES, test_argument_LDFLAGS)
	(test_argument_LDADD, test_annotation_SOURCES)
	(test_annotation_LDFLAGS, test_annotation_LDADD)
	(test_parse_SOURCES, test_parse_LDFLAGS, test_parse_LDADD): Test
	suite details
	* nih-dbus-tool/main.c, nih-dbus-tool/symbol.c, nih-dbus-tool/symbol.h,
	nih-dbus-tool/tests/test_symbol.c, nih-dbus-tool/node.c,
	nih-dbus-tool/node.h, nih-dbus-tool/tests/test_node.c,
	nih-dbus-tool/interface.c, nih-dbus-tool/interface.h,
	nih-dbus-tool/tests/test_interface.c, nih-dbus-tool/method.c,
	nih-dbus-tool/method.h, nih-dbus-tool/tests/test_method.c,
	nih-dbus-tool/signal.c, nih-dbus-tool/signal.h,
	nih-dbus-tool/tests/test_signal.c, nih-dbus-tool/property.c,
	nih-dbus-tool/property.h, nih-dbus-tool/tests/test_property.c,
	nih-dbus-tool/argument.c, nih-dbus-tool/argument.h,
	nih-dbus-tool/tests/test_argument.c, nih-dbus-tool/annotation.c,
	nih-dbus-tool/annotation.h, nih-dbus-tool/tests/test_annotation.h,
	nih-dbus-tool/parse.c, nih-dbus-tool/parse.h,
	nih-dbus-tool/tests/test_parse.c, nih-dbus-tool/errors.h: Source
	for the tool
	* m4/misc.m4 (NIH_INIT): Explicitly check for pkg-config 0.22
	* m4/libs.m4 (NIH_LIB_DBUS): Replace check for Python with a check
	for the expat library, removing the HAVE_PYTHON conditional
	entirely.  Update required D-Bus version to 1.2.4
	* README: Update dependencies documentation

2009-03-27  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c (nih_file_read, nih_file_map): Cast to the bigger type.

	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c: Add missing
	signal.h include.

	* m4/compiler.m4: Add -Wextra, but turn off some of the silly ones.
	* nih/io.c (nih_io_buffer_resize): Remove unnecessary assert.
	* nih/file.c (nih_file_read, nih_file_map): Be explicit when
	comparing signed and unsigned types.
	* nih/option.c (nih_option_long): Cast pointer difference to size_t
	(nih_option_group_help): Use unsigned constant.
	* nih/command.c (nih_command_group_help): Use unsigned constant.
	* nih/tests/test_config.c (test_parse_stanza): Cast -1 to size_t
	to get the real number.
	* nih-dbus/dbus_object.c (nih_dbus_object_vtable): Move static to
	before const.
	* nih-dbus/tests/test_dbus_message.c (my_error_connect): Put
	static before const.

2009-03-22  Scott James Remnant  <scott@netsplit.com>

	* nih/Makefile.am (tests): Add rule to build all test cases without
	running them (useful when using valgrind).
	* nih-dbus/Makefile.am (tests): Add the same rule.

	* nih/test_values.h (TEST_EQ_STR, TEST_EQ_STRN, TEST_EQ_MEM)
	(TEST_NE_STR, TEST_NE_STRN, TEST_NE_MEM): Guard against NULL being
	parsed.
	* nih/test_alloc.h (TEST_ALLOC_SIZE, TEST_ALLOC_PARENT)
	(TEST_ALLOC_ORPHAN): Also guard against NULL for these.

	* nih/test_files.h (TEST_FILE_MATCH): Add test that lets us match
	the content of a file line against a wildcard pattern.

2009-02-20  Scott James Remnant  <scott@netsplit.com>

	* nih/option.c (nih_option_help),
	* nih/command.c (nih_command_help),
	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c (my_str_to_int32_array): 
	No need for a new_* temporary variable when looping over nih_realloc
	with NIH_MUST.

	* nihify: Add nih-dbus-tool symlink too

	* nih/watch.c (nih_watch_new): Update to set variable outside of
	NIH_SHOULD and NIH_MUST macros.
	(nih_watch_add, nih_watch_handle),
	* nih/alloc.c (nih_alloc_ref_new),
	* nih/timer.c (nih_timer_init),
	* nih/signal.c (nih_signal_init),
	* nih/child.c (nih_child_init),
	* nih/io.c (nih_io_init),
	* nih/file.c (nih_dir_walk, nih_dir_walk_scan)
	(nih_dir_walk_visit),
	* nih/main.c (nih_main_init_full, nih_main_version)
	(nih_main_set_pidfile, nih_main_get_pidfile)
	(nih_main_write_pidfile, nih_main_loop_init),
	* nih/option.c (nih_option_parser, nih_option_handle_arg)
	(nih_option_join, nih_option_help, nih_option_group_help),
	* nih/command.c (nih_command_parser, nih_command_join)
	(nih_command_help, nih_command_group_help),
	* nih/logging.c (nih_log_message),
	* nih/error.c (nih_error_init, nih_error_raise)
	(nih_error_raise_printf, nih_error_raise_system)
	(nih_error_push_context),
	* nih/tests/test_string.c (test_array_copy, test_array_append),
	* nih/tests/test_watch.c (my_create_handler, my_modify_handler)
	(my_delete_handler),
	* nih-dbus/dbus_error.c (nih_dbus_error_raise)
	(nih_dbus_error_raise_printf),
	* nih-dbus-tool/tests/com.netsplit.Nih.Test_impl.c ()
	(my_test_async_method, my_str_to_int32_array): Update to set
	variable outside of NIH_MUST macro.

2009-02-20  Casey Dahlin  <cdahlin@redhat.com>

	* nih/macros.h (NIH_MUST, NIH_ZERO): Use the GCC statement
	expression extension (also used by nih_min and nih_max) to allow
	these macros to return the value of their expression.
	* nih/error.h (NIH_SHOULD): Also return its value.

2009-02-20  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus-tool/Makefile.am (test_com_netsplit_Nih_Test_object_LDADD)
	(test_com_netsplit_Nih_Test_proxy_LDADD): Fix path to libnih-dbus.la

	* nih/option.c (nih_option_parser): Fix a bug where a lone dash
	would be eaten instead of treated as an argument
	* nih/tests/test_option.c (test_parser): Add test case

	* nih/option.c (nih_option_help): Support the bugs address being
	a URL, and slightly change the wording we use.

	* nih/libnih.ver: We have to export anything beginning _nih_* and
	the program_name and package_* variables.

	* configure.ac (AC_INIT): Give bugs address as a URL

2009-01-30  Scott James Remnant  <scott@netsplit.com>

	* Makefile.am (SUBDIRS): po needs to be last, so always append

	* configure.ac: Create nih-dbus-tool Makefile
	* Makefile.am (SUBDIRS): Add nih-dbus-tool sub-directory
	* nih-dbus-tool/Makefile.am: Include rules to create nih-dbus-tool
	and its tests
	* nih-dbus/Makefile.am: Remove those rules from here
	* nih-dbus/nih_dbus_tool.py: Move to nih-dbus-tool/nih_dbus_tool.py
	* nih-dbus/tests/com.netsplit.Nih.Test.xml,
	nih-dbus/tests/com.netsplit.Nih.Test_impl.c,
	nih-dbus/tests/com.netsplit.Nih.Test_impl.h,
	nih-dbus/tests/test_com.netsplit.Nih.Test_object.c,
	nih-dbus/tests/test_com.netsplit.Nih.Test_proxy.c: Move to
	nih-dbus-tool/tests
	
	* Makefile.am (SUBDIRS): conditionally add the nih-dbus directory
	depending on HAVE_DBUS
	* nih-dbus/Makefile.am: which means we don't have to conditionalise
	anything in this file, cleaning things up a bit.

2009-01-29  Scott James Remnant  <scott@netsplit.com>

	* nih-dbus/tests/test_com.netsplit.Nih.Test_proxy.c (test_method_dispatch): 
	Fix the test case to not compare a void * with strcmp

2008-01-29  Casey Dahlin  <cdahlin@redhat.com>

	* nih/nih_dbus_tool.py (Method.asyncDispatchPrototype): Prototype for
	new asynchronous dispatch function, explained below.
	(Method.asyncDispatchFunction): The asynchronous dispatch function
	takes a proxy, the arguments to the given method, a callback and an
	"errback" function pointer, and a void pointer. It calls the DBus
	method, but does not wait for a reply. Instead it sets up the
	callback to be called upon reply. If an error occurs, the errback
	is called instead. Either function will recieve the proxy and the
	value in the void pointer as arguments. The normal callback also
	receives arguments for anything returned by the method.
	(Method.asyncNotifyPrototype): Prototype for new asynchronous
	notification function. See below.
	(Method.asyncNotifyFunction): When the asynchronous dispatch function
	sets up a method call, it specifies the function generated by this
	function as the callback, and passes it an NihAsyncNotifyData struct
	containing the user-provided callback and errback. The asynchronous
	notify function then sets up the error to be handled by the errback
	or marshalls the return values to the callback.
	(Generator.exportTypedefs): This function returns a list of tuples
	* nih-dbus/tests/test_com.netsplit.Nih.Test_proxy.c (test_method_dispatch): 
	of (type, name, args) format for typedefs to be placed in the
	generated header file. Args is present for defining function
	arguments for function pointer typedefs.
	(lineup_typedefs): Works like the other lineup_*s. Outputs typedef
	text from (type, name, args) tuples (see above) in a prettified,
	well-spaced format.
	(typedef_lineup_prefix): Used to make names line up well in
	lineup_typedefs. If a string begins with (* it is returned as is.
	If it begins with * it is returned with one leading space. Otherwise
	it gets two leading spaces.
	* nih-dbus/tests/test_com.netsplit.Nih.Test_proxy.c (test_method_dispatch): 
	Test asynchronous method dispatch

2009-01-29  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_alloc_real_set_destructor): Does not modify the
	actual data, so the pointer can be const.
	(nih_ref): Does not modify the actual data, so the pointer can be
	const.
	(nih_unref_only): Does not modify the actual data, and unlike
	nih_unref(), does not free it; so the pointer can be const
	* nih/alloc.h: Update prototypes.

	* configure.ac: Bump version to 0.2.1
	* NEWS: Begin 0.2.1

	* NEWS: Update

	* nih/test_alloc.h (TEST_ALLOC_FAIL): Initialise the count in the
	loop pre-condition, still doesn't solve gcc's issues but I prefer
	it.

	* nih/tests/test_command.c (test_help): Array was too small, increase
	the size.

	* nih/tests/test_string.c (test_str_split): Oops, left some debugging
	in here.

	* nih/file.c (nih_file_read): Never trust a changelog entry that
	says "minor clean-up"; make sure we raise the error before returning
	NULL.

	* nih-dbus/dbus_connection.c (nih_dbus_setup)
	(nih_dbus_add_watch, nih_dbus_add_timeout): We should discard
	objects attached to the D-Bus connection since they're floating;
	nobody should take a reference, but good practice and all that.

	* nih/alloc.h: Document the different usage patterns

	* nih/io.c (nih_io_buffer_resize): Use nih_unref() instead of
	nih_free(), while nothing should have taken a reference, it's a
	good pattern to stick to.
	(nih_io_message_recv): Use nih_local for ctrl_buf
	(nih_io_message_send): Use nih_local for ctrl_buf
	(nih_io_send_message): Take a reference to messages on the send q
	(nih_io_watcher_write): Unreference the message from the NihIo
	object instead of freeing, in case a reference is used elsewhere
	(nih_io_read): Unreference instead of freeing
	(nih_io_get): Unreference instead of freeing
	(nih_io_message_new): Parent should not be the NihIo
	(nih_io_write): Obey that rule here

	* nih/tests/test_io.c (test_send_message): Make sure that a
	reference is taken after all.
	(test_watcher): Don't create object with parent as io

	* nih/file.c (nih_file_read): Minor clean-up

	* nih/main.c (nih_main_set_pidfile): Discard the pid file in case
	someone took a reference to it.

	* nih/main.c (nih_main_init_full): Discard the package string in
	case another part of the code has taken a reference to it; since
	it never changes unless this function is called, generate it here
	(nih_main_package_string): dropping this function
	(nih_main_version): Fetch package_string
	* nih/main.h: Add external package_string and drop function proto.
	* nih/tests/test_main.c (test_package_string): Fold these tests into
	(test_init): here.
	* nih/libnih.supp: Update suppression

	* nih/logging.c (nih_log_message): Use nih_local for message

	* nih/io.c (nih_io_printf): Use nih_local for str

	* nih/config.c (nih_config_parse_stanza): Use nih_local for name.

2009-01-28  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c (nih_dir_walk_visit): Can't allocate nih_local var
	with a parent, otherwise it'll never be cleaned up.

	* nih/config.c (nih_config_parse): Initialise nih_local var to NULL.

	* nih/alloc.c (nih_alloc_context_free): After the destructor has
	been called, an object is dead.  Attempting to reference it should
	fail, so we need to store a flag that this has happened.
	(nih_realloc, nih_free, nih_discard, nih_alloc_real_set_destructor)
	(nih_alloc_ref_new, nih_unref, nih_alloc_parent)
	(nih_alloc_ref_lookup, nih_alloc_size): Forbid operations on
	finalised objects.

	* nih/tests/test_alloc.c (test_free): Once again I've tripped over
	bugs where the ordering of allocations between siblings in a child
	matters if they refer to each other in their destructor (typical
	case, a hash table in a struct).
	* nih/alloc.c (nih_realloc, nih_alloc_ref_new): Reverse the free
	order, so that the last member allocated is the first one freed.
	This was the original fix for the above bug, but this just moves
	the problem without really fixing it.  I do think it's generally
	correct that the order should be backwards though.
	(nih_free): Since this is the only function that needs to do it,
	take care of casting off parents here.
	(nih_unref): Again, since this is the only function that needs
	to free the context when there are no parents, do it here after
	freeing the reference.
	(nih_alloc_ref_free): Which means this function no longer needs
	to recurse; nih_free() and nih_discard() always directly free a
	context, and nih_unref() knows to if there are no parents left;
	nih_unref() explicitly doesn't free the context.
	(nih_unref_only): No need to pass FALSE to nih_alloc_ref_free() now.
	(nih_alloc_context_free): This gets the big rewrite; rather than
	just recursively freeing the heirarchy, finalise them first by
	calling destructors and then reparenting them to the context
	being freed.  Only free the objects after all destructors are called.

	* nih/macros.h (MIN, MAX): Replace with newer evaluation-safe
	nih_min() and nih_max()
	* nih/io.c (nih_io_select_fds): Replace MAX with nih_max
	(nih_io_buffer_pop): Replace MIN with nih_min
	(nih_io_buffer_shrink): Replace MIN with nih_min
	* nih/command.c (nih_command_group_help): Replace MAX with nih_max,
	nicely avoiding multiple function call there.
	* nih/option.c (nih_option_group_help): Likewise.
	* nih/tests/test_io.c (test_select_fds): Replace MAX with nih_max

	* nih-dbus/nih_dbus_tool.py (Method.replyFunction): Don't free the
	message passed in to the function.  Since we now require the handler
	function to take a reference to the message during async processing,
	we can't just go around freeing it.
	(Method.replyPrototype): Warn if the error from the reply function
	is ignored, since this is important.
	* nih-dbus/dbus_message.c (nih_dbus_message_error): Likewise we
	should not free the message when passed in for a caller either.
	* nih-dbus/tests/test_dbus_message.c (my_return_error_cb): Update
	to make sure the message is not freed.
	* nih-dbus/tests/com.netsplit.Nih.Test_impl.c (async_method_reply):
	Make sure message is not freed.
	* NEWS: Document the change

2009-01-26  Scott James Remnant  <scott@netsplit.com>

	* configure.ac: Officially mandate libtool 2.2
	* HACKING: Bump dependency on libtool to 2.2.4
	* NEWS: Document change.

	* configure.ac (AC_INIT): Bump version to 0.2.0 since we're making
	a number of large API changes.
	(AC_COPYRIGHT): Bump the copyright year too.
	* NEWS (0.1.0): Declare 0.1.0 to have happened at revision 600 before
	we started the most recent round of changes; this is the version
	shipped with Upstart 0.5 but with the fixed list iteration.
	(0.2.0): Begin documenting changes in the API since then; this file
	can therefore be used as a checklist for updating software.

	* nih-dbus/dbus.c, nih-dbus/dbus.h: Seperate out the code into
	separate files to make maintenance much easier.  The new files are
	nih-dbus/dbus_error.c, nih-dbus/dbus_error.h,
	nih-dbus/dbus_connection.c, nih-dbus/dbus_connection.h,
	nih-dbus/dbus_message.c, nih-dbus/dbus_message.h,
	nih-dbus/dbus_object.c, nih-dbus/dbus_object.h,
	nih-dbus/dbus_proxy.c, nih-dbus/dbus_proxy.h,
	nih-dbus/dbus_util.c, nih-dbus/dbus_util.h.
	* nih-dbus/nih_dbus_tool.py (Output.sourceFile): Change include
	to separate ones for error, message, object and proxy.
	(Output.headerFile): Change include to separate ones for message,
	object and proxy.
	* nih-dbus/dbus_message.c (nih_dbus_message_new): New function
	separated out of nih_dbus_object_message(); also no need to cast
	the destructor.
	* nih-dbus/dbus_object.c (nih_dbus_object_message): Clean up to
	call new nih_dbus_message_new function.
	* nih-dbus/libnih-dbus.h: New top-level header to include everything
	* nih-dbus/tests/test_dbus.c: Separate out the tests into files
	to match the sources.  The new files are
	nih-dbus/tests/test_dbus_error.c,
	nih-dbus/tests/test_dbus_connection.c,
	nih-dbus/tests/test_dbus_message.c,
	nih-dbus/tests/test_dbus_object.c,
	nih-dbus/tests/test_dbus_proxy.c,
	nih-dbus/tests/test_dbus_util.c.
	* nih-dbus/tests/test_dbus_error.c (test_error_raise_printf):
	Looks like this function was never run in the old test suite, oops.
	* nih-dbus/tests/test_dbus_message.c (test_message_new): Test the
	new function
	* nih-dbus/tests/test_com.netsplit.Nih.Test_object.c: Drop includes
	we don't actually seem to use the library!
	* nih-dbus/tests/test_com.netsplit.Nih.Test_proxy.c: Update includes
	to include proxy
	* nih-dbus/tests/com.netsplit.Nih.Test_impl.c: Replace includes
	with separate ones.
	* nih-dbus/tests/com.netsplit.Nih.Test_impl.h: Drop include.
	* nih-dbus/Makefile.am (include_HEADERS): Install the top-level header
	(nihdbusinclude_HEADERS): Update paths to new headers
	(libnih_dbus_la_SOURCES): Build from new sources
	(TESTS, test_dbus_error_SOURCES, test_dbus_error_CFLAGS)
	(test_dbus_error_LDFLAGS, test_dbus_error_LDADD)
	(test_dbus_connection_SOURCES, test_dbus_connection_CFLAGS)
	(test_dbus_connection_LDFLAGS, test_dbus_connection_LDADD)
	(test_dbus_message_SOURCES, test_dbus_message_CFLAGS)
	(test_dbus_message_LDFLAGS, test_dbus_message_LDADD)
	(test_dbus_object_SOURCES, test_dbus_object_CFLAGS)
	(test_dbus_object_LDFLAGS, test_dbus_object_LDADD)
	(test_dbus_proxy_SOURCES, test_dbus_proxy_CFLAGS)
	(test_dbus_proxy_LDFLAGS, test_dbus_proxy_LDADD)
	(test_dbus_util_SOURCES, test_dbus_util_CFLAGS)
	(test_dbus_util_LDFLAGS, test_dbus_util_LDADD): Add details for
	new tests, replacing old ones

	* nih/dbus.c, nih/dbus.h, nih/libnih-dbus.supp, nih/libnih-dbus.ver,
	nih/nih_dbus_tool.py, nih/test_dbus.h,
	nih/tests/com.netsplit.Nih.Test.xml,
	nih/tests/com.netsplit.Nih.Test_impl.c,
	nih/tests/com.netsplit.Nih.Test_impl.h,
	nih/tests/test_com.netsplit.Nih.Test_object.c,
	nih/tests/test_com.netsplit.Nih.Test_proxy.c,
	nih/tests/test_dbus.c: Move all D-Bus related code into a new
	sub-directory
	* nih/Makefile.am: Move D-Bus related rules into
	* nih-dbus/Makefile.am: here.
	* nih-dbus/tests/test_dbus.c: Update include path for D-Bus test
	macros and dbus.h
	* nih-dbus/tests/test_com.netsplit.Nih.Test_object.c: Update include
	path for dbus.h
	* nih-dbus/tests/test_com.netsplit.Nih.Test_proxy.c: Update include
	path for dbus.h
	* nih-dbus/tests/com.netsplit.Nih.Test_impl.c: Update include path
	for dbus.h
	* nih-dbus/tests/com.netsplit.Nih.Test_impl.h: Update include path
	for dbus.h
	* nih-dbus/nih_dbus_tool.py (Output.sourceFile, Output.headerFile):
	Generate includes with correct path for dbus.h
	* Makefile.am (SUBDIRS): Iterate into new sub-directory
	* configure.ac (AC_CONFIG_FILES): Generate new Makefile
	* nihify: Create symlink to nih-dbus as well

	* nih/tests/com.netsplit.Nih.Test_impl.c (my_test_async_method):
	Take a reference to the message
	* nih/libnih-dbus.supp: Update D-Bus suppressions.

	* TODO: Update

	* nih/libnih.supp: Update suppressions for new calling stack

	* nih/dbus.c (nih_dbus_object_new): Update documentation to match
	new nih_alloc(), no need to cast destructor
	(nih_dbus_proxy_new, nih_dbus_path): Update documentation to match
	new nih_alloc()
	(nih_dbus_object_message): Make the message nih_local, this means
	the handler must now reference the message otherwise it will be
	freed.
	(nih_dbus_object_introspect): Make the xml string nih_local
	(nih_dbus_message_error): Make the string nih_local
	* nih/tests/test_dbus.c (test_error_raise)
	(test_error_raise_printf): Don't check for no parent if we don't
	need to.
	(my_return_error): Must reference the message
	(test_error_raise, test_error_raise_printf): Must mean TEST_ALLOC_FAIL

	* nih/main.c (nih_main_loop_add_func): Update documentation to match
	new nih_alloc(), no need to cast destructor function.
	(nih_main_version): Use nih_local
	(nih_main_write_pidfile): Use nih_local
	* nih/tests/test_main.c: Include limits.h

	* nih/io.c (nih_io_watcher): Can't just break if we catch a free,
	we have to at least process errors first!

	* nih/watch.c (nih_watch_new): Update documentation to match new
	nih_alloc(), no need to cast destructor function.
	(nih_watch_add): No need to cast destructor function; free the
	not a directory error as well.
	(nih_watch_handle): Use nih_local on the path so it's always cleaned
	up if we don't reference it; reference it when delaying the create
	handler instead of reparenting
	* nih/tests/test_watch.c: Include limits.h
	(test_new): Free watch inside loop, don't select fds; no idea why
	this code is here.
	(test_reader): Can't just call select then handle, we actually have
	to wait for activity first.
	(my_create_handler, my_modify_handler, my_delete_handler): Loop over
	allocations, we can't use TEST_ALLOC_SAFE if we don't know we're in
	a TEST_ALLOC_FAIL.

2009-01-25  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c (nih_file_read): Update documentation to match
	new nih_alloc()
	(nih_dir_walk, nih_dir_walk_visit): No need to cast destructor
	function, use nih_local to clean up code a little bit.
	(nih_dir_walk_scan): Use nih_local to make this easier.
	* nih/tests/test_file.c: Include limits.h
	(my_visitor): No need to cast destructor

	* nih/test.h: Include config.h since that defines _GNU_SOURCE
	* nih/tests/test_child.c, nih/tests/test_signal.c: Remove extra
	double include.

	* nih/test_alloc.h (TEST_FREE_TAG): Remove incorrect "extern"

	* nih/alloc.c (nih_unref_only): Add function to allow unreferencing
	without freeing, for example if we return something from our state
	and want to reparent but still allow NULL.
	* nih/alloc.h: Add prototype.

	* nih/io.c (nih_io_add_watch, nih_io_message_new, nih_io_reopen):
	Update documentation to match new nih_alloc(), no need to cast
	destructor function.
	(nih_io_buffer_new, nih_io_buffer_pop, nih_io_read, nih_io_get):
	Update documentation to match new nih_alloc()
	(nih_io_read_message): Update documentation to match new nih_alloc(),
	reparent message by referencing to parent before unreferencing from
	io structure.
	* nih/tests/test_io.c (test_read_message, test_send_message):
	Replace TEST_ALLOC_PARENT with NULL parent with TEST_ALLOC_OPRHAN
	(test_read_message): Message must reference the io watch
	(test_message_add_control): Remove strange allocator changing.
	(test_message_recv): Call nih_error_init to avoid valgrind issue

	* nih/child.c (nih_child_add_watch): Update documentation to match new
	nih_alloc(), no need to cast destructor function.
	* nih/tests/test_child.c: Include config.h
	
	* nih/signal.c (nih_signal_add_handler): Update documentation to
	match new nih_alloc(), no need to cast destructor function.
	* nih/tests/test_signal.c: Include config.h

	* nih/timer.c (nih_timer_add_timeout, nih_timer_add_periodic)
	(nih_timer_add_scheduled): Update documentation to match new
	nih_alloc(), no need to cast destructor function.

	* nih/alloc.c (nih_alloc_parent, nih_alloc_size): Pointer argument
	should be const since we don't modify it.
	* nih/alloc.h: Update prototype.

	* nih/error.h: Add documentation for header.
	(NIH_SHOULD): Much needed docstring.

	* nih/logging.c: Include nih/macros.h
	* nih/logging.h: Add documentation for header.

	* nih/config.c (nih_config_next_token, nih_config_next_arg)
	(nih_config_parse_args, nih_config_parse_command)
	(nih_config_parse_block): Update documentation to match new
	nih_alloc()
	(nih_config_parse): Rewrite to use nih_file_read() into an nih_local
	variable, instead of mmap which has strange behaviours in the face
	of updates.
	* nih/config.h: Add documentation header.
	* nih/tests/test_config.c: Include limits.h

	* nih/command.c (nih_command_parser): Update documentation to
	match new nih_alloc(), use nih_local where possible to clean up
	code.
	(nih_command_join): Update documentation to match new nih_alloc()
	(nih_command_handle): Update documentation to match new nih_alloc(),
	use nih_local where possible to clean up code.
	(nih_command_help): Use nih_local for groups array
	(nih_command_group_help): Use nih_local for wrapped string
	* nih/command.h: Add documentation string for header.

	* nih/option.c (nih_option_parser): Update documentation to match
	new nih_alloc(), should not use parent for any old allocation.
	(nih_option_join): Update documentation to match new nih_alloc()
	(nih_option_help): Use nih_local for temporary strings and groups
	(nih_option_group_help): Use nih_local for temporary string.
	* nih/option.h: Add documentation string for header.

	* nih/list.h, nih/hash.h: Provide a much better documentation string.

	* nih/tree.c (nih_tree_new, nih_tree_entry_new): Update documentation
	to match new nih_alloc(); no need to cast destructor function
	* nih/tree.h: Add documentation string for the header.

	* nih/hash.c (nih_hash_new): Update documentation to match
	new nih_alloc(); update comment to reflect what we actually do to
	pick a prime.
	(nih_hash_pointer_key, nih_hash_pointer_hash)
	(nih_hash_pointer_cmp): Drop these, we were looking at the raw bytes
	of a pointer, which is almost certainly naughty.
	* nih/hash.h: Add documentation string, remove prototypes.
	(NIH_HASH_FOREACH, NIH_HASH_FOREACH_SAFE): Update documentation in
	same manner as the list functions.
	(nih_hash_pointer_new): Drop, this is probably illegal C ;-)
	(nih_hash_string_new): Update documentation to match new nih_alloc()
	* nih/tests/test_hash.c (test_pointer_new, test_pointer_key): Drop.
	(test_lookup): Modify to use string hashes instead.
	(test_foreach, test_foreach_safe): Fix function name comment.

	* nih/list.c (nih_list_new, nih_list_entry_new): Update documentation
	to match new nih_alloc(); No need to cast the destructor function
	anymore.
	* nih/list.h: Add documentation string for the header.
	(NIH_LIST_FOREACH, NIH_LIST_FOREACH_SAFE): Improve documentation
	about which is best.
	(NIH_LIST_ITER): Add macro to make iterating a list with an offset
	head easier.

	* nih/macros.h: Add sorely-missed documentation strings, including
	one for the header itself.
	(NULL): Drop, NULL is defined by the C compiler.

	* nih/string.c: Update all documentation to match new nih_alloc()
	(nih_str_array_addp): Take a reference to the passed variable
	instead of reparenting (which isn't possible anymore).
	(nih_str_array_add, nih_str_array_addn): Since these just call
	nih_str_array_addp() which now takes a reference rather than
	reparents, we can change these functions to make new_str as a
	local variable.
	(nih_strv_free): Drop this function, it's not used and it's utterly
	inconsistent with the others as it expressly isn't used with
	nih_alloc().
	(nih_strncat): This function worryingly did not work if NULL was
	passed, catch that and call nih_strndup() instead.
	* nih/string.h: Add a documentation string and drop prototype.
	* nih/tests/test_string.c (test_strv_free): Drop.
	(test_sprintf, test_vsprintf, test_strdup, test_strndup): Replace
	TEST_ALLOC_PARENT calls with NULL as the second argument with
	TEST_ALLOC_ORPHAN instead.
	(test_strcat, test_strncat, test_strcat_sprintf)
	(test_strcat_vsprintf): Strangely these test cases don't appear to
	have worked before, the functions return NULL in case of memory
	allocation failure so we need to check the string against a temporary
	copy stored before, and we need to free that string as well. 
	Also add test cases for NULL being passed in as the source string.

	* nih/test_alloc.h: Expose references to nih_alloc()'s pointers to
	malloc, realloc and free so we can replace them for testing purposes.
	(TEST_ALLOC_SIZE): Since this returns the size of the allocated object,
	rather than the request, check that the block is at least as large
	as the argument given - not exactly as large.
	(TEST_ALLOC_PARENT): Call nih_alloc_parent directly with both
	arguments, since it's compatible with our calling - can't output the
	current parent now they're may be multiple though.  When passed NULL
	this now checks if it *has* a parent (almost the exact inverse of the
	previous meaning).
	(TEST_ALLOC_ORPHAN): New test to make sure that an object does not
	have a parent.
	(_test_free_tag): Reimplement to lookup the tag block in a linked
	list, instead of a static array, and only return TRUE or FALSE.
	(_test_destructor): Drop, we can just use nih_list_destroy instead.
	(TEST_FREE_TAG): Reimplement to allocate the tag struct itself as
	the child, and place in a linked list.
	(_test_malloc): Add malloc wrapper.
	(_test_allocator): Rename to _test_realloc
	(TEST_ALLOC_FAIL, TEST_ALLOC_SAFE): Change allocator through the
	exposed variables.

	* nih/alloc.h (nih_local): Macro to add a variable attribute that
	calls a nih_discard() as a cleanup function when the variable goes
	out of scope.
	* nih/alloc.c (_nih_discard_local): gcc cleanup function wrapper that
	takes the address of the local variable, it gets the actual pointer
	out and passes it to nih_discard().  Unlike the other functions,
	this actually allows the pointer to be NULL.
	* nih/tests/test_alloc.c (test_local): Test local variables work!

	* nih/alloc.c (nih_alloc_has_ref): Rename back to nih_alloc_parent.
	(nih_alloc_parent): Accept NULL, if given returns TRUE if there are
	any parents.
	* nih/alloc.h: Update prototype.
	* nih/tests/test_alloc.c (test_parent): Since it's a bit more
	complex, we should probably explicitly test this ;-)

	* nih/test.h, nih/test_output.h, nih/test_values.h, nih/test_process.h,
	nih/test_divert.h, nih/test_files.h, nih/test_alloc.h, nih/test_list.h,
	nih/test_hash.h, nih/test_dbus.h: Split the test macros out into
	separate files to make maintaining them easier.  None of them may
	be included directly, execept nih/test_dbus.h which is now no longer
	included by default.
	* nih/Makefile.am (nihinclude_HEADERS): Install new headers.

	* nih/alloc.c: Re-implement as a multi-reference allocator; an object
	may now have as many parents as you wish, each one holding its own
	reference to it.
	(NihAllocCtx): Restructure.
	(NihAllocRef): New object linked by context to hold a reference.
	(nih_alloc_init, nih_alloc_set_allocator, nih_alloc_using): Drop
	support for custom allocators, knowing that we always use malloc
	is useful for the implementation - we still allow the test suite
	to change them, but nothing else.
	(nih_alloc): Reimplement from original nih_alloc_using() function,
	now calls nih_alloc_ref_new() if parent is not NULL.
	(nih_realloc): Reimplement for multi-referenceness; much of the
	this remains the same.
	(nih_free): Reimplement as a wrap around nih_alloc_context_free().
	(nih_discard): New function to discard an object if it has no
	parent references, used if you believe references may have been
	taken by functions you have called.
	(nih_alloc_context_free): Common function to free an object, calling
	its destructor after discarding parent references but before cleaning
	up children.
	(nih_alloc_reparent): Drop, it's no longer possible to simply reparent
	an object.  Instead you should call the new functions:
	(nih_ref, nih_alloc_ref_new, nih_unref, nih_alloc_ref_free): Handle
	NihAllocRef objects, linking them to a context and removing them from
	a context; when the last reference to a child is removed, we
	automatically call nih_alloc_context_free().
	(nih_alloc_parent, nih_alloc_has_ref): Replace the former function
	with the latter, it's no longer possible to query the exact parent
	since there isn't one.
	(nih_alloc_ref_lookup): Internal function to find a reference.
	(nih_alloc_size): Reimplement assuming malloc, which saves us some
	space in the context structure.
	* nih/alloc.h: Update all prototypes and documentation, including
	adding module documentation to the top of the header file.
	(NihAllocator): Drop typedef.
	(nih_alloc_set_destructor): Add casting macro with name of original
	function that calls nih_alloc_real_set_destructor().
	* nih/tests/test_alloc.c (test_new, test_alloc): Fix to check for a
	reference rather than the explicit parent; also include a test for
	allocation failure using a malloc hook.
	(test_realloc): Fix to check for a reference rather than the
	explicit parent, change allocatil failure test to use a realloc hook
	instead of a different allocator.
	(test_free): Add a with parent test.
	(test_discard): New test, as test_free() but with different expected
	result for the parent test.
	(test_set_allocator): Drop test.
	(test_reparent, test_ref, test_unref): Drop the former test and
	replace with checking that referencing and unreferencing works.

2008-10-24  Scott James Remnant  <scott@netsplit.com>

	* nih/list.h (NIH_LIST_FOREACH_SAFE): Mark the cursor to be
	automatically cleaned up should we exit the loop; this somewhat
	simplifies the definition and allows returning from within the loop.

	* nih/list.h (NIH_LIST_FOREACH_SAFE): Fix a typo that caused only
	once cursor variable to be used, rather than one per iteration.

	* nih/main.h, nih/main.c, nih/dbus.c, nih/tests/test_dbus.c: Revert
	previous "delete" patch now that we can iterate linked lists
	without tripping over the bug we found here.

	* nih/libnih-dbus.supp: Update suppressions for newer glibc and
	D-Bus without debugging enabled.

	* nih/list.h (NIH_LIST_FOREACH_SAFE): Replace with a more ingenious
	version based on work by Casey Dahlin and myself; instead of caching
	the next pointer, place a cursor node in the list instead.  This
	solves the issue where the next pointer may be changed or freed, and,
	in fact solves all issues of list rearrangement.
	* nih/tests/test_list.c (test_foreach_safe): Add test cases.
	* nih/hash.h (NIH_HASH_FOREACH_SAFE): Update comment to match.

2008-08-12  Casey Dahlin  <cdahlin@redhat.com>

	* nih/main.h (NihMainLoopFunc): Add delete member.
	* nih/main.c (nih_main_loop): Don't run the callback for any function
	marked for deletion, instead call nih_free on it.
	(nih_main_loop_add_func): Initialise delete to FALSE.
	* nih/dbus.c (nih_dbus_release_callback): Add function to mark a
	loop function as deleted.
	(nih_dbus_setup): and use it as the free function instead of nih_free.
	* nih/tests/test_dbus.c (test_connect, test_bus, test_setup): Check
	that the loop functions are marked for deletion instead of freed.

	* nih/nih_dbus_tool.py (Output.sourceFile): Include limits.h

2008-07-02  Scott James Remnant  <scott@netsplit.com>

	* nih/Makefile.am (test_com_netsplit_Nih_Test_object_SOURCES)
	(test_com_netsplit_Nih_Test_proxy_SOURCES): Add forgotten header.

2008-07-01  Scott James Remnant  <scott@netsplit.com>

	* TODO: Update.

	* nih/tests/test_com.netsplit.Nih.Test_proxy.c (test_method_dispatch):
	Add test cases for input and output arguments of various types.

	* nih/nih_dbus_tool.py (DBusArray.marshal): Add extra parens in
	array setting call for precedence reasons.

	* nih/tests/test_com.netsplit.Nih.Test_proxy.c (test_method_dispatch):
	Add basic tests of calls to synchronous and async methods, and the
	usual error returns.
	* nih/tests/com.netsplit.Nih.Test_impl.c (async_method_reply): 
	Add replies that have the wrong combinations of arguments.

	* nih/tests/com.netsplit.Nih.Test_impl.c,
	* nih/tests/test_com.netsplit.Nih.Test_object.c (my_connect_handler)
	(my_setup, my_teardown): Move these functions across too.
	* nih/tests/com.netsplit.Nih.Test_impl.h: Add prototypes.

	* nih/dbus.c (nih_dbus_proxy_new): Allow name to be NULL.
	* nih/tests/test_dbus.c (test_proxy_new): Test without a name.

	* nih/tests/test_com.netsplit.Nih.Test_object.c,
	* nih/tests/com.netsplit.Nih.Test_impl.c: Separate out the server
	object implementation so that the proxy code could use it.
	* nih/tests/com.netsplit.Nih.Test_impl.h: Header for object definition
	* nih/Makefile.am (test_com_netsplit_Nih_Test_object_SOURCES)
	(test_com_netsplit_Nih_Test_proxy_SOURCES): Include the object
	implementation code.

	* nih/tests/test_com.netsplit.Nih.Test_proxy.c: Stub file for proxy
	test cases.
	* nih/Makefile.am (TESTS): Build the proxy test suite.
	(test_com_netsplit_Nih_Test_proxy_SOURCES)
	(test_com_netsplit_Nih_Test_proxy_CFLAGS)
	(test_com_netsplit_Nih_Test_proxy_LDFLAGS)
	(test_com_netsplit_Nih_Test_proxy_LDADD): Details for the proxy
	test suite, which actually includes the object code since it needs
	to implement objects too

	* nih/nih_dbus_tool.py (MemberWithArgs.variables): Only include arg
	array in object mode.

	* nih/Makefile.am ($(com_netsplit_Nih_Test_object_OUTPUTS)): 
	($(com_netsplit_Nih_Test_proxy_OUTPUTS)): Must be newer than the
	source for the python tool

	* nih/nih_dbus_tool.py (Interface.variables, Interface.exports):
	Only include the interface definition in object mode, we will need
	something for proxying signals later, but right now this means
	problems when building an object and its proxy together.

	* nih/Makefile.am (com_netsplit_Nih_Test_proxy_OUTPUTS)
	(com_netsplit_Nih_Test_proxy_XML)
	($(com_netsplit_Nih_Test_proxy_OUTPUTS)): Generate sources in proxy
	mode for the test interfaces.
	(BUILT_SOURCES, MAINTAINERCLEANFILES, EXTRA_DIST): Build if necessary
	before anything else, clean in maintainer-clean and include in the
	distribution.

2008-06-30  Scott James Remnant  <scott@netsplit.com>

	* m4/libs.m4 (NIH_LIB_DBUS): Always check for Python, but don't error
	or disable D-Bus unless the install option is defined.  Otherwise if
	we don't have it, don't define HAVE_PYTHON.
	* nih/Makefile.am (noinst_SCRIPTS): Only build if we have python.

	* nih/Makefile.am: Redress the Makefile such that the generated test
	sources are actually included in the distribution tarball.

	* nih/dbus.h (NihDDusProxy): Add definition for proxy structure
	and prototype for function to create one.
	* nih/nih_dbus_tool.py (Method.dispatchFunction): Adjust name of
	destination member in the proxy.
	* nih/dbus.c (nih_dbus_proxy_new): Simple function to create a new
	proxy object.
	* nih/tests/test_dbus.c (test_proxy_new): Add simple test for the
	simple function, which will get more complicated if we add signal
	filter registration later.

	* nih/errors.h (NIH_DBUS_INVALID_ARGS): Add error caused when the
	reply arguments on a method call were not what we expected.

	* nih/nih_dbus_tool.py: Implement the simplest of the method dispatch
	cases, a blocking method call with the reply data returned as arguments
	to the call.

	* nih/nih_dbus_tool.py: Allocate a copy of string arguments when
	passing, this makes them consistent with arrays, and also means that
	we can actually do method dispatching which requires the reply data
	to last longer than the underlying message.

	* nih/nih_dbus_tool.py: Add parent argument to marshal functions for
	when we need to allocate something (ie. arrays)

	* nih/nih_dbus_tool.py (DBusArray.marshal): Add extra parens around
	possible deferenced length variable, not needed for precedence but
	helps clarity in generated code.
	(DBusArray.dispatch): Increment the length inside the for loop, rather
	than always leaving it at zero, useful for debugging.

	* nih/nih_dbus_tool.py: Have a bash at sorting out the whole pointer
	and const problem again.  Make them properties of a group, passed to
	type functions that can add * and const as appropriate, and allows
	DBusArray to be more clever about things.  Works for the existing
	cases, anyway.

	* nih/nih_dbus_tool.py (Method.handlerPrototype): Only include
	function pointers when the mode is object.

	* nih/nih_dbus_tool.py: Allow mode to be changed to proxy, but don't
	specify anything to be generated for that mode yet.

2008-06-11  Scott James Remnant  <scott@netsplit.com>

	* Makefile.am (SUBDIRS): po has to come last to make sure we've
	built any auto-generated code before update-po

	* nih/nih_dbus_tool.py (Method.marshalFunction): Allow the message
	for the invalid args/type message to be translated.

	* nih/tests/test_child.c (test_poll): We end up creating a core file,
	so unlink it.

	* nih/Makefile.am (tests/com.netsplit.Nih.Test_object.c tests/com.netsplit.Nih.Test_object.h):
	Create the tests directory.

2008-06-08  Scott James Remnant  <scott@netsplit.com>

	* nih/Makefile.am (tests/com.netsplit.Nih.Test_object.c tests/com.netsplit.Nih.Test_object.h):
	Make the tests directory in the output.

	* nih/Makefile.am (EXTRA_DIST): Forgot to distribute the test XML

	* nih/file.c (nih_file_read): Implement a simpler function for reading
	a file into memory that does literally just that, better than map
	for various reasons.
	* nih/file.h: Add prototype.
	* nih/tests/test_file.c (test_read): Test it works.

2008-06-06  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_DBUS, TEST_DBUS_OPEN, TEST_DBUS_MESSAGE)
	(TEST_DBUS_CLOSE, TEST_DBUS_END): Various useful macros to set up,
	connect to, pop messages from, close and kill D-Bus connections to
	a private bus daemon.

	* nih/tests/test_string.c (test_array_copy): Add a test case for a
	zero-length array, which we need to be able to support.
	* nih/string.c (nih_str_array_copy): Fix it by always creating a
	new array to copy into, since array can't be NULL.

2008-06-04  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_com.netsplit.Nih.Test_object.c (test_method_marshal):
	Why would I be allocating a string array using sizeof (int32_t),
	fix C&P error to make amd64 happy again.

2008-06-02  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_DBUS): Initialise _test_address to zeros so
	valgrind shuts up.

	* nih/test.h (TEST_DBUS, TEST_DBUS_END): Macros to set up a
	temporary D-Bus session bus for testing purposes.

	* nih/tests/test_dbus.c (test_object_new, test_object_destroy)
	(test_object_unregister): Use the system bus for testing, since
	there may be no session bus.

	* nih/tests/test_dbus.c (test_bus): We get an error when the
	session bus is not available, so we should eat that before skipping.

2008-06-01  Scott James Remnant  <scott@netsplit.com>

	* nih/dbus.c (nih_dbus_object_message): Keep a reference on the
	connection, as well as the message; otherwise if the connection is
	disconnected while handling a async method, we'll end up trying to
	send it to a freed connection instead of just a disconnected and
	forgotten one.
	(nih_dbus_message_destroy): Unreference the connection when freeing
	the message object.

2008-05-28  Scott James Remnant  <scott@netsplit.com>

	* TODO (main, timers): Update.

	* nih/nih_dbus_tool.py: The C type of string-like types should be
	just "char *"; instead we should add "const" when needed, such as
	in the prototype of handlers and in reply functions.  This avoids
	some const-bending games.
	* nih/tests/test_com.netsplit.Nih.Test_object.c (my_emit_signal):
	Adjust type of string array to match.

2008-05-24  Scott James Remnant  <scott@netsplit.com>

	* HACKING: Changed branch location again.

2008-05-18  Scott James Remnant  <scott@netsplit.com>

	* nih/error.h (nih_return_no_memory_error): Add a convenience macro
	for raising the ENOMEM system error with the right string, rather
	than setting errno just do it directly.
	* nih/tests/test_error.c (test_return_no_memory_error): Make sure
	the macro is tested.
	* nih/dbus.c (nih_dbus_connect, nih_dbus_bus, nih_dbus_server):
	Use new macro to return ENOMEM when we're not sure that it's the
	current errno.

2008-05-14  Scott James Remnant  <scott@netsplit.com>

	* TODO: Update.

	* nih/tests/test_com.netsplit.Nih.Test_object.c (my_str_to_int32_array):
	Forgot to clean up parts after splitting.
	(test_method_marshal): Forgot to free self-allocated arrays, and
	we have to free a string array returned by D-Bus as well.
	(test_signal_dispatch): Another string array to be freed.

	* nih/tests/test_dbus.c (test_object_message): Don't use timeouts
	to guess when the reply should have arrived, just use a pending
	call notify function.  This speeds the whole thing up a hundred
	fold and removes valgrind slowness issues.

	* nih/dbus.c (nih_dbus_message_error): Asynchronous messages need
	a way to return an error message to the sender after the handler
	function has terminated; this function fulfills that need
	* nih/dbus.h: Add prototype.
	* nih/tests/test_dbus.c (test_message_error): Add test case for
	replying to an asynchronous message with an error; this ends up
	somewhat evil since we're not using the bindings.

	* nih/nih_dbus_tool.py: Use a namespaced attribute to specify
	whether methods should be generated synchronous (reply generated
	after handler returns) or asynchronous (handler expected to keep
	the message object and call a reply function later).
	* nih/tests/com.netsplit.Nih.Test.xml: Add a test asynchronous
	method, the same basic method as the ordinary test method, but
	which is specified to generate an asynchronous call.
	* nih/tests/test_com.netsplit.Nih.Test_object.c: Add many tests
	for async calls, in fact, we pretty much just duplicate the sync
	tests but use a timer in the server to deliver the reply.

	* nih/dbus.c (nih_dbus_object_message): Set a destructor for the
	message that unreferences the attached D-Bus message when it
	is freed, and don't unreference it ourselves.  Also allow the
	handler to return "not yet handled" to mean that the method
	has actually been handled, but the reply hasn't been sent yet.
	(nih_dbus_message_destroy): Destructor for the message.

2008-05-11  Scott James Remnant  <scott@netsplit.com>

	* nih/nih_dbus_tool.py: Implement handling for arrays of simple C
	types with an extra length variable, and handling for arrays of
	pointer types with an extra NULL element
	* nih/tests/com.netsplit.Nih.Test.xml: Add test methods with an
	int32 and string array as input and output, and test signals
	with both array types.
	* nih/tests/test_com.netsplit.Nih.Test_object.c: Add tests for
	the new methods and signals, testing the underlying automatic
	generation.

2008-05-10  Scott James Remnant  <scott@netsplit.com>

	* nih/string.c (nih_strncat, nih_strcat_vsprintf): Ok, there
	was a minor technical reason after all; don't strlen the
	string if we don't have it.

	* nih/string.c (nih_strcat, nih_strncat, nih_strcat_sprintf)
	(nih_strcat_vsprintf): Remove the restriction that the string
	must be pre-allocated, there's no technical reason for it, I was
	just trying to enforce a style.

2008-05-09  Scott James Remnant  <scott@netsplit.com>

	* nih/nih_dbus_tool.py: Drop the data type argument, and just
	pass around void *; we never have the types available, and since
	we have our own prototype anyway, we never upset gcc.

	* nih/dbus.c (nih_dbus_path): Empty path components are named
	as "_" instead.
	* nih/tests/test_dbus.c (test_path): Test the new functionality.

2008-05-08  Casey Dahlin  <cdahlin@redhat.com>

	* nih/file.c (nih_file_is_packaging): Add matches for various
	RPM temporary and atomicity files.

2008-05-08  Scott James Remnant  <scott@netsplit.com>

	* nih/dbus.c (nih_dbus_error_raise_printf): Add formatted error
	function, I held out as long as I could
	* nih/dbus.h: Add prototype.
	* nih/tests/test_dbus.c (test_error_raise_printf): And test for it.
	* nih/error.h: Add missing attribute

	* nih/Makefile.am: No need for version info if not installing

2008-05-06  Scott James Remnant  <scott@netsplit.com>

	* m4/compiler.m4: -Wformat is already in -Wall

	* nih/main.c (nih_main_daemonise): Deliberately ignore chdir
	return value, repeat the dup calls until they work.
	(nih_main_loop_interrupt): repeat write call until it succeeds.
	* nih/test.h (TEST_CHILD, TEST_CHILD_WAIT, TEST_CHILD_RELEASE):
	assert that pipe() returns zero and read() and write() both return 1.
	(TEST_DIVERT_STDOUT_FD, TEST_DIVERT_STDERR_FD): assert that dup2
	returns a file descriptor.
	(TEST_FILE_RESET): assert ftruncate works.
	* nih/tests/test_io.c (test_add_watch, test_select_fds)
	(test_handle_fds, test_reopen, test_shutdown, test_destroy)
	(test_watcher, test_read_message, test_send_message, test_read)
	(test_write, test_get, test_printf, test_set_nonblock)
	(test_set_cloexec): assert that the pipe() calls work.
	(test_watcher): assert that write() returns expected number.
	* nih/tests/test_file.c (test_map): Check the fgets works.
	(test_dir_walk): assert that the symlink call works.
	* nih/tests/test_main.c (test_daemonise): assert pipe(), write()
	and getcwd() calls work.
	* nih/tests/test_com.netsplit.Nih.Test_object.c (my_setup):
	initialise wait_fd to get around gcc's blindness.
	(my_emit_signal): initialise ret.

	* m4/compiler.m4: Add -Wformat, -Wformat-security and
	-D_FORTIFY_SOURCE=2 to our default CFLAGS unless compiler warnings
	are disabled.

2008-04-29  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_com.netsplit.Nih.Test_object.c (test_method_marshal)
	(test_signal_dispatch):	For some reason valgrind needs some
	reassurance that it's ok to pass uninitialised data around in various
	cases; probably good for testing anyway.

	* nih/dbus.c (nih_dbus_path): Function to generate D-Bus paths with
	appropriate escaping of non-root elements.
	* nih/dbus.h: Add prototype.
	* nih/tests/test_dbus.c (test_path): Test the new function.

	* nih/dbus.c (nih_dbus_object_introspect): Free the introspection
	string after sending the message (oops!)

2008-04-27  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/com.netsplit.Nih.Test.xml: Add signals to the test
	interface for the variety of basic argument types, we also need
	a glue function to make the server emit the signal.
	* nih/tests/test_com.netsplit.Nih.Test_object.c (my_emit_signal)
	(test_signal_dispatch): Test the signals are emitted and dispatched
	properly by catching them and checking them.

2008-04-26  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_GROUP): Add macro for when we don't test functions.
	* nih/tests/test_com.netsplit.Nih.Test_object.c (test_method_marshal):
	Use TEST_GROUP here.

	* nih/tests/com.netsplit.Nih.Test.xml: Add more methods to test,
	one generic method and two methods (in and out) for each basic type.
	* nih/tests/test_com.netsplit.Nih.Test_object.c: Slightly redo the
	way we do the tests, do the basic set of tests using a single method
	that can return cases such as errors, etc.  Then have input and output
	marshal tests for each of the basic types.
	* nih/nih_dbus_tool.py (NAME_RE): Cope with numerics in member names,
	treat them the same as lowerspace characters.

2008-04-25  Scott James Remnant  <scott@netsplit.com>

	* TODO: Update, adding missing pieces for D-Bus support and an
	idea for changing the way that timers/signals/io/etc. work.

	* nih_dbus_tool.py: Handle the basic D-Bus types and generate
	marshalling functions for methods and dispatch functions for
	signals, along with all of the glue needed for nih_dbus_object_new()
	* nih/tests/com.netsplit.Nih.Test.xml: Interface to be used for
	testing of the generated code.
	* nih/tests/test_com.netsplit.Nih.Test_object.c: Test suite for
	the generated code (in object mode), so far this just tests a
	couple of methods but will be adding a lot more tests soon.
	* nih/Makefile.am (TESTS): Add the above test suite.
	(test_com_netsplit_Nih_Test_object_SOURCES)
	(test_com_netsplit_Nih_Test_object_CFLAGS)
	(test_com_netsplit_Nih_Test_object_LDFLAGS)
	(test_com_netsplit_Nih_Test_object_LDADD): Details for the test suite.
	(BUILT_SOURCES): Interface definitions are auto-generated and need
	to be done so at the start of the build so deps work properly.
	(CLEANFILES): All built sources need to be cleaned on "make clean"
	(tests/com.netsplit.Nih.Test_object.c tests/com.netsplit.Nih.Test_object.h):
	Generate the interface definitions with the binding tool, being
	sure to regenerate if the XML or binding tool change.

	* nih/dbus.c (nih_dbus_object_new): Register an object with D-Bus
	and hook it up to an internal message handling function that deals
	with introspection and the like, while passing off actual handling
	to marshaller functions for individual methods.
	(nih_dbus_object_destroy): When the object is freed, unregister
	it from the bus making sure that doing so doesn't try to free it
	a second time.
	(nih_dbus_object_unregister): When the bus connection is dropped
	or object otherwise unregistered, free it, making sure that doing
	so doesn't try to unregister it a second time.
	(nih_dbus_object_message): Handle messages for the object, locate
	the marshaller function in the interface structures or pass off
	to internal handler for introspection.
	(nih_dbus_object_introspect): Handle the Introspect method by
	generating XML which we return in a reply.
	* nih/dbus.h: Add prototype for new function.
	(NihDBusObject, NihDBusMessage, NihDBusMarshaller, NihDBusArgDir)
	(NihDBusArg, NihDBusMethod, NihDBusSignal, NihDBusAccess)
	(NihDBusProperty, NihDBusInterface): Add the truly insane number
	of structures and enums we need to fully specify the interfaces
	that a D-Bus object provides; you'll never do this by hand! :-)
	* nih/tests/test_dbus.c (test_object_new, test_object_destroy)
	(test_object_unregister, test_object_message): Test cases for new
	functions.
	(test_connect, test_bus): Check error messages using the macros
	rather than by name.

2008-04-23  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_nih_dbus_tool.py: In hindsight, it's unnecessary
	to test the binding tool directly since the tests will basically
	just compare the output to an expected C file which will make
	maintaining it damned hard and doesn't actually guarantee it works;
	instead we'll test generated output.
	* nih/Makefile.am (TESTS): Remove the call to the Python test suite,
	and reverse the TESTS/check_PROGRAMS thing again to match.

2008-04-22  Scott James Remnant  <scott@netsplit.com>

	* nih/libnih-dbus.supp: D-Bus init_system_db() related leaks
	were likely a missing dbus_shutdown() since they've gone away
	now.

	* nih/dbus.c (nih_dbus_add_timeout, nih_dbus_timeout_toggled):
	Slightly adjust the millisecond to second conversion to always
	round up to the nearest whole second rather than down; that way
	we have a 1s minimum timeout instead of an immediate one.

2008-04-21  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_dbus.c (test_bus): Cope when the session bus
	is not available.

	* nih/libnih-dbus.supp: Suppress annoying NSS problems on i686
	as well (we did x86-64 last time).  Also found that a couple of
	the suppressions were caused by failing to shutdown properly,
	so remove those (and uncover a D-Bus bug or two in the process).

	* nih/tests/test_dbus.c: Remove unnecessary SIGPIPE setting.

	* nih/libnih-dbus.supp: I keep finding ways in which D-Bus holds
	on to data, not to mention annoying NSS problems.

	* nih/libnih.supp: Add long-missing suppression for the main loop
	functions list, seems we've never actually tested that without
	freeing it manually.

2008-04-18  Scott James Remnant  <scott@netsplit.com>

	* nih/dbus.c (nih_dbus_connect, nih_dbus_bus): Functions to connect
	to an abitrary address or a well-known bus, calling our own handler
	on disconnect instead of exit() and setting things up in the main
	loop properly.
	(nih_dbus_setup): Function called by the above, and callable
	externally, to set up the disconnect handler and main loop hook-ups;
	deals with shared connections by checking the main loop slot.
	(nih_dbus_server): Similar function to create a listening server
	and hook it up to the main loop.
	(nih_dbus_add_watch, nih_dbus_remove_watch)
	(nih_dbus_watch_toggled, nih_dbus_watcher): Glue functions so that
	D-Bus can watch file descriptors using our main loop.
	(nih_dbus_add_timeout, nih_dbus_remove_timeout)
	(nih_dbus_timeout_toggled, nih_dbus_timer): Glue functions so that
	D-Bus can set timeouts using our main loop.
	(nih_dbus_wakeup_main): Glue function so that D-Bus can interrupt
	the main loop (I think this is really for multi-threaded apps, but
	it does no harm to force an iteration).
	(nih_dbus_callback): Glue function to dispatch D-Bus messages
	within the main loop.
	(nih_dbus_connection_disconnected): Filter function to catch the
	org.freedesktop.DBus.Local.Disconnected signal and call any
	disconnect handler before unreferencing the connection.
	(nih_dbus_new_connection): Handle new server connections by calling
	the connect handler if set, referencing the new connection then
	setting it up in the main loop.
	* nih/dbus.h (NihDBusDisconnectHandler, NihDBusConnectHandler):
	Function prototype typedefs for disconnect and connect handlers.
	* nih/tests/test_dbus.c (test_connect, test_bus, test_setup)
	(test_server): Test the new functions as best we can.
	* nih/libnih-dbus.supp: D-Bus slot allocator doesn't free memory.

	* nih/main.c (nih_main_loop_init): Make a non-static function.
	* nih/main.h: Add prototype.

2008-04-16  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_FILE_NE, TEST_FILE_NE_N): Fix logic of tests.

2008-04-12  Scott James Remnant  <scott@netsplit.com>

	* nih/Makefile.am: If we're not installing the library then we
	want to still make the script but don't want to install it.

	* nih/nih_dbus_tool.py: Skeleton code for the Python binding tool.
	* nih/tests/test_nih_dbus_tool.py: Test cases for the dbus tool.
	* nih/Makefile.am (TESTS): When building the dbus library, also run
	the Python test suite for the Python binding tool; this requires
	reversing the check_PROGRAMS/TESTS setting since it needs to only
	be in TESTS.

	* nih/libnih-dbus.supp, nih/libnih-dbus.ver: Library support files.

	* nih/dbus.c (nih_dbus_error_raise): Begin the D-Bus library with
	a function to raise an NihError that can be converted into a
	DBusError when necessary (to be used in function returns).
	* nih/dbus.h (NihDBusError): Type for the structure since we need
	to include a name member.
	* nih/tests/test_dbus.c (test_error_raise): Test case.
	* nih/errors.h: Add NIH_DBUS_ERROR error; no string for this since
	each individual error will have its own.

2008-04-11  Scott James Remnant  <scott@netsplit.com>

	* m4/misc.m4: Reverse the sense of the noinstall option, so that
	"install" needs to be present for libnih to be installed.
	* configure.ac: Install libnih when built from its own source.

2008-03-29  Scott James Remnant  <scott@netsplit.com>

	* nih/Makefile.am (libraries): Build optional libnih-dbus.la
	(libnih_dbus_la_SOURCES, libnih_dbus_la_CFLAGS)
	(libnih_dbus_la_LIBS, -version-info 0, libnih_dbus_la_LDFLAGS):
	Details for optional library.
	(EXTRA_DIST): Distribute the version script and suppressions files.
	(nihinclude_HEADERS): Install the optional libdbus header
	(bin_SCRIPTS): Build optional nih-dbus-tool binding tool script
	(CLEANFILES, EXTRA_DIST, do_subst, nih-dbus-tool): Create installed
	script by substituting in another, be sure to distribute the other
	and clean the intermediate file.
	(TESTS): Optional test suite
	(test_dbus_SOURCES, test_dbus_CFLAGS, test_dbus_LDFLAGS)
	(test_dbus_LDADD): Details for the optional dbus test suite.
	* m4/misc.m4 (AC_COPYRIGHT): Also add a Makefile PACKAGE_COPYRIGHT
	variable for substitution.
	(NIH_INIT): We have separate cflags for dbus-related tools, so we
	need to check that gcc supports -c and -o.

	* m4/libs.m4 (NIH_LIB_DBUS): Macro to detet whether pkg-config,
	D-Bus and Python are available and decide based on that whether or
	not we can build an optional D-Bus binding library; configure options
	and arguments determine whether being unable to is a warning or an
	error.
	* m4/misc.m4: Add the dbus option to the help and the call to check
	for the libraries.
	* README: Add a section on the dependencies this introduces.

	* m4/libs.m4: Add an empty file to hold macros relating to library
	detection.
	* m4/Makefile.am (dist_aclocal_DATA): Install and distribute the
	new macro file.
	* nihify: Symlink the new macro file across as well.

2008-03-19  Scott James Remnant  <scott@netsplit.com>

	* nih/hash.c (nih_hash_pointer_hash): Fix hash generation on 64-bit
	systems by using each byte rather than trying to be clever.

2008-03-14  Scott James Remnant  <scott@netsplit.com>

	* nih/hash.c (nih_hash_new): Also require hash and cmp functions
	and store in the structure.
	(nih_hash_add, nih_hash_add_unique, nih_hash_add_replace)
	(nih_hash_search, nih_hash_lookup): Change key type to void,
	use hash and cmp functions from the structure.
	(fnv_hash): Rename to nih_hash_string_key
	(nih_hash_string_cmp): String comparison function.
	(nih_hash_pointer_key, nih_hash_pointer_hash, nih_hash_pointer_cmp):
	Pointer hash functions.
	* nih/hash.h (NihHashFunction): Prototype for hash function.
	(NihCmpFunction): Prototype for key comparison function.
	(NihHash): Add hash_function and cmp_function members.
	(nih_hash_pointer_new, nih_hash_string_new): Macros to wrap function
	and pass in common key, hash and cmp functions.
	* nih/tests/test_hash.c: Update tests to include new functions and
	macros.
	* nih/watch.c: Use nih_hash_string_new() to create the hash table.

	* nih/command.c: Add const to local structures.
	(nih_command_join): Expect to not change the structures passed
	(nih_command_handle): Iterate structure as const.
	* nih/command.h: Add const to prototype.
	* nih/option.c: Add const to local structures.
	(nih_option_join): Expect to not change the structures passed
	* nih/option.h: Add const to prototype.

	* nih/error.c (nih_error_init): Make extern for consistency.
	* nih/error.h: Add prototype.
	* nih/logging.c (nih_log_init): Make extern for consistency.
	* nih/logging.h: Add prototype.

	* nih/child.c (child_watches): Rename to nih_child_watches and
	make extern.
	(nih_child_init): Make extern, update name of global.
	(nih_child_add_watch, nih_child_poll): Update name of global.
	* nih/child.h: Add prototypes.
	* nih/io.c (io_watches): Rename to nih_io_watches and make extern.
	(nih_io_init): Make extern, update name of global.
	(nih_io_add_watch, nih_io_select_fds, nih_io_handle_fds): Update
	name of global.
	* nih/io.h: Add prototypes.
	* nih/main.c (loop_functions): Rename to nih_main_loop_functions
	and make extern.
	(nih_main_loop_init, nih_main_loop, nih_main_loop_add_func): Update
	name of global.
	* nih/main.h: Add prototype.
	* nih/signal.c (signals): Rename to nih_signals and make extern.
	(nih_signal_init): Make extern, update name of global.
	(nih_signal_add_handler, nih_signal_poll): Update name of global.
	* nih/signal.h: Add prototypes.
	* nih/timer.c (timers): Rename to nih_timers and make extern.
	(nih_timer_init): Make extern, update name of global.
	(nih_timer_add_timeout, nih_timer_add_periodic)
	(nih_timer_add_scheduled, nih_timer_next_due, nih_timer_poll): Update
	name of global.
	* nih/timer.h: Add prototypes.

	* m4/misc.m4 (NIH_INIT): Allow the macro to take options, the first
	of which shall be "noinstall" which defines a Makefile conditional
	that prevents installation of files -- useful when embedded in
	things like Upstart.
	* m4/Makefile.am (dist_aclocal_DATA): Don't install if "noinstall"
	is defined.
	* nih/Makefile.am (lib_LTLIBRARIES): If "noinstall" is defined,
	still build the library but do not install it.
	(include_HEADERS): Don't install if "noinstall" is defined.

2008-03-08  Scott James Remnant  <scott@netsplit.com>

	* HACKING: Don't even need /product/ anymore.

	* HACKING: Terminology changes: Bazaar-NG is now just Bazaar;
	Malone is now just Launchpad's bug tracking system.

2008-03-07  Scott James Remnant  <scott@netsplit.com>

	* nih/error.h (NIH_SHOULD): We quite often need to loop while
	we get ENOMEM, but break on another error; this does that.
	* nih/watch.c (nih_watch_new): Use here, fixing a bug in the process
	where we didn't re-raise the error again.

2008-03-06  Scott James Remnant  <scott@netsplit.com>

	* nih/string.c (nih_strcat, nih_strncat, nih_strcat_sprintf)
	(nih_strcat_vsprintf): I'm needing to use realloc more than I should
	for string concatenation, so lets have some functions to do that.
	* nih/string.h: Prototypes for new functions.
	* nih/tests/test_string.c (test_strcat, test_strncat)
	(test_strcat_sprintf, test_strcat_vsprintf): Test the new functions.

	* TODO: Update.

2008-03-03  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_config.c (test_token): Also check that backslashes
	can escape themselves; since you may want a literal one followed by
	whitespace or a newline.
	* nih/config.c (nih_config_token): Dequote blackslash following a
	blackslash.

	* nih/tests/test_config.c (test_token): We don't want to dequote
	anything other than newlines and whitespace, since the quote
	characters may be important for the value (e.g. \$FOO being different
	to $FOO).  Add tests to make sure we don't.
	* nih/config.c (nih_config_token): After a slash, only dequote
	whitespace otherwise if we're copying, copy a literal slash character
	first.

	* nih/tests/test_string.c (test_array_append): Should work with a
	NULL array argument.
	* nih/string.c (nih_str_array_append): Make it work.
	(nih_str_array_copy): Which makes this function somewhat simpler.

2008-03-02  Scott James Remnant  <scott@netsplit.com>

	* nih/libnih.supp (nih-command-parser, nih-option-parser): Suppress
	leak of internal state during --help tests.
	(nih-main-package-string-test): Modify suppression to also catch
	when it's allocated within a test case.

2008-03-01  Scott James Remnant  <scott@netsplit.com>

	* nih/tree.h (NIH_TREE_FOREACH_FULL, NIH_TREE_FOREACH_PRE_FULL)
	(NIH_TREE_FOREACH_POST_FULL): The lack of these macros was silly.
	* nih/tests/test_tree.c (test_foreach_full)
	(test_foreach_pre_full, test_foreach_post_full): Add tests.

	* nih/tree.c (nih_tree_next, nih_tree_prev, nih_tree_next_pre)
	(nih_tree_prev_pre, nih_tree_next_post, nih_tree_prev_post): Rename
	these functions to *_full and add filter and data pointers, where
	the filter must return FALSE if given otherwise a node is ignored.
	* nih/tree.h: Update prototypes, and keep previous behaviour with
	the old names through the use of macros.  Typedef the filter function
	pointer type.
	* nih/tests/test_tree.c (test_next_full, test_prev_full)
	(test_next_pre_full, test_prev_pre_full, text_next_post_full)
	(test_prev_post_full): Test iteration with filters.

2008-01-16  Scott James Remnant  <scott@netsplit.com>

	* nih/tree.c (nih_tree_next, nih_tree_prev, nih_tree_next_pre)
	(nih_tree_prev_pre, nih_tree_next_post, nih_tree_prev_post): It's
	never possible to break out of the loop since we always return
	inside it.

	* nih/tests/test_child.c (test_poll): Add test case for the watch
	being on the wrong event.

	* m4/compiler.m4 (NIH_COMPILER_COVERAGE): Allow this to disable
	use of -Os, which otherwise wouldn't be.

	* configure.ac (AC_COPYRIGHT): Update copyright to 2008.

2008-01-15  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_child.c (test_poll): Don't run the ptrace tests
	under valgrind, since they upset it somewhat and return different
	things (I expect we end up tracing valgrind itself).

	* nih/main.c (nih_main_daemonise): Formatting fix.

2008-01-14  Scott James Remnant  <scott@netsplit.com>

	* HACKING: Correct bzr URL to trunk.

2007-12-06  Scott James Remnant  <scott@netsplit.com>

	* nih/child.c (nih_child_poll): I give up.  The wait queue can change
	between an invocation of waitid with WNOWAIT and the invocation later
	to "remove" the entry.  WNOWAIT is a waste of time, and no matter how
	useful it might have been, I just see no way of actually using it.
	* nih/child.h: Update documentation.

2007-12-02  Scott James Remnant  <scott@netsplit.com>

	* nih/signal.c (nih_signal_set_handler): Drop the SA_NOCLDSTOP flag
	from when we were setting SIGCHLD, I've no idea why this crept in
	and it now stops us doing things we want to.
	* nih/tests/test_signal.c (test_set_handler): Remove the test for it.

	* nih/tests/test_child.c (test_poll): Fix for AMD64, the data
	argument for PTRACE_GETEVENTMSG is unsigned long, which is larger
	than pid_t here.

	* nih/tests/test_child.c (test_poll): Fix up several race
	conditions in the ptrace test cases, there are a lot of quirks you
	have to remember when dealing this most insane of syscalls.
	(signal from traced child): Once we've finished the test we must
	detach from the child otherwise we'll trap our own SIGTERM and the
	child won't exit.  Tthere's no need to send SIGCONT since this
	is an ordinary ptrace signal trap.
	(exec by traced child): Detach and send SIGCONT in case the process
	we run gets a signal delivered to it; if that happened, we'd trap
	that signal and the child would never exit.
	(fork by traced child): This is the most pathalogical.  We had a
	race where nih_child_poll() was actually reaping the event for the
	child stopping.  Change to get the child pid and wait for it before
	calling the poll function.  Don't bother waiting for the child to
	terminate, we shouldn't ever find out if we've detached properly.

2007-11-29  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_write_pidfile): Have to cast the difference
	in pointers to int, otherwise we get a compiler warning on amd64.

	* nih/child.c (nih_child_poll): Remove the hacks that shift the
	status information back now that we have a kernel patch in akpm's
	tree to fix it.

2007-11-15  Scott James Remnant  <scott@netsplit.com>

	* nih/child.c (nih_child_poll): I found out what was causing the
	signal information to be missing for CLD_STOPPED, a kernel bug;
	cope with it for now by shifting the status across 8 bits for
	CLD_TRAPPED and CLD_STOPPED until I get Roland to fix that bit.
	* nih/tests/test_child.c (test_poll): Replace sleeps with waitid
	WNOWAIT calls now that that particular kernel bug is fixed; add
	a couple of pauses so that the child doesn't exit and clean up
	the wait queue before we get a chance to look.  Add a wait on the
	child stopping after fork to avoid a race condition where the child
	isn't actually running yet when we try and detach from it.

	* nih/child.h (NihChildWatch): Add events member and rename reaper
	to handler, since it can now be called for things like stop, trap
	and ptrace events.
	(NihReaper): Rename to NihChildHandler
	(NihChildEvents): Enumeration/bit flags for events member
	* nih/child.c (WAITOPTS): Define wait options in one place to make
	repeating them easier.
	(nih_child_add_watch): Add events argument and change type and name
	of function argument, set in the structure.
	(nih_child_poll): Rather than just working out a killed boolean (which
	was wrong anyway since it didn't take CLD_DUMPED into account), we
	store one of many events in the event argument and convert status if
	necessary (bit shifting for CLD_TRAPPED and ptrace events).  Check
	this event against the events mask in the watch, and pass to the
	handler.
	* nih/tests/test_child.c (test_add_watch): Check that events and
	handler are initialised correctly.
	(test_poll): Many new test cases for exiting, killing, aborting,
	stopping, continuing, trapping and ptracing.

2007-11-03  Scott James Remnant  <scott@netsplit.com>

	* nih/watch.h (NihWatch): Add created hash table so we can easily
	delay the create_handler until the file is closed.
	* nih/watch.c (nih_watch_new): Initialise the created hash table.
	(nih_watch_handle): When a file is created, add an entry to the
	created hash table and return without calling a handler -- for all
	paths, check for and remove any remove any existing created entry;
	call create_handler instead of modify_handler if this exists, and
	don't call delete_handler at all.
	* nih/tests/test_watch.c (test_new): Check created is initialised.
	(test_reader): Test that creating a file doesn't trigger create
	until it's closed and that unlinking a file before it's been closed
	doesn't trigger at all.

	* nih/test.h (TEST_FREE_TAG): assert that we don't use this on
	a NULL pointer.

2007-11-02  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_FUNCTION_FEATURE): Add macro for when we're
	testing a specific feature of a function.

2007-10-27  Scott James Remnant  <scott@netsplit.com>

	* m4/compiler.m4 (NIH_COMPILER_OPTIMISATIONS): Add extra [...]

	* m4/compiler.m4 (NIH_COMPILER_WARNINGS): Add missing [...] around
	the second argument to AS_IF.
	(NIH_COMPILER_OPTIMISATIONS): Fix wrong use of [..][..] to [....]
	(NIH_COMPILER_COVERAGE): Remove extraneous comma

	* m4/linker.m4 (NIH_LINKER_VERSION_SCRIPT): Restore AM_CONDITIONAL
	that was mistakenly dropped.

2007-10-26  Scott James Remnant  <scott@netsplit.com>

	* m4/linker.m4 (NIH_LINKER_SYMBOLIC_FUNCTIONS): Test that checks
	for -Bsymbolic-functions

	* m4/linker.m4: Style fix.

	* m4/compiler.m4 (NIH_COMPILER_COVERAGE, NIH_COMPILER_OPTIMISATIONS)
	(NIH_COMPILER_WARNINGS): Update to use AS_IF.

	* m4/compiler.m4 (NIH_C_THREAD): Shell fix.

	* m4/linker.m4 (NIH_LINKER_OPTIMISATIONS): Update to use AS_IF.

	* m4/linker.m4 (NIH_LINKER_VERSION_SCRIPT): Update so it supports
	a config.cache

2007-10-24  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c (nih_file_map): Catch a file larger than the length of
	size_t and raise the standard EFBIG error message.  Noticed by
	Kees Cook.

2007-10-15  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_alloc_using, nih_alloc_reparent, nih_realloc):
	Change the order in which children allocations are stored in the
	list such that the last allocation is freed first rather than
	the other way around.  This solves issues of children being stored
	inside an allocated hash table which will be freed first.

	* m4/misc.m4 (NIH_INIT): Use AC_PROG_CC_C99 instead of NIH_C_C99
	* configure.ac: Bump Autoconf dependency to 2.61
	* HACKING: Likewise increase documentation

	* HACKING: Correct Bazaar branch now we're natively hosted on LP

	* nih/test.h (_test_allocator): Mark used in case it isn't.
	(_test_free_tag, _test_free_tags, _test_destructor)
	(TEST_FREE_TAG, TEST_FREE, TEST_NOT_FREE): Since destructors are
	now intended for internal use by an object, we shouldn't abuse them
	in test cases like we were doing - since we might not chain up
	properly and miss vital behaviour as a result.  Instead implement
	some tests that use a destructor on an nih_alloc() child of the object
	to determine freeness.
	* nih/tests/test_watch.c (test_reader): Use TEST_FREE instead of
	a custom destructor, which are no longer favoured for this kind
	of work.
	* nih/tests/test_error.c (test_raise_again, test_pop_context): 
	Use TEST_FREE instead of custom destructor.
	* nih/tests/test_timer.c (test_poll): Use TEST_FREE/TEST_NOT_FREE
	* nih/tests/test_child.c (test_poll): Use TEST_FREE, etc.
	* nih/tests/test_io.c (test_shutdown, test_watcher)
	(test_read_message, test_read, test_get): Use TEST_FREE, etc.

	* nih/hash.c, nih/timer.c, nih/signal.c, nih/child.c, nih/io.c,
	nih/watch.c: Document why non-allocated versions of functions
	are missing.
	* TODO: Update.

2007-10-14  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_free): Call destructors before freeing children,
	this makes them more consistent with being structure clean-up
	functions rather than using them to detect a free.  Don't return
	values from children destructors.
	* nih/tests/test_alloc.c (test_free): Adjust test, return values
	from children destructors are never returned.

	* nih/watch.c (nih_watch_new): Make the io structure an nih_alloc
	child of the watch, now that we don't perform any kind of lazy
	freeing or closing.
	(nih_watch_destroy): No need to close the io structure since it'll
	be automatically freed, just set the flag to be caught in the reader.
	* nih/tests/test_watch.c (test_new): Check parent of watch->io
	is watch, not NUL.
	(test_destroy): Don't use the destructor anymore, nih_alloc is tested
	elsewhere.
	(test_reader): Don't use destructor to test watch->io
	(my_destructor): Always call nih_watch_destroy since this is only
	used for that.

	* nih/io.c (nih_io_close): Rename to nih_io_destroy, setting a free
	flag in the structure if necessary before closing the descriptor
	and calling the error handler if there's a problem.
	(nih_io_reopen): Set destructor
	(nih_io_watcher): Rename lazy_close to caught_free and check its
	value after any calls to the reader, error handler or close handler
	functions; if true, simply bail out.  Reorder leaving so that a
	shutdown check happens last (since this can free the structure).
	(nih_io_closed): Now simply calls the close handler if it exists,
	otherwise frees the structure.
	* nih/io.h (NihIo): Rename close member to free.
	Update prototypes.
	* nih/tests/test_io.c (my_reader, test_reopen): Use nih_free
	instead of nih_io_close.
	(test_reopen): Create new fds each time, since they are closed
	on free now.
	(destructor_called): Chain up to call nih_io_destroy
	(test_close): Rename to test_destroy and alter appropriately.
	(test_watcher): Adjust documentation to say we're checking that free
	is called in the reader.
	(test_send_message, test_write, test_printf): Open pipes rather
	than just stdout, because that will end up closed.

2007-10-12  Scott James Remnant  <scott@netsplit.com>

	* nih/watch.h (NihCreateHandler, NihModifyHandler, NihDeleteHandler):
	Modify doc strings to mention nih_free instead of nih_watch_free

	* nih/tests/test_file.c (my_visitor): Set destructor for the list
	entries we create as we go.

	* nih/watch.c (nih_watch_reader): Rework the function slightly,
	instead of using the free pointer to free at the end of the handler,
	use it to detect the free after the handler returns and immediately
	abort -- it means we won't process remaining watches but meh.
	(nih_watch_handle): Get passed the caught_free flag and check it
	after calling any handlers to make sure we abort properly.
	(nih_watch_free): Rename to nih_watch_destroy and just handle the
	internal cleanup.
	(nih_watch_new): Set the destructor properly.
	* nih/watch.h: Update prototypes.
	* nih/tests/test_watch.c (test_free): Rename to test_destroy.
	(my_delete_handler): Use nih_free not nih_watch_free
	(my_destructor): Chain up to nih_watch_destroy for NihWatch.

	* nih/tests/test_watch.c (my_destructor): Neither NihWatch nor NihIo
	need a destructor to be called.

	* nih/tests/test_child.c (test_poll): Fix erroneous removal of "1"

	* TODO: Update.

2007-10-11  Scott James Remnant  <scott@netsplit.com>

	* nih/option.c, nih/command.c, nih/config.c: Remove references to
	nih_alloc_set_destructor() from doc strings since this is now
	considered bad practice.

	* nih/main.c (nih_main_loop_add_func): Adjust call to set destructor
	* nih/tests/test_main.c (test_main_loop)
	(test_main_loop_add_func): Call nih_free instead of nih_list_free

	* nih/watch.c (nih_watch_add, nih_watch_handle): Call nih_free
	instead of nih_list_free
	(nih_watch_add): Set destructor to nih_list_destroy for now.
	* nih/tests/test_watch.c (my_destructor): Call nih_list_destroy
	for NihWatch structure.

	* nih/file.c (nih_dir_walk_visit): Call nih_free instead of
	nih_list_free
	(nih_dir_walk, nih_dir_walk_visit): Set destructor on object.

	* nih/tests/test_io.c (test_add_watch, test_select_fds)
	(test_handle_fds, test_shutdown, test_watcher): Call nih-free
	instead of nih_list_free
	(destructor_called): Call nih_list_destroy when passed an
	NihIoMessage; a bit icky since this is also called for an NihIo
	which doesn't have a destructor (yet)

	* nih/io.c (nih_io_watcher_write, nih_io_read, nih_io_get): Call
	nih_free instead of nih_list_free.
	(nih_io_add_watch): Adjust call to set destructor
	(nih_io_message_new): Set a destructor so the message is removed
	from a list when freed.

	* nih/child.c (nih_child_add_watch): Adjust call to set destructor
	(nih_child_poll): Call nih_free instead of nih_list_free
	* nih/tests/test_child.c (test_add_watch, test_poll): Call nih_free
	instead of nih_list_free.
	(my_destructor): Call nih_list_destroy().

	* nih/string.c: Fix documentation as below.

	* nih/hash.c: Fix doc string, destructors are now considered internal
	and shouldn't be set by callers.

	* nih/signal.c (nih_signal_add_handler): Adjust call to set destructor
	* nih/tests/test_signal.c (test_add_handler): Call nih_free instead
	of nih_list_free

	* nih/timer.c: Fix doc strings

	* nih/timer.c (nih_timer_add_timeout, nih_timer_add_periodic)
	(nih_timer_add_scheduled): Adjust calls to set destructor.
	(nih_timer_poll): Call nih_free rather than nih_list_free.
	* nih/tests/test_timer.c (test_add_timeout, test_add_periodic)
	(test_add_scheduled, test_next_due): Call nih_free rather than
	nih_list_free
	(my_destructor): Call the list destructor.

	* nih/tree.c (nih_tree_destructor): Rename to nih_tree_destroy()
	(nih_tree_free): Drop.
	(nih_tree_new, nih_tree_entry_new): Set destructor.
	* nih/tree.h: Update prototypes.
	* nih/tests/test_tree.c (test_destructor): Rename.
	(test_free): Drop

	* nih/: Documentation string fix.

	* nih/tests/test_hash.c (test_string_key): Replace nih_list_free
	call with nih_free, since we're not overriding the destructor.

	* nih/list.c (nih_list_free): Drop this function.
	(nih_list_destructor): Rename to nih_list_destroy()
	(nih_list_new, nih_list_entry_new): Set destructor function.
	* nih/list.h: Update prototypes.
	* nih/tests/test_list.c (test_destructor): Rename.
	(test_free): Drop.
	(test_add): Replace nih_list_free calls with nih_free

2007-10-08  Scott James Remnant  <scott@netsplit.com>

	* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.16.1 since this
	version of gettext is needed for compatibility with Automake 1.10
	* HACKING: Bump version in the docs too.

	* Makefile.am (ACLOCAL_AMFLAGS): Specify that aclocal install
	ordinarily system-wide macros into m4 (libtool.m4, specifically).
	This makes it easier for packagers to modify autoconfery since
	aclocal is no longer a destructive event.
	* configure.ac (AM_INIT_AUTOMAKE): Increase Automake requirement to
	1.10 to ensure we have aclocal --instal
	* HACKING: Increase Automake version in the docs.

2007-06-22  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_tree.c (test_next, test_prev, test_next_pre)
	(test_prev_pre, test_next_post, test_pre_post): Add tests for a
	single-node tree, because we found a bug where it didn't work.
	* nih/tree.c (nih_tree_next): Bug fix; check there is a right node
	before checking whether we've returned from it, otherwise we could
	confuse it with starting at the top of the tree.
	(nih_tree_prev): Likewise check there is a left node before checking
	whether we've returned from it.

2007-06-20  Scott James Remnant  <scott@netsplit.com>

	* nih/config.c (nih_config_parse_stanza): Free name after use.

	* nih/config.c (nih_config_parse_stanza): Don't dequote stanza
	names, since otherwise they can't be made non-special; if we don't
	recognise the stanza we parsed, raise the error without updating
	pos, since we want it to point to the start of the token.
	* nih/tests/test_config.c (test_parse_stanza): Update pos in test.

2007-06-18  Scott James Remnant  <scott@netsplit.com>

	* nih/list.h (NihListEntry): Define structure combining an NihList
	with a union of common types.
	* nih/list.c (nih_list_entry_new): Add a helper function for when
	we need a simple entry without any extra structure around it.
	* nih/tests/test_list.c (test_entry_new): Test the new function.
	* nih/tree.h (NihTreeEntry): Define structure combining an NihTree
	with a union of common types.
	* nih/tree.c (nih_tree_entry_new): Add a helper function for when
	we need a simple node without any extra structure around it.
	* nih/tests/test_tree.c (test_entry_new): Test the new function.

2007-06-15  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_tree.c (test_next, test_foreach, test_prev) 
	(test_next_pre, test_foreach_pre, test_prev_pre, test_next_post) 
	(test_foreach_post, test_prev_post): Add tests for partial tree
	traversal, we don't expect to break out of the confines of the
	root that we've set, even if it has a parent.
	* nih/tree.c (nih_tree_next, nih_tree_prev, nih_tree_next_pre)
	(nih_tree_prev_pre, nih_tree_next_post, nih_tree_prev_post): Before
	moving up to the parent node, check whether the current node is the
	tree root; if it is, return NULL instead since we've iterated the
	sub-tree we were looking at.

	* nih/tests/test_tree.c (test_next, test_foreach, test_prev) 
	(test_next_pre, test_foreach_pre, test_prev_pre, test_next_post) 
	(test_foreach_post, test_prev_post): Use two different arrays to
	make it really obvious how the tree is constructed and what order
	we really expect it to be in.  This makes it easier to get ready for
	the next bit ...

	* nih/tree.c (nih_tree_next, nih_tree_prev): Minor bug fix, set the
	previous to the tree's parent when visiting for the first time so that
	partial	tree iterations might be able to work.  Make algorithm code
	simpler and more readable.
	(nih_tree_next_pre, nih_tree_prev_pre): Algorithm for non-recursive
	pre-order tree iteration, note that unlike the above, these are not
	symmetrical.
	(nih_tree_next_post, nih_tree_prev_post): Algorithm for non-recursive
	post-order tree iteration, note that these aren't symmetrical with
	each other, but are the symmetrical equivalents of the pre-order
	functions.
	* nih/tree.h: Add prototypes for new functions.
	(NIH_TREE_FOREACH_PRE, NIH_TREE_FOREACH_POST): Add convenience
	iteration macros for pre-order and post-order iteration.
	* nih/tests/test_tree.c (test_next, test_foreach, test_prev): Add
	some documentation for the tree shape, and how we work out the node
	numbers.  In each case, we were accidentally giving the expected
	first node (which fortunately always worked); to test this harder,
	give the root node instead!
	(test_next_pre, test_foreach_pre, text_prev_pre): Test pre-order
	tree iteration with the same basic code.
	(test_next_post, test_foreach_post, text_prev_post): Test post-order
	tree iteration with the same basic code.

2007-06-12  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_HASH_NOT_EMPTY): Add missing ;

	* nih/main.c (nih_main_unlink_pidfile): Add for completeness.
	* nih/main.h: Add prototype.
	* nih/tests/test_main.c: Use the new function here for testing.

	* nih/main.c (nih_main_pidfile): Rename to nih_main_write_pidfile
	(nih_main_set_pidfile, nih_main_get_pidfile) 
	(nih_main_read_pidfile): Add companion functions to set and get the
	current location, and also read from it.
	* nih/main.h: Add prototypes.
	* nih/tests/test_main.c (test_set_pidfile, test_read_pidfile) 
	(test_write_pidfile): Test the functions as best we can.

	* nih/main.c (nih_main_daemonise): Cut the pid file writing out
	(nih_main_pidfile): and place it into its own function, since we
	seem to use this elsewhere too.
	* nih/main.h: add prototype.

	* nih/main.c (nih_main_daemonise): Don't just write the pid file
	directly, and hope it works.  Write to a temporary file, flush and
	sync it, then rename to the real filename.  This provides a "if the
	pid file exists, a pid can be read from it" contract - or at least,
	the nearest we can to that.

2007-06-11  Scott James Remnant  <scott@netsplit.com>

	* nih/config.c (nih_config_skip_block): Simple function to skip over
	a block inline without parsing it into a string.
	* nih/config.h: Add prototype.
	* nih/tests/test_config.c (test_skip_block): Test the new function.

2007-06-10  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_HASH_EMPTY, TEST_HASH_NOT_EMPTY): Add some
	tests for hash emptyness.

2007-06-03  Scott James Remnant  <scott@netsplit.com>

	* nih/file.h (NihFileFilter): add missing data pointer to definition.
	* nih/file.c (nih_dir_walk_scan): Take the data pointer and pass it
	to the filter function.
	(nih_dir_walk, nih_dir_walk_visit): Pass data pointer to scan function.
	(nih_file_ignore): Accept and ignore a data pointer.
	* nih/tests/test_file.c (my_filter): Add data pointer.
	(test_ignore): Pass NULL for data pointer.
	* nih/watch.c (nih_watch_handle): Pass data to filter function.
	* nih/tests/test_watch.c (my_filter): Add data pointer.

2007-05-27  Scott James Remnant  <scott@netsplit.com>

	* nih/config.c (nih_config_parse): Since we've elimated all of the
	uses of ssize_t in this code, we're safe to parse a file larger
	than SSIZE_MAX, so drop the check.
	* nih/errors.h (NIH_CONFIG_TOO_LONG): Drop this error, since there
	can be no such case anymore; technically we don't handle very large
	files since we can only map 4GB of memory, but we fail by mapping
	a smaller part of the file, rather than overrunning any buffers.

	* nih/config.c (nih_config_parse_block): Don't use -1 in ws to
	indicate we've not counted it yet, instead use the current value
	of lines; this elimates the last ssize_t from the code.

	* nih/config.c (nih_config_block_end): Modify to return TRUE or
	FALSE, and set the end position through an argument instead.
	(nih_config_parse_block): Update the way we call nih_config_block_end
	to receive the end location via the pointer, rather than as the
	return value.

	* nih/config.c (nih_config_token): Change return value to an int,
	and return the token length through an argument pointer if given.
	This eliminates a need for ssize_t for this function.
	(nih_config_next_token, nih_config_parse_command): Update way we
	call nih_config_token to obtain the length through a pointer, and
	directly check the return value to decide whether to abandon it.
	* nih/config.h: Update prototype.
	* nih/tests/test_config.c (test_token): Update the tests to check
	the pointed value for the length, and the return value for error.

2007-05-18  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_string.c (test_array_append): Make sure that the
	array is returned unaltered (at least, apparently) if any allocation
	fails during the append.
	* nih/string.c (nih_str_array_append): Record the original length,
	and pass always pass our local length variable to nih_str_array_add.
	Before returning, overwrite the returned length; if any allocation
	fails, unwind other allocations and restore the NULL pointer before
	returning NULL.

	* nih/string.c (nih_str_array_copy, nih_str_array_append): Add a
	couple of functions to copy a string array, and to append one onto
	the end of another.  Saves reimplementing this each time.
	* nih/string.h: Add prototypes.
	* nih/tests/test_string.c (test_array_copy, test_array_append):
	Test the new functions.

2007-04-24  Scott James Remnant  <scott@netsplit.com>

	* nih/string.c (nih_vsprintf): Add va_end to va_copy; C standard
	says so.

2007-03-13  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_io.c (test_get_family): The elmos of this world
	like to disable various networking protocols, so expect that and
	skip test cases.

	* nih/io.h: Change int_data type to a plain old int; there's no
	reason for it to be a fixed width type, and we may as well think
	about supporting ILP64 in case someone does something silly one day.

2007-03-11  Scott James Remnant  <scott@netsplit.com>

	* m4/compiler.m4: Don't check for __thread unless --enable-threading
	given to configure, instead define it to empty.

	* TODO: Update.

2007-03-09  Scott James Remnant  <scott@netsplit.com>

	* nih/logging.c: Make the current log priority available globally
	through the nih_log_priority variable.
	* nih/logging.h: Update.

2007-03-08  Scott James Remnant  <scott@netsplit.com>

	* nih/macros.h (_n): Add a macro to wrap ngettext() for plural forms.

2007-03-02  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_watch.c: Skip these tests if inotify is not
	available, since there's not much we can do.

2007-02-16  Scott James Remnant  <scott@netsplit.com>

	* nih/tree.c (nih_tree_next, nih_tree_prev): Add non-recursive
	functions to iterate a tree in-order either forwards or backwards.
	* nih/tree.h (NIH_TREE_FOREACH): Standard macro for wrapping
	nih_tree_next and turning it into a for loop.
	* nih/tests/test_tree.c (test_next, test_foreach, test_prev): Test
	things with a complex tree to see whether they work out ok.

	* nih/list.h: Fix formatting and ordering.
	* nih/list.c: Fix function ordering.

	* nih/tree.c: Add generic code to implement pure binary trees.
	* nih/tree.h: Structures, typedefs and prototypes.
	* nih/tests/test_tree.c: Binary tree test suite.
	* nih/libnih.h: Include tree.h
	* nih/Makefile.am (libnih_la_SOURCES): Build and link tree.c
	(nihinclude_HEADERS): Install tree.h
	(TESTS): Build and run binary tree test suite.
	(test_tree_SOURCES, test_tree_LDFLAGS, test_tree_LDADD): Details for
	binary tree test suite binary.

2007-02-15  Scott James Remnant  <scott@netsplit.com>

	* nih/watch.c (INOTIFY_EVENTS): Use IN_CLOSE_WRITE instead of
	IN_MODIFY; since that guarantees the file has actually been closed,
	and is probably on the filesystem now.

2007-02-13  Scott James Remnant  <scott@netsplit.com>

	* nih/signal.c: Add SIGUNUSED to the list of signals that might not
	exist.

	* nih/tests/test_option.c (test_parser): gcc doesn't like using
	variables inside fixed for loops, so initialise it deliberately.
	* nih/tests/test_command.c (test_help): Was mistakenly repeatedly
	opening output.
	(test_parser): Similar for loop issue.

	* nih/signal.c: Update signal name list, some signals don't exist on
	sparc and some turn up unexpectedly.

2007-02-11  Johan Kiviniemi  <johan@kiviniemi.name>

	* nih/hash.h (NIH_HASH_FOREACH, NIH_HASH_FOREACH_SAFE): Added missing
	parenthesis around hash, in case it's a complicated expression with
	unsurprising precedence results.

2007-02-11  Scott James Remnant  <scott@netsplit.com>

	* nih/config.c (nih_config_skip_whitespace): It turns out that when
	parsing, it's often useful to skip any whitespace while retaining the
	"step over newlines" behaviour.  Seperate it out into its own 
	function.
	(nih_config_next_token): Call the new function.
	* nih/config.h: Add prototype.
	* nih/tests/test_config.c (test_skip_whitespace): Check the function

	* nih/config.c: Remove macro definitions
	* nih/config.h: and make them public instead
	* nih/tests/test_config.c: Use macros.

	* nih/config.c (nih_config_next_token): Strange hybrid function,
	it behaves like next_arg() but accepts the same arguments as token();
	it skips whitespace, but only if the initial whitespace character is
	in the delim argument.
	(nih_config_next_arg): This becomes a wrapper around next_token.
	* nih/config.h: Add prototype.
	* nih/tests/test_config.c (test_next_token): Check the new function.

	* nih/config.c (nih_config_next_token): Rename to nih_config_token,
	since this doesn't behave like the next_arg() function, and we want
	a similar token function that behaves like that.
	* nih/config.h: Update.
	* nih/tests/test_config.c (test_next_token): Rename and update.

2007-02-09  Scott James Remnant  <scott@netsplit.com>

	* nih/hash.h (NIH_HASH_FOREACH_SAFE): Oops, s/list/hash/

	* nih/hash.h (NIH_HASH_FOREACH, NIH_HASH_FOREACH_SAFE): Add macros
	to iterate over an entire hash table.
	* nih/tests/test_hash.c (test_foreach, test_foreach_safe): Test the
	macros.

	* nih/hash.c (nih_hash_string_key): Add a useful function to return
	the first member after the list header.
	* nih/hash.h: Add prototype.
	* nih/tests/test_hash.c (test_string_key): Add test case.

	* nih/file.c (nih_file_is_packaging): Check for common packaging
	filenames -- I swore I wrote this, but I can't find it.
	(nih_file_ignore): Ignore packaging files.
	* nih/file.h: Update.
	* nih/tests/test_file.c (test_is_packaging, test_ignore): Test.

2007-02-07  Scott James Remnant  <scott@netsplit.com>

	* nih/logging.c (nih_logger_printf): Change printf logger to not
	prefix anything intended for stdout.
	* nih/logging.h: Rearrange.
	* nih/tests/test_logging.c (test_logger_printf): Make sure that
	we don't prefix the program name for messages that go to stdout.

2007-02-06  Scott James Remnant  <scott@netsplit.com>

	* nih/signal.c (nih_signal_from_name): Table changed to not contain
	SIG, so this now strips it off the front if present.
	* nih/tests/test_signal.c (test_to_name): Strip SIG from the front
	(test_from_name): Check that we can omit SIG from the front.

	* nih/signal.c (nih_signal_to_name, nih_signal_from_name): Functions
	annoyingly missing from the standard library; convert signal names
	and numbers between each other (e.g. SIGTERM -> 15).
	* nih/signal.h: Add prototypes.
	* nih/tests/test_signal.c (test_to_name, test_from_name): Put the
	new functions through their paces.

	* nih/string.c (nih_str_array_add, nih_str_array_addn): Correct leak
	when array allocation fails.

	* nih/string.c (nih_str_array_add, nih_str_array_addn) 
	(nih_str_array_addp): Allow the array pointed to to be NULL, after all,
	realloc works anyway.  Also allow len to be NULL, in which case, we
	count the elements automatically.
	* nih/tests/test_string.c (test_array_addp): Update test cases.

	* nih/config.c (nih_config_parse_args): Use nih_str_array functions.
	* nih/file.c (nih_dir_walk_scan): Use nih_str_array functions.
	* nih/option.c (nih_option_parser): Use nih_str_array functions.
	(nih_option_add_arg): Drop this function now.

	* nih/string.c (nih_str_array_addp): Yet another variation on a theme;
	this one saves duplicating allocs, which is always messy.
	(nih_str_array_addn): Wrap around the above function.
	(nih_str_array_add): Make this a wrapper around addp instead.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_array_addp): Check that one works.

	* nih/string.c (nih_str_split): Use nih_str_array functions.

	* nih/string.c (nih_str_array_addn): Add a version of nih_str_array_add
	that calls nih_strndup instead of nih_strdup.
	(nih_str_array_add): turn into a thin wrapper around the above.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_array_addn): Test new function.
	
	* nih/string.c (nih_str_array_add): Flip array and parent arguments
	to make it more like realloc.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_array_add): Update.

	* nih/string.c (nih_str_array_new, nih_str_array_add): Functions
	to handle the common cases of arrays of strings.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_array_new, test_array_add): Test.

	* nih/watch.c (nih_watch_handle): Never assert on data received from
	an untrusted source (well, the kernel, anyway).  Also make sure nobody
	sneaks a '/' into the name of an inotify event.

2007-02-05  Scott James Remnant  <scott@netsplit.com>

	* nih/string.c (nih_vsprintf): Make sure vsnprintf never returns
	a negative value; C99 says it can't, of course, but Kees was
	paranoid.

2007-02-03  Scott James Remnant  <scott@netsplit.com>

	* nih/watch.c (nih_watch_new): Tidy up ENOMEM loop.

	* nih/tests/test_file.c (test_dir_walk): Fix leak of directory caused
	by not removing a symlink.
	* nih/tests/test_watch.c (test_new, test_add): Fix leaks of
	directories caused by not changing permissions back so we can unlink
	under them.

	* nih/watch.h (NihCreateHandler, NihModifyHandler): Add stat argument.
	* nih/watch.c (nih_watch_handle): stat any object created or modified,
	and pass the stat buf to the handler function.
	(nih_watch_add_visitor): Pass stat argument here too.

	* nih/tests/test_watch.c: Add arguments.

	* nih/option.c (nih_option_int): Function to parse integer values
	on the command line.
	* nih/option.h: Add prototype.
	* nih/tests/test_option.c (test_int): test case for it.

	* nih/file.c (nih_file_is_hidden, nih_file_is_backup) 
	(nih_file_is_swap, nih_file_is_rcs): Functions to match common
	file types by their path.
	(nih_file_ignore): Function to combine calls to all of the above.
	* nih/file.h: Add prototypes.
	* nih/tests/test_file.c: Add test cases for the new functions.
	* TODO: Update.

2007-02-02  Scott James Remnant  <scott@netsplit.com>

	* TODO: Update.

	* nih/watch.c (nih_watch_new): Add a create argument to avoid
	walking a directory tree twice; store in the structure.
	(nih_watch_add_visitor): Call the create handler if necessary.
	* nih/watch.h: Update structure to include member and prototype.
	* nih/tests/test_watch.c (test_new): Check that, when called with
	create, the handler is called for each file that exists.
	(test_reader): Check that a directory is recursed when moved in
	or created with existing files.

	* nih/tests/test_watch.c (test_reader): Add test case for watching
	sub-directories again.

	* nih/watch.c (nih_watch_new, nih_watch_add): Make safe against
	ENOMEM; otherwise it's just tricky to decide when it's good and bad
	to throw things out.
	* nih/tests/test_watch.c: Update test cases accordingly.

	* nih/watch.c (nih_watch_add): It's not an error for subdirs to be
	TRUE when we get passed a filename.
	* nih/tests/test_watch.c (test_add): Check that it works.

	* nih/file.c (nih_dir_walk): Initialise ret to zero, otherwise
	can return an uninitialised value when walking an empty directory.

	* nih/tests/test_child.c (test_poll): Reap the child we kill,
	otherwise the next test might fail sometimes.

	* nih/watch.c (nih_watch_add): Make being unable to recurse into
	sub-directories to watch them an error.
	* nih/tests/test_watch.c (test_new, test_add): Update test cases.

	* nih/file.c (nih_dir_walk): Rework this function to support
	detection of directory loops, and reporting of errors with a callback
	handler rather than just aborting the walk.
	(nih_dir_walk_scan): Build up a sorted list of paths under a directory,
	filtered with the filter function.  Split out because it has different
	error handling semantics.
	(nih_dir_walk_visit): Visit a single path and if it's a directory,
	descend into it.
	* nih/file.h (NihFileVisitor): Add arguments to pass the top-level
	directory and the stat buffer of the path (to avoid stating the same
	things multiple times).
	(NihFileErrorHandler): Duplicate prototype for the error handler.
	* nih/errors.h (NIH_DIR_LOOP_DETECTED): Add new error.
	* nih/tests/test_file.c (test_dir_walk): Update test cases, improving
	test coverage at the same time.
	* nih/watch.c (nih_watch_add_visitor): Update to check the stat
	passed to the visitor, as well as accept the directory name,

2007-02-01  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_io.c: Replace NIH_ZERO in test cases with assert0

	* nih/tests/test_main.c (test_main_loop): Eliminate use of NIH_MUST
	* nih/tests/test_io.c (test_watcher): Remove unnecessary NIH_MUST

	* nih/test.h (assert0): Add an assert wrapper for the common
	alternate case.

2007-01-30  Scott James Remnant  <scott@netsplit.com>

	* nih/io.c (nih_io_buffer_resize): Always keep a buffer filled with
	zeros when we extend it, so we never pass uninitialised data to
	syscalls.

	* m4/misc.m4 (NIH_INIT): Detect valgrind/valgrind.h
	* nih/tests/test_signal.c: Detect valgrind and don't check the error
	values from trying to set SIG_DFL or SIG_IGN for SIGKILL; which for
	no readily apparent reason, works under valgrind.

	* HACKING: Add newline to end of file.

	* nih/test.h (TEST_ALLOC_SAFE): Add macro to guard allocations so
	they aren't counted.
	* nih/tests/test_file.c (my_visitor, test_dir_walk): Use
	TEST_ALLOC_SAFE instead of changing the allocator by hand.
	* nih/tests/test_io.c (test_watcher): Use TEST_ALLOC_SAFE instead of
	changing the allocator by hand,

	* nih/macros.h (NIH_MUST_NOT): Rename to NIH_ZERO
	* nih/io.c (nih_io_message_recv): Use NIH_ZERO, instead of == 0
	* nih/main.c (nih_main_loop_init): Use NIH_ZERO, instead of == 0
	* nih/tests/test_io.c: Use NIH_ZERO not NIH_MUST...== 0

	* nih/tests/test_io.c (test_watcher): Ensure that we don't ignore
	the return value from nih_io_printf; but also don't fail it.

	* HACKING: Clarify that returning to indicate insufficient memory
	warrants warn_unused_result.

	* nih/io.h: Add warn_unused_result attribute to nih_io_printf.
	* nih/string.c: Correct doc strings.

	* nih/string.c (nih_vsprintf): We need to copy the arguments before
	iterating either time, otherwise we could return NULL after moving
	the current argument off the end.

	* TODO: Update.

2007-01-22  Scott James Remnant  <scott@netsplit.com>

	* nih/io.c (nih_io_reopen): Raises an error (usually ENOMEM), since
	it can also raise EBADF.
	* nih/tests/test_io.c (test_reopen): Make sure ENOMEM is raised.
	* nih/watch.c: New watch API, this is a little higher level than
	what previously existing in nih/file.c; but is substantially easier
	to use and should cover all of the corner cases.
	(INOTIFY_EVENTS): inotify events we always watch for.
	(nih_watch_new): The master function; this creates a new inotify
	instance and adds a watch for a path in it.
	(nih_watch_handle_by_wd): Obtain a watch handle by descriptor
	(nih_watch_handle_by_path): Obtain a watch handle by path
	(nih_watch_add): Another useful function, adds a second path to
	an existing watch; normally used just for sub-directories, but
	possible for anything.
	(nih_watch_add_visitor): nih_dir_walk() callback that calls the above
	(nih_watch_free): Free a watch, and the associated NihIo; closing the
	inotify descriptor.
	(nih_watch_reader): Reader function; handles the incoming stream of
	inotify events by locating the watch handle and dispatching through
	(nih_watch_handle): this function which handles all the various
	event ordering corner-cases and dispatches to the watch functions
	proper.
	* nih/watch.h: Typedefs, structures and prototypes for the new watch
	API.
	* nih/tests/test_watch.c: Test suite for the watch code; covers most
	of the paths -- though malloc checking here is tricky and could do
	with improving later.
	* nih/libnih.h: Include nih/watch.h
	* nih/Makefile.am (libnih_la_SOURCES): Build and link watch.c
	(nihinclude_HEADERS): Install watch.h
	(TESTS): Build and run watch test suite
	(test_watch_SOURCES, test_watch_LDFLAGS, test_watch_LDADD): Details
	for watch test suite binary.

	* nih/file.c: Strip out anything related to inotify, leaving us
	with just three functions; nih_file_map(), nih_file_unmap() and
	nih_dir_walk().  Others that will turn up here will be matching
	and filtering functions.
	* nih/file.h: Strip out typedefs, structures and prototypes for
	anything watch-related; add attributes to functions as necessary.
	* nih/tests/test_file.c: Remove watch-related test cases, and
	use TEST_ALLOC_FAIL for test_dir_walk().

	* nih/tests/test_io.c (test_shutdown): Test NIH_IO_MESSAGE using
	AF_UNIX socketpairs, not pipes.

	* HACKING: Document the requirements for function attributes and
	using TEST_ALLOC_FAIL in test cases.
	* TODO: Update.

	* nih/tests/test_signal.c (test_set_handler): Check that SIGCHLD
	gets the SA_NOCLDSTOP flag, and that SIGKILL returns an error.
	(test_set_default, test_set_ignore): Check SIGKILL returns error.

	* nih/tests/test_option.c (test_parser): Check that duplicated
	options result in the previous string being freed.

	* nih/main.c (nih_main_daemonise): SIGHUP can always be ignored.

	* nih/tests/test_io.c (test_reopen): Make sure that we can't reopen
	a closed file descriptor.
	(test_set_nonblock, test_set_cloexec): Check with closed descriptors.

	* nih/config.c: When we call nih_config_skip_comment, we can usually
	assert that this will never fail; so do so.

	* nih/tests/test_command.c (test_help): Check a few missing pieces
	of the command help output to make sure it's right.

	* nih/file.c (nih_dir_walk): Correct doc string to indicate that
	this function raises errors.

	* nih/alloc.h: Fix prototype orders.
	* nih/child.h: Add attributes to important return values.
	* nih/config.c: Add attributes to important return values.
	* nih/config.h: Add attributes to important return values.
	* nih/error.h: Add attributes to important return values.
	* nih/io.h: Add attributes to important return values.
	* nih/main.h: Add attributes to important return values.
	* nih/signal.h: Add attributes to important return values.
	* nih/string.h: Add attributes to important return values.
	* nih/timer.h: Add attributes to important return values.
	* nih/io.c (nih_io_reopen): Don't ignore failure to ignore SIGPIPE.
	(nih_io_set_cloexec, nih_io_set_nonblock): The only useful errors
	returned is EBADF, so just return -1 for that.
	* nih/main.c (nih_main_daemonise): Don't ignore failure to ignore
	SIGHUP.
	* nih/signal.c (nih_signal_set_handler, nih_signal_set_default) 
	(nih_signal_set_ignore): The only useful error sigaction returns
	is EINVAL, so just return -1.
	(nih_signal_reset): Ignore EINVAL errors.
	* nih/tests/test_io.c: Use NIH_MUST around function calls that
	can fail.
	* nih/tests/test_main.c: Use NIH_MUST around function calls that
	can fail.

2007-01-21  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_ALLOC_FAIL): Macro that loops over a block of code
	as many times as malloc is called within it, causing each malloc in
	turn to be failed so we can increase code coverage.
	(nih_test_allocator): Support function for the above; allows dumping
	of malloc calls.
	* nih/tests/test_child.c (test_add_watch): Use TEST_ALLOC_FAIL
	and call nih_child_poll() first to not debug the init function
	(test_poll): Remove race conditions by making sure the signal
	has reached the child using waitid().  Test the "child we don't
	know about has died" branch, along with waitid returning 0 with no
	pid (needs a child process).
	* nih/tests/test_command.c (test_parser, test_help): Use
	TEST_ALLOC_FAIL
	* nih/tests/test_config.c (test_next_arg, test_parse_args) 
	(test_parse_command, test_parse_block): Use TEST_ALLOC_FAIL
	* nih/tests/test_error.c (test_raise, test_raise_printf) 
	(test_push_context, test_return_error): Use TEST_ALLOC_FAIL, to
	make sure allocations are retried.
	(test_pop_context): Split out from test_push_context.
	* nih/tests/test_hash.c (test_new): Use TEST_ALLOC_FAIL
	* nih/tests/test_io.c (test_add_watch, test_buffer_new) 
	(test_buffer_resize, test_buffer_pop, test_buffer_shrink) 
	(test_buffer_push, test_message_new, test_message_add_control) 
	(test_message_recv, test_message_send, test_reopen, test_watcher) 
	(test_read, test_write, test_get, test_printf): Use TEST_ALLOC_FAIL
	liberally, make sure every code path involving a malloc gets tested.
	* nih/tests/test_list.c (test_new): Use TEST_ALLOC_FAIL
	* nih/tests/test_logging.c (test_log_message): Use TEST_ALLOC_FAIL
	* nih/tests/test_main.c (test_main_loop_add_func): Use TEST_ALLOC_FAIL
	(test_package_string): Use TEST_ALLOC_FAIL and also check repeated
	calls return the same string.
	(test_version): Use TEST_ALLOC_FAIL to check that allocation can
	never fail.
	* nih/tests/test_option.c (test_parser, test_version, test_help):
	Use TEST_ALLOC_FAIL to make sure we behave
	* nih/tests/test_signal.c (test_add_handler): Use TEST_ALLOC_FAIL
	and call nih_signal_poll() first to not debug the init function
	* nih/tests/test_string.c (test_sprintf, test_vsprintf) 
	(test_strdup, test_strndup, test_str_split, test_str_wrap) 
	(test_str_screen_wrap): Use TEST_ALLOC_FAIL
	(test_str_screen_width): Check that we discard an illegal columns
	variable.
	* nih/tests/test_timer.c (test_add_timeout, test_add_periodic) 
	(test_add_scheduled): Use TEST_ALLOC_FAIL and call nih_timer_poll()
	first to make sure we don't debug the init function
	* nih/config.c (nih_config_next_arg, nih_config_parse_args) 
	(nih_config_parse_command, nih_config_parse_block): Allow us to fail
	reading a configuration file because we run out of memory; it's not
	that important.
	* nih/io.c (nih_io_get): Catch failure to remove the string, and
	don't remove the delimiter if that happens.
	(nih_io_printf): Fix doc, this returns zero, not a length.
	* nih/io.h: Fix prototype of nih_io_printf
	* nih/logging.c (nih_log_message): Potentially failing message output
	is crazy; loop until the alloc succeeds.
	* nih/option.c (nih_option_handle): Free the options and arguments
	before exiting; not really necessary, but makes valgrind happier.
	* nih/string.c (nih_strndup): Failed to correctly detect a failed
	allocation.
	(nih_str_split): Correct some mistakes with allocations not
	being checked.
	* nih/libnih.supp: Add tmpfile.
	* TODO: Update.

2007-01-11  Scott James Remnant  <scott@netsplit.com>

	* nih/file.h (NihDirWatch): New structure that defines a high-level
	watch on a directory with various handlers to be called.
	(NihCreateHandler, NihChangeHandler, NihDeleteHandler): Typedefs.
	* nih/file.c (nih_dir_add_watch): Function to create an NihDirWatch
	structure and fill it in.
	(nih_dir_add_file_watch): Add a watch on a single directory,
	catching errors and logging a warning if we can't watch it.
	(nih_dir_watcher): Deal with inotify events within a directory tree,
	taking care of issues such as re-organising of the directory structure
	without ending up with duplicate watches.
	(nih_file_reader): Only call the first matching watcher; we hit a
	limitation in the inotify API caused by our usage of a single
	descriptor.  Will fix that shortly.
	* nih/tests/test_file.c (test_dir_add_watch): Test that we can add
	watches and have everything filled in nicely.

2007-01-10  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c (nih_dir_walk): Function to walk a directory tree
	calling a function for each object found.
	* nih/file.h (NihFileFilter, NihFileVisitor): typedefs for
	function pointers used for nih_dir_walk.
	* nih/tests/test_file.c (test_walk): Test the walker.

	* nih/file.c (nih_file_reader): Pass the cookie to the watcher.
	* nih/file.h (NihFileWatcher): Add cookie argument.
	* nih/tests/test_file.c (test_add_watch): Check the cookie is
	passed for a rename.

	* nih/file.c (nih_file_add_watch): Fix this to not add the inotify
	watch unless it can allocate memory to handle it.

2007-01-09  Scott James Remnant  <scott@netsplit.com>

	* nih/config.c (nih_config_get_stanza): Catch entries with a zero
	length name, and return one instead of NULL if it exists.
	* nih/tests/test_config.c (test_parse_stanza): Make sure that ""
	in a stanza table acts as a catch-all.

	* nih/test.h (TEST_FILENAME): Use dashes not colons, to make things
	more clear.

2007-01-08  Scott James Remnant  <scott@netsplit.com>

	* nih/config.c (nih_config_has_token): add a very small test function
	so parsers can peek to see whether there is a next argument or not.
	(nih_config_skip_comment, nih_config_parse_args) 
	(nih_config_parse_file): Use the new test function to make it more
	obvious what we're doing.
	* nih/config.h: Add prototype.
	* nih/tests/test_config.c (test_has_token): Add test cases.

	* nih/config.c: Allow all functions to be called with a zero length
	file, we're completely guarded against pos going past the length,
	so this cannot be a bad thing.  Plus this allows zero-length tokens
	to be extracted trivially.
	(nih_config_next_arg): Raise an error if called in a position where
	there is no argument.  If you want to speculatively check for args,
	peek first.
	(nih_config_parse_stanza): No need to check for an empty stanza now,
	nih_config_next_arg() handles that for us.
	(nih_config_skip_comment): Function to allow us to skip only a
	comment, while raising an error if we hit anything else.
	(nih_config_parse_args, nih_config_parse_command): Skip comment only,
	to guard against parser errors.
	* nih/config.h: Update.
	* nih/tests/test_config.c (test_next_arg): Check the new error is
	raised, instead of the empty string being returned.
	(test_parse_stanza): Check the expected token error is raised.
	(test_skip_comment): Test the new function.
	* nih/errors.h: Add new errors.

	* nih/errors.h: Fix capitalisation of error messages.

	* nih/tests/test_config.c (test_parse_command): Add missing free
	calls to strings obtained.

2007-01-07  Scott James Remnant  <scott@netsplit.com>

	* nih/config.c: Convert this file to use size_t where appropriate
	instead of ssize_t, and raise exceptions for parsing errors rather
	than logging them.
	(nih_config_parse): Check a size is not greater then SSIZE_MAX (2GB)
	to avoid overflows.
	* nih/config.h: Update prototypes and handler function typedef.
	* nih/errors.h: Add new error codes and strings.
	* nih/tests/test_config.c: Adjust test cases.

	* nih/config.c (nih_config_parse_file): Function to parse a mapped
	file or string line-by-line starting from the given position.
	(nih_config_parse): Function to map a file into memory and parse it
	* nih/config.h: Add prototypes.
	* nih/tests/test_config.c (test_parse_file): Test the function with
	a small variety of different valid files.
	(test_parse): Check we can parse a file, and get an error if it
	doesn't exist.

	* nih/config.c (nih_config_parse_stanza): Take a data pointer and
	pass it to the handler, otherwise we can't fill in structures.
	* nih/config.h: Update.
	* nih/tests/test_config.c (test_parse_stanza): Check the data
	pointer is passed properly.

	* nih/tests/test_option.c (test_version, test_help): Capture the
	return value from nih_option_parser, as we've set gcc attributes to
	not let us do otherwise.

	* nih/config.h: Add structures, typedefs and macros to allow lists
	of configuration stanzas to be built up.
	* nih/config.c (nih_config_parse_args): Split argument parsing into
	(nih_config_next_arg): This new function that wraps next_token and
	also skips following whitespace.
	(nih_config_next_line): Another new function that skips to the end
	of the line, replacing severael copies of this code.
	(nih_config_get_stanza): Simple function to find a stanza in a table
	by its name.
	(nih_config_parse_stanza): Simple stanza dispatch function; parses an
	argument at the current position, looks it up in the table, then
	calls the function.
	* nih/tests/test_config.c (test_next_arg): Check this function works,
	we know it does because it was covered by other tests, but it's worth
	having its own as well.
	(test_next_line): Check this function works too.
	(test_parse_stanza): Make sure the dispatcher works properly.
	* nih/config.c: Write from the code that was used for upstart,
	making them exported functions to act as a configuration file kit.
	(nih_config_parse_args): Fix a bug where lineno wasn't incremented
	for an embedded newline in between arguments.  Fix another bug where
	a line containing only whitespace or whitespace and a comment would
	hit an assertion - not a problem in practice, but it's a bug.
	* nih/config.h: Function prototypes.
	* nih/libnih.h: Include config.h
	* nih/tests/test_config.c: Write an all new test suite that tests
	the individual parsing functions for their functionality, rather
	than trying to squeeze it into something larger.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link config.c
	(nihinclude_HEADERS): Install config.h
	(TESTS): Build and run config test suite
	(test_config_SOURCES, test_config_LDFLAGS, test_config_LDADD): Config
	test suite binary details.

2007-01-06  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_io.c (test_watcher): Missing a priority that needed
	changing to message.

	* nih/command.h: Warn against unused results.

	* nih/option.h: Warn against unused results.
	
	* nih/logging.h (NihLogLevel): Add a message level between info
	and warn, as we can't just re-use warn as that goes to stderr!
	(nih_message): Change to use the new message level.
	* nih/logging.c (nih_logger_syslog): Output messages at the notice
	level, rather than the warning level.
	(nih_log_init): Change the default priority to message.
	* nih/tests/test_logging.c (test_log_message): Check that messages
	are logged with the new message priority; reset to the new default.
	(test_logger_printf): Make sure that ordinary messages go to stdout
	and warning messages go to stderr.
	(test_set_logger, test_set_priority): Reset to the new default.
	* nih/tests/test_option.c (test_quiet, test_verbose, test_debug):
	Check that messages are also logged, as well as warning; and set
	the new default priority.
	* nih/tests/test_error.c (test_raise_again, test_push_context):
	Set log priority to the new default.
	* nih/tests/test_io.c (test_watcher): Reset priority to the new
	default.

2007-01-05  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_io.c (test_shutdown): Uncomment the test for
	shutdown when all messages are processed by the watcher.

	* nih/io.c (nih_io_message_recv): Remove note about the remote end
	being closed; when in message mode, this doesn't usually happen.
	(nih_io_watcher): Only check for a zero length return if we're in
	stream mode, otherwise it just means we got a zero length message.
	(nih_io_watcher_read): Accept zero length messages and return them.
	* nih/tests/test_io.c (test_watcher): Remove tests that tried to
	mix a message-mode io and a dgram socket, that way lies disaster.

	* nih/io.c (nih_io_watcher_read, nih_io_watcher_write): Initialise
	len to zero, as valgrind can be fussy about this when we call things
	directly.

	* nih/io.h (NihIoMessage): Add a user data field to the message
	structure so we can carry the pid around when queuing notification
	messages in upstart.

2007-01-02  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.h, nih/child.h, nih/command.h, nih/file.h, nih/hash.h:
	nih/io.h, nih/logging.h, nih/main.h, nih/option.h, nih/signal.h:
	nih/timer.h: Give names for all arguments in function pointer typedefs
	so the documentation strings make more sense.

	* nih/test.h (TEST_EQ_MEM, TEST_NE_MEM): Cast argument for number
	of bytes to size_t.

	* configure.ac (AC_COPYRIGHT): Update copyright to 2007.

2006-12-29  Scott James Remnant  <scott@netsplit.com>

	* nih/errors.h: Drop the NIH_IO_MESSAGE_TRUNCATED error.

	* nih/io.h (NihIoMessage): Rename msg_buf member to data, and change
	ctrl_buf member to be an array of cmsg structures called control.
	* nih/io.c: Update references to NihIoMessage members.
	(nih_io_message_push_control): Rename to nih_io_message_add_control
	(nih_io_message_add_control): Rewrite to add the control message
	header onto the end of an array, rather than a control buffer,
	(nih_io_message_recv): After receiving the message, extract all
	control messages and put them into the array.
	(nih_io_message_send): Take control messages from the array into a
	single buffer and send them.

	* nih/tests/test_io.c: Update references to NihIoMessage members.
	(test_message_new): Check that the control member is initialised to
	a one-element array containing NULL.
	(test_message_push_control): Rename to test_message_add_control.
	(test_message_add_control): Check the array is extended.

	* nih/io.c (nih_io_message_recv): Loop over a call to recvmsg() with
	MSG_PEEK in its arguments to avoid ever returning truncated messages.
	* nih/tests/test_io.c (test_message_recv): Adjust test for truncated
	messages to make sure they do in fact work.
	(test_watcher): Remove the oversized message error check.

2006-12-21  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_option.c (test_verbose): Add missing call to free
	args.

	* nih/io.c (nih_io_message_send): Change to return the ssize_t
	received from sendmsg(), rather than an int.
	(nih_io_watcher_read): Move read functionality out of
	nih_io_watcher into a separate function that can deal with both
	stream and message mode.
	(nih_io_watcher_write): Move write functionality out of nih_io_watcher
	into a separate function that can deal with both stream and message
	mode.
	(nih_io_watcher): Call the separate functions, and handle calling
	the reader when in message mode.  In addition, we now check the
	error code when writing to a socket as well; there are useful errors
	there (like ECONNREFUSED).
	* nih/io.h: Update prototype of nih_io_message_send.
	* nih/tests/test_io.c (test_message_send): Update return checks.
	(test_watcher): Test that the error handled can now be called when
	writing data to a socket, as well as just when reading.  Test
	message mode behaviour.

	* nih/io.c (nih_io_send_message): Watch socket for writability.
	(nih_io_write): Extend this function to work in message mode;
	it allocates a new message, stores the data in that buffer, and
	adds it to the send queue.
	(nih_io_printf): Remove restriction that this only be called in
	stream mode; the fact this calls nih_io_write is sufficient to
	ensure correct behaviour.
	* nih/tests/test_io.c (test_send_message): Check that we're testing
	for writability.
	(test_write): Test that this works in message mode.
	(test_printf): Check that this works too, even though this only
	really calls nih_io_write.

	* nih/io.c (nih_io_get): Extend so that this can operate in message
	mode on the oldest message in the queue.
	* nih/tests/test_io.c (test_get): Check that this works properly
	in message mode; complete with shutdown check.

	* nih/io.c (nih_io_message_new): Do not assign a default list
	destructor, it's not in a hidden list and there are bad consequences
	of freeing a child with a default destructor if the list its in gets
	freed first; new rule - default destructors only if the list is hidden
	and never freed!
	(nih_io_closed, nih_io_shutdown): Don't call the close handler if
	the structure is already marked to be closed; there seems little
	point, and we could accidentally call it multiple times.
	(nih_io_read_message, nih_io_read, nih_io_get): Check whether we
	need to shutdown the socket here, in case the watcher isn't polled
	again.
	* nih/tests/test_io.c (test_shutdown): Check that shutdown works
 	with message-mode structures (part of this disabled for now).
	(test_read_message, test_read, test_get): Check that a shutdown
	socket is closed when these are called.

2006-12-20  Scott James Remnant  <scott@netsplit.com>

	* nih/io.c (nih_io_read): Extend so that it can be called in
	message mode, it reads from the first message until it has been
	exhausted; at which point it frees the message and the next call
	would read from the next.
	* nih/tests/test_io.c (test_read): Check that the new functionality
	works properly.

	* nih/io.c (nih_io_first_message): Simple static function to obtain
	the oldest message in the receive queue.
	(nih_io_read_message, nih_io_send_message): Functions to take the
	oldest message out of the receive queue and append a message to the
	send queue.
	* nih/io.h: Add prototypes.
	* nih/tests/test_io.c (test_read_message, test_send_message): Check
	the new functions do what they say on the tin.

	General clean-up of nih_io, fixing a few API issues and making it
	more suitable for using in message mode.

	* nih/io.c (nih_io_buffer_pop, nih_io_buffer_shrink): Remove the
	silly restrictions that these cannot be called with a length greater
	than the buffer size, instead just truncate it to the buffer size.
	(nih_io_buffer_pop): Length is now updated to the actual number of
	bytes being returned.
	(nih_io_message_add_control): Rename to nih_io_message_push_control.
	(nih_io_message_recv): Change the len parameter to a pointer that's
	updated with the actual number of bytes read.
	(nih_io_stream_watcher): Rename back to nih_io_watcher.
	(nih_io_reopen): Use a single watcher function again, initialise close
	to NULL.  Treat failure to set a descriptor non-blocking as a failure
	to open; otherwise we'll end up screwing up the main loop.
	(nih_io_watcher): Remove the restriction that this is only called
	when in the stream mode.  Leave data in the receive buffer if there's
	no reader function, it's now valid to query the buffer size and read
	by other means.  Catch the ENOMEM error and ignore it.  Set and keep
	an eye on the structure close member, if it is TRUE before we return,
	close the socket.  This also means we check for shutdown sockets in
	the case of error, which we probably should have done.
	(nih_io_maybe_shutdown): Rename to nih_io_shutdown_check.
	(nih_io_close): If the close member of the structure is not NULL
	we're inside a watcher function, so need to set the variable this
	points to to TRUE instead of closing or freeing the structure.
	(nih_io_read): Change the len parameter to be updated with the
	actual number of bytes being returned.
	* nih/io.h: Renamed function prototype.  Updated documentation for
	function typedefs to clarify that they may all call nih_io_close,
	but may not call nih_free.
	* nih/errors.h: Rename NIH_TRUNCATED_MESSAGE to
	NIH_IO_MESSAGE_TRUNCATED, we should probably namespace these.
	* nih/tests/test_io.c (test_buffer_pop, test_buffer_shrink): Check
	that we can pop or shrink the entire buffer if we ask for more.
	(test_message_add_control): Rename to test_push_control.
	(test_message_recv): Check that the cases of remote end closed,
	error received or truncated message are handled properly.
	(test_message_send): Check that an error is handled.
	(test_stream_watcher): Rename back to test_watcher.
	(test_reopen): Check that the socket is not being shutdown or closed.
	(test_shutdown): Drain the buffer before calling handle on it, as
	it's not done automatically now.
	(test_close): Check that a lazy close is performed if io->close is
	not NULL.
	* nih/file.c (nih_file_reader): Update call to nih_io_read.

	* nih/logging.h (nih_assert_notreached): Rename to
	nih_assert_not_reached, this was annoying me.

2006-12-19  Scott James Remnant  <scott@netsplit.com>

	* nih/io.c (nih_io_read, nih_io_write, nih_io_get, nih_io_printf):
	Ensure the NihIo structure is in stream mode; as these only really
	make sense if there's a limitless buffer.

	* nih/tests/test_io.c (test_shutdown): Make sure the socket is
	shut down immediately.
	* nih/io.c (nih_io_shutdown): Bugfix, should close the socket
	immediately if there's nothing in the queue, otherwise it may
	hang around forever if it never polls.

	* nih/io.c (nih_io_reopen): Receive the type from the arguments,
	instead of hard-coding to be stream.  Set up the structure accordingly.
	* nih/io.h: Update prototype.
	* nih/tests/test_io.c (test_reopen): Check message mode is allocated
	properly.
	* nih/file.c (nih_file_init): Open in stream mode.

	* nih/io.c (nih_io_message_new): Catch failure to allocate message
	or control buffer.
	(nih_io_message_add_control): No need to try and allocate the control
	buffer here.
	(nih_io_message_recv): Only need to resize the buffers here as well.
	(nih_io_message_send): No need to deal with there being no message
	or control buffer here either.
	* nih/tests/test_io.c: Fix test assumptions based on above.
	* nih/libnih.supp: Add missing nih_io_init suppression.

	* nih/tests/test_io.c (test_message_add_control): Non need to check
	allocation of the buffer itself.

	* nih/io.c (nih_io_message_add_control): Function to add a control
	message to the control buffer, to save mucking around with difficult
	bits ourselves.
	* nih/io.h: Add prototype.
	* nih/tests/test_io.c (test_message_add_control): Check that it
	works properly.

	* nih/io.c (nih_io_buffer_shrink): Make an exported function, resize
	the buffer once done to save on memory.
	(nih_io_buffer_pop, nih_io_stream_watcher): No need to explicitly
	resize here now, as it gets called from shrink.
	* nih/io.h: Add prototype.
	* nih/tests/test_io.c (test_buffer_shrink): Test shrink.

	* nih/io.c (nih_io_message_recv, nih_io_message_send): Functions
	to send and receive a message over a socket, hiding the difficult
	bits of dealing with msghdr/iovec.
	(nih_io_get_family): Function to detect the family of a socket.
	* nih/io.h: Update.
	* nih/errors.h: Add truncated message error.
	* nih/tests/test_io.c (test_message_recv, test_message_send): Check
	that we can send and receive messages by using socket pairs.
	(test_get_family): Check that we can get the families of the standard
	three socket types.

2006-12-18  Scott James Remnant  <scott@netsplit.com>

	* nih/io.h (NihIoMessage): Structure that represents an individual
	message in a queue; has a buffer for the message, and for ancillary
	control data, as well as an address that the message is being sent
	to or received from.
	(NihIoType): Enum to select whether an NihIo structure is in stream
	mode or message mode.
	(NihIo): Add a type member to select whether this is in stream or
	message mode, and a union to select whether we're using buffers
	or message queues.
	* nih/io.c (nih_io_message_new): Allocate an NihIoMessage and its
	child buffers.
	(nih_io_reopen): Initialise the type to NIH_IO_STREAM.
	(nih_io_watcher): Rename to nih_io_stream_watcher.
	* nih/tests/test_io.c (test_message_new): Check that the new message
	structure is initialised properly.
	(test_reopen): Check that we get a stream structure by default.
	(test_watcher): Rename to test_stream_watcher.

2006-12-17  Scott James Remnant  <scott@netsplit.com>

	* nih/logging.h (nih_assert_notreached): Add an assertion for the
	use in default bits of switches, etc.

	* nih/test.h (TEST_EQ_U, TEST_NE_U): Versions of the original macros
	that cast to size_t for display, instead of ssize_t.

	* nih/tests/test_logging.c, nih/tests/test_string.c: Set local
	variables to avoid gcc thinking that they may be unused when
	using TEST_DIVERT_*.

2006-12-14  Scott James Remnant  <scott@netsplit.com>

	* HACKING: Correct some typos.

2006-12-13  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_FILENAME): Wrap with do { ... } while (0)
	in case this gets used as a single line statement.

2006-12-13  Johan Kiviniemi  <johan@kiviniemi.name>

	* nih/test.h (TEST_FILE_RESET): Wrap with do { ... } while (0)
	in case this gets used as a single line statement.

2006-12-13  Scott James Remnant  <scott@netsplit.com>

	* nihify: Link to the nih ChangeLog.

2006-12-12  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_CHILD_WAIT, TEST_CHILD_RELEASE): Sometimes the
	primitive "when the child is running" locking provided by TEST_CHILD
	isn't sufficient, and we actually need to perform some actions in
	the child before we let the parent carry on.  These two macros
	allow that.

	* nih/libnih.supp: Include a valgrind suppressions file.
	* nih/Makefile.am (EXTRA_DIST): Distribute the suppressions file.

	* nih/tests/test_alloc.c (test_realloc): Fix missing free.

	* configure.ac (AM_GNU_GETTEXT_VERSION): Quote version number.

2006-12-09  Scott James Remnant  <scott@netsplit.com>

	* nih/test.h (TEST_DIVERT_STDOUT_FD, TEST_DIVERT_STDERR_FD): Flush
	before dup2ing the original file descriptor back, otherwise we end
	up with the content still in the buffer later.

2006-12-08  Scott James Remnant  <scott@netsplit.com>

	* HACKING: Document that test cases are expected.

	* nih/tests/test_command.c: Port to the new test framework.

	* nih/tests/test_option.c: Drop unused include.

	* nih/tests/test_option.c: Port to the new test framework.

2006-12-07  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_io.c: Port to the new test framework.

	* nih/tests/test_hash.c: Drop use of assert.

	* nih/tests/test_timer.c (test_poll): Formatting fix.

	* nih/tests/test_string.c: Port to the new test framework.

	* nih/test.h (TEST_DIVERT_STDOUT_FD, TEST_DIVERT_STDERR_FD): Macros
	to divert to a file descriptor instead of a file.
	(TEST_DIVERT_STDOUT, TEST_DIVERT_STDERR): Redefine as wrappers around
	the new macros.

	* nih/tests/test_timer.c: Port to the new test framework.

	* nih/tests/test_signal.c: Port to the new test framework.

	* nih/tests/test_main.c: Port to the new test framework.

	* nih/test.h: Cast strlen return value to int when used to give
	the length of a string in printf.

	* nih/tests/test_logging.c: Port to the new test framework.

	* nih/test.h (TEST_DIVERT_STDOUT, TEST_DIVERT_STDERR): Crazy macros
	to divert stdout or stderr to a different file, making sure it's
	flushed before both dups.
	(TEST_EQ_STRN, TEST_NE_STRN): Functions to check a string up to a
	particular point.
	(TEST_FILE_EQ, TEST_FILE_EQ_N, TEST_FILE_NE, TEST_FILE_NE_N):
	Functions to grab a line from a file and check it against a string.
	(TEST_FILE_END): Function to determine end of file.
	(TEST_FILE_RESET): Another function so I don't need to remember the
	runes to flush, rewind and truncate a file.

2006-12-06  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_file.c: Port to the new test framework.

	* nih/test.h (TEST_EQ_MEM, TEST_NE_MEM): Tests that wrap memcmp.
	(TEST_FILENAME): Macro to generate a filename.

	* nih/tests/test_error.c: Port to the new test framework.

	* nih/tests/test_alloc.c, nih/tests/test_list.c, nih/tests/test_hash.c:
	Undo over-zealous removing of includes.

	* nih/tests/test_child.c: Port to the new test framework.

	* nih/test.h (TEST_CHILD): Macro to spawn an interlocked child
	process, so we don't keep having to remember how to.

	* nih/test.h (TEST_ALLOC_SIZE, TEST_ALLOC_PARENT): Include the
	expression that generated the pointer, as well as the pointer.
	(TEST_LIST_EMPTY, TEST_LIST_NOT_EMPTY): Check whether a list is
	empty or not.
	* nih/tests/test_list.c (test_empty, test_foreach_safe): Use the
	new list test macros instead of TEST_TRUE/TEST_FALSE.
	* nih/tests/test_hash.c (test_new): Likewise.

2006-12-05  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_hash.c: Port to the new test framework.

	* nih/tests/test_list.c: Port to the new test framework.

	* nih/tests/test_alloc.c: Port to the new test framework.
	(test_set_allocator): Test that the allocator is called with zero
	as the argument.

	* nih/test.h: Include config.h on behalf of the test suites.

	* nih/test.h (TEST_EQ_STR, TEST_NE_STR): String comparison tests.

	* nih/test.h (TEST_FAILED): abort is much better than exit

	* nih/test.h (INIT_TEST): Drop this, we'll just return directly.
	(TEST_FAILED): Return directly on failure.
	(CALL_TEST): Drop this again.

	* nih/test.h (CALL_TEST): Add "call a function" macro.

	* nih/test.h: Macros that implement a simple test framework based
	on the patterns I was using anyway.
	* nih/Makefile.am (nihinclude_HEADERS): Install nih/test.h

	* nih/tests/test_command.c (test_parser, test_help): flush stdout
	or stderr before calling dup2().

	* nih/tests/test_option.c (test_parser, test_version, test_help):
	flush stdout or stderr before calling dup2().

	* nih/tests/test_io.c: Formatting fix.

	* nih/file.c (nih_file_map): Tidy up; in particular don't allow
	opening in just write mode, seeing as that doesn't work.
	* nih/tests/test_file.c (test_unmap): Test unmap separately.
	(test_map): Update for new checks.

	* nih/file.c (nih_file_add_watch): No need to set ENOMEM if
	nih_new fails, that will be already set.
	(nih_file_reader): Clarify why nih_io_read must return a pointer.

	* nih/tests/test_string.c (test_str_screen_width) 
	(test_str_screen_wrap): flush stdout before calling dup2().

	* nih/tests/test_main.c (test_suggest_help, test_version): flush
	stdout or stderr before calling dup2().

	* nih/tests/test_logging.c (test_logger_printf): flush stdout or
	stderr before calling dup2(), otherwise we don't know which stream
	the buffered output will be going to.

	* nih/tests/test_error.c (test_push_context): Check that unhandled
	errors within a context are notified and freed if the context is
	popped.

	* nih/alloc.c (nih_alloc_reparent): Function to reparent a pointer
	to a new parent or just orphan it.
	* nih/alloc.h: Update.
	* nih/tests/test_alloc.c (test_reparent): Make sure it works.

	* nih/tests/test_alloc.c (test_alloc_using): Check that this works
	properly if the allocator returns NULL.
	(test_realloc): A few cases to check here; make sure that it works
	if the pointer to realloc is NULL, actually test the children
	reparenting code here and test the reallocator returning NULL.

	* README: Correct typo.

2006-11-12  Scott James Remnant  <scott@netsplit.com>

	* nih/Makefile.am (INCLUDES, DEFS): Drop these two variables
	(AM_CPPFLAGS): in favour of this combined variable.

	* configure.ac (AM_INIT_AUTOMAKE): Include nostdinc so we don't get
	Automake's broken default includes.
	* nih/Makefile.am (INCLUDES): Include $top_builddir and $top_srcdir,
	everything else wants relative paths from there.
	(DEFAULT_INCLUDES): Drop override now we don't need it.

	* m4/compiler.m4 (NIH_C_THREAD): Define a macro in the manner of
	AC_C_CONST that will #define __thread to empty if it isn't supported
	by the compiler.
	* m4/misc.m4 (NIH_INIT): libnih uses __thread.

2006-10-13  Scott James Remnant  <scott@netsplit.com>

	* nih/command.h: Adjust type of NihCommandAction to include const.
	* nih/tests/test_command.c (my_action): Update.

2006-10-12  Scott James Remnant  <scott@netsplit.com>

	* configure.ac: Expand AC_GNU_SOURCE so we get _GNU_SOURCE and so
	that gettext doesn't complain.
	(AM_GNU_GETTEXT_VERSION): Increase to 0.15
	(AC_PREREQ): Increase to 2.60
	* HACKING: Update autoconf and gettext requirements.

2006-10-11  Scott James Remnant  <scott@netsplit.com>

	* nih/string.c (nih_str_screen_wrap): Don't quite fill the screen,
	instead leave a character spare as it looks somehow neater that way.
	* nih/option.c (nih_option_group_help): Likewise.
	* nih/tests/test_string.c (test_str_screen_wrap): Update tests.
	* nih/tests/test_option.c (test_help): Fix wrapping test.

	* TODO: Update.

	* nih/command.c: Implement a command parser that uses the first
	non-option argument (or program name) and selects different help
	and options based on that.
	* nih/command.h: Structures and prototypes.
	* nih/libnih.h: Include command.h
	* nih/tests/test_command.c: Test suite for command parser.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link command.c
	(nihinclude_HEADERS): Install command.h
	(TESTS): Build and run command test cases
	(test_command_SOURCES, test_command_LDFLAGS, test_command_LDADD):
	Details for command test suite binary.

	* nih/tests/test_option.c: Keep a copy of last_option otherwise
	it's freed while we're not around.

	* nih/option.c (nih_option_set_footer): Add a footer string.
	(nih_option_help): Also add the footer string.
	* nih/option.h: Update.
	* nih/tests/test_option.c (test_help): Check the footer.

	* nih/option.c (nih_option_set_usage_stem): Add function to set
	the "[OPTION]..." bit of the usage line.
	(nih_option_help): Use the usage stem if set.
	* nih/option.h: Update.
	* nih/tests/test_option.c (test_help): Check the usage stem.

	* nih/option.c (nih_option_join): Add function to combine two lists
	of options.
	(nih_option_parser): Join the options and default_options lists,
	don't play with arrays of lists.
	(nih_option_get_short, nih_option_get_long): Simply by just iterating
	the one array.
	(nih_option_help, nih_option_group_help): Again simply by just
	iterating the one array.
	* nih/option.h: Update.
	* nih/tests/test_option.c (test_parser): Don't check addresses of
	options as they've moved.

	* nih/option.c (nih_option_set_usage, nih_option_set_synopsis) 
	(nih_option_set_help): Allow NULL to be set to override existing
	strings.

	* nih/option.c (nih_option_help): Make static.
	* nih/option.h: Update.

2006-10-10  Scott James Remnant  <scott@netsplit.com>

	* TODO: Update.

	* nih/option.c (nih_option_group_help): Use a factor of the screen
	width when formatting help options, but keep at least 20 chars
	visible at all times.

	* nih/string.c (nih_str_screen_width): Add function to return just
	the screen width.
	(nih_str_screen_wrap): Use that function.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_str_screen_width): Check function.

	* nih/option.c (nih_option_set_synopsis): Function to set a synopsis
	string that follows the usage.
	(nih_option_set_help): Function to set the help string that follows
	the options.
	(nih_option_help): Output synopsis and help strings.
	* nih/option.h: Update.
	* nih/tests/test_option.c (test_help): Check behaviour

	* TODO: Update.

	* nih/main.c (nih_main_version): Use nih_str_screen_wrap to output
	the GPL preamble bit.
	* nih/tests/test_main.c (test_version): Unset COLUMNS just in case.

	* nih/string.c (nih_str_screen_wrap): Add wrapper around
	nih_str_wrap that obtains the screen width and uses that for len.
	* nih/string.h: Add prototype.
	* nih/tests/test_string.c (test_str_screen_wrap): Test new function.
	* nih/Makefile.am (test_string_LDADD): Link with -lutil so we can
	use openpty in our "fake terminal" tests.

	* nih/tests/test_option.c: Fix minor test case memory leak.

	* nih/tests/test_child.c (test_poll, test_poll): Use better
	interlocks then usleep.

	* nih/tests/test_option.c (main): Enable test of --debug, oops.

	* nih/main.c (nih_main_daemonise): Document why this is better than
	daemon(), and thus not nih.
	* nih/tests/test_main.c (test_daemonise): Test the daemonise
	function works properly.

	* nih/timer.h: Fix comments.

	* nih/hash.c (nih_hash_new): This needs a parent pointer too.
	* nih/hash.h: Update prototype.
	* nih/tests/test_hash.c: Update test cases.

	* nih/child.c: Clarify child_watches item types.
	* nih/file.c: Clarify file_watches item types.
	* nih/io.c: Clarify io_watches item types.
	* nih/main.c: Clarify loop_functions item types.
	* nih/timer.c: Clarify timers item types.

	* nih/signal.h (NihSignalCb): Rename to NihSignalHandler.
	(NihSignal): Change callback name to handler and type
	to NihSignalHandler.
	* nih/signal.c (nih_signal_add_callback): Rename to
	nih_signal_add_handler.
	* nih/tests/test_signal.c: Update.

	* nih/list.c (nih_list_new): Take a parent pointer like everything
	else, showing its age slightly.
	* nih/list.h: Update prototype.
	* nih/tests/test_list.c: Update test cases.
	* nih/child.c (nih_child_init): Pass NULL to nih_list_new().
	* nih/error.c (nih_error_init): Pass NULL to nih_list_new().
	* nih/file.c (nih_file_init): Pass NULL to nih_list_new().
	* nih/io.c (nih_io_init): Pass NULL to nih_list_new().
	* nih/main.c (nih_main_loop_init): Pass NULL to nih_list_new().
	* nih/signal.c (nih_signal_init): Pass NULL to nih_list_new().
	* nih/timer.c (nih_timer_init): Pass NULL to nih_list_new().
	* nih/tests/test_hash.c: Pass NULL to nih_list_new().

	* nih/alloc.c, nih/alloc.h, nih/child.c, nih/child.h, nih/error.c,
	nih/error.h, nih/file.c, nih/file.h, nih/hash.c, nih/hash.h,
	nih/io.c, nih/io.h, nih/list.c, nih/list.h, nih/main.c, nih/main.h,
	nih/option.c, nih/option.h, nih/signal.c, nih/signal.h, nih/string.c,
	nih/string.h, nih/timer.c, nih/timer.h: Clean up documentation and
	parent return values.

	* HACKING: Detail function documentation requirement and format.

	* nih/tests/test_signal.c (test_set_default, test_set_ignore) 
	(test_reset): amd64 seems to set the SA_NODEFER flag even when
	you pass zero, so just check we clear important bits.

2006-09-27  Scott James Remnant  <scott@netsplit.com>

	* m4/misc.m4 (NIH_INIT): Add easier macro for using libnih.
	* m4/compiler.m4: Remove hack to include misc.m4
	* configure.ac: Drop the macro set and replace with NIH_INIT
	* README: Update.
	* nihify: Warn if NIH_INIT not present.

2006-09-25  Scott James Remnant  <scott@netsplit.com>

	* TODO (main): Update.

	* nih/logging.h (nih_message): Add nih_message as an alias for
	nih_warn.
	* nih/tests/test_logging.c (test_log_message): Check new macro.

2006-09-20  Michael Biebl  <mbiebl@gmail.com>

	* nih/tests/test_file.c: Include nih/inotify.h when sys/inotify.h
	is not available.

2006-09-19  Michael Biebl  <mbiebl@gmail.com>

	* nih/Makefile.am (nihinclude_HEADERS): Install inotify.h just in
	case it's required

2006-09-18  Michael Biebl  <mbiebl@gmail.com>

	* configure.ac: Check for sys/inotify.h
	* nih/inotify.h: Taken from udev, this defines the syscalls
	and flags, etc. for inotify on glibc 2.3
	* nih/file.c, nih/file.h: Include nih/inotify.h if we do not have
	sys/inotify.h

2006-09-13  Scott James Remnant  <scott@netsplit.com>

	* nih/child.c (nih_child_poll): Zero the siginfo_t struct before
	every call to waitid(), the kernel doesn't do it for us when
	running the compat syscall (but does for the native one *sigh).

2006-09-08  Scott James Remnant  <scott@netsplit.com>

	* TODO: Update.

	* nih/option.c (nih_option_help): Allow the usage string to be
	customised.
	(nih_option_set_usage): Using this function.
	* nih/option.h: Update.
	* nih/tests/test_option.c (test_help): Test the usage string.

	* nih/main.c (nih_main_daemonise): Use program_name for the pid file.
	* nih/main.h: Update.

	* nih/main.c (nih_main_daemonise): Add a daemonise function,
	pretty standard really.
	* nih/main.h: Update.

2006-09-07  Scott James Remnant  <scott@netsplit.com>

	* AUTHORS: Mention the ChangeLog file.

2006-09-04  Scott James Remnant  <scott@netsplit.com>

	* README: Add some documentation for the curious.

	* nih/file.c (nih_file_add_watch): Set nih_file_remove_watch as
	the default destructor so that nih_free can be called or work in
	a tree.
	(nih_file_remove_watch): Modify to not call nih_free and work if
	called multiple times.

	* nih/signal.c (nih_signal_set_default, nih_signal_set_ignore):
	Set flags to zero when defaulting or ignoring signals.
	* nih/tests/test_signal.c (test_set_default, test_set_ignore)
	(test_reset): Modify test cases appropriately.

	* nih/hash.h: Add missing attribute for nih_hash_new
	* nih/list.h: Add missing attribute for nih_list_new

2006-09-01  Scott James Remnant  <scott@netsplit.com>

	* nih/option.c (nih_option_group_help): Cast linelen to not induce
	a warning.

2006-08-31  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_loop_interrupt): Always initialise the
	interrupt pipe.
	(nih_main_loop_init): Move interrupt pipe initialisation to here
	so that it's always available.
	(nih_main_loop): Drop the extra call to nih_signal_poll().

	* nih/option.c (nih_option_get_short, nih_option_get_long): Allow
	catch-all options.
	* nih/tests/test_option.c (test_parser): Test catch-all options.

	* TODO: Update.

	* nih/option.c (nih_option_handle_arg): Free any existing option
	value.

2006-08-30  Scott James Remnant  <scott@netsplit.com>

	* nih/option.c (nih_option_debug): Add a hidden --debug option that
	sets the logging level up really high.
	(nih_option_handle): Just compare the names rather than offset
	within a list that can change.
	* nih/option.h: Update.
	* nih/tests/test_option.c (test_debug): Check that it works.

	* nih/option.c (nih_option_group_help): Output "Options" where we
	only have the one group.

	* nih/option.c (nih_option_group_help): Don't output options without
	help strings.
	* nih/tests/test_option.c (test_help): Update.

2006-08-25  Scott James Remnant  <scott@netsplit.com>

	* nih/io.c (nih_io_watcher): Clean up the handling of the out of
	memory condition while extending the buffer so that we just return
	to be called again rather than end up performing some random action.

2006-08-24  Scott James Remnant  <scott@netsplit.com>

	* nihify (src_dir): Also copy m4/Makefile.am

	* nih/file.c (nih_file_remove_watch): Raise the error before
	performing other actions so errno is not lost.

	* nih/io.c (nih_io_watcher): Fix a pretty critical bug, we weren't
	saving the value of errno so it was usually zero by the time we
	looked at it.

	* nih/logging.c (nih_logger_syslog): Useful alternative to
	nih_logger_printf.
	* nih/logging.h: Update.

2006-08-23  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_string.c: Add missing free calls.

	* nih/tests/test_io.c (test_watcher): Silence the error message.
	* nih/tests/test_option.c (test_parser): Add some forgotten calls
	to nih_free

	* nih/main.c (nih_main_init_full): Free the package string when
	overwriting it.

	* nih/tests/test_logging.c: Keep a copy of the last message
	otherwise we're reading free'd memory (again).

	* nih/tests/test_list.c: Memory cleanups.

	* nih/signal.c (nih_signal_set_default, nih_signal_set_ignore):
	Don't initialise the signals list, there's no need.

	* nih/tests/test_hash.c: Various missing calls to nih_free.

	* nih/file.c (nih_file_remove_watch): Fix another wrong call to
	nih_free.

	* nih/tests/test_child.c (test_poll): Free the watcher.

	* nih/file.c (nih_file_remove_watch): Remove from the containing
	list before freeing.
	* nih/tests/test_file.c (my_watcher): Make sure we copy the name
	as it will be freed by the time we get back to the test.

	* nih/list.c (nih_list_free): Don't throw away the destructor
	return value.

	* nih/tests/test_error.c: Further missing calls to nih_free

	* nih/tests/test_alloc.c: Correct a few missing nih_free's

	* nih/file.c (nih_file_map): Correct a thinko, have to mask
	flags by O_ACCMODE and compare for equality to extract the open
	access mode.

2006-08-22  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c (nih_file_map, nih_file_unmap): Add an easier to use
	wrapper around mmap() when we just want the file in memory.
	* nih/file.h: Add prototypes.
	* nih/tests/test_file.c (test_map): Test the functions.

2006-08-21  Scott James Remnant  <scott@netsplit.com>

	* nih/file.c: Wrap the inotify syscalls with something a little
	friendlier to deal with.
	* nih/file.h: Typedefs, structures and prototypes.
	* nih/libnih.h: Include file.h
	* nih/io.h: Correct typo in argument name.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link file.c
	(nihinclude_HEADERS): Install file.h
	(TESTS): Build and run file test cases
	(test_file_SOURCES, test_file_LDFLAGS, test_file_LDADD): Details
	for file test case binary

2006-08-19  Scott James Remnant  <scott@netsplit.com>

	* nih/option.c (nih_option_parser): Finish option processing when
	the first non-option argument is found (command-mode)
	* nih/option.h: Update.
	* nih/tests/test_option.c (test_parser): Test command-mode.

	* nih/option.c: Implement a simple, yet flexible option parser.
	* nih/option.h: Typedefs, structures and prototypes.
	* nih/libnih.h: Include option.h
	* nih/tests/test_option.c: Test it all pretty thoroughly.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link option.c
	(nihinclude_HEADERS): Install option.h
	(TESTS): Run the option test cases
	(test_option_SOURCES, test_option_LDFLAGS, test_option_LDADD):
	Details for the option test case binary.
	* TODO: Update.

	* nih/string.c (nih_str_wrap): Implement a function to wrap a
	string into the desired number of characters wide.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_str_wrap): Test the new function
	to make sure it does the right things.

2006-08-18  Scott James Remnant  <scott@netsplit.com>

	* TODO: Update.

	* nih/main.h (nih_main_init_gettext): Macro that expands to the
	usual gettext initialisation spiel if ENABLE_NLS is set, or nothing
	if not.
	(nih_main_init): Expand nih_main_init_gettext as well, we almost
	always want to do that, after all.
	* nih/macros.h: Include locale.h if ENABLE_NLS is set, as that
	contains setlocale, amongst other things.
	* nih/tests/test_main.c (test_init_gettext): Check the macro does
	the right things.

	* nih/io.h (NihIoCb): Rename to NihIoWatcher.
	(NihIoReadCb): Rename to NihIoReader.
	(NihIoCloseCb): Rename to NihIoCloseHandler.
	(NihIoErrorCb): Rename to NihIoErrorHandler.
	(NihIoWatch): Rename callback member to watcher.
	(NihIo): Rename read_cb member to reader, close_cb member to
	close_handler and error_cb member to error_handler.
	* nih/io.c: Update to use new names.
	(nih_io_cb): Rename to nih_io_watcher.
	* nih/tests/test_io.c: Update to use new names.

	* TODO: Update.

2006-08-16  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_loop_add_func): Add a loop function
	(nih_main_loop): Run the loop functions.
	* nih/main.h (NihMainLoopCb, NihMainLoopFunc): Typedefs and
	structures for main loop callbacks.
	* nih/tests/test_main.c (test_main_loop_add_func): Check that
	the loop function is allocated correctly.
	(test_main_loop): Make sure it actually gets called.

	* nih/io.c (nih_io_cb): Add a couple of check assertions.

	* nih/macros.h (N_): Should be defined to be a no-op.

2006-08-14  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_realloc): Yet another fix to realloc, we
	forgot to reinitialise our entry in the parent's children list in
	the case of no parent.  After fixing this and tracing the code, I
	realised that the previous fix was inelegant and there is a way to
	deal with children without modifying the pointers until after the
	reallocation.  Documented the reasoning in the function.

	* nih/io.c (nih_io_reopen): Report on the error rather than just
	suppressing it.
	(nih_io_error): Likewise, report on the error.

2006-08-12  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_loop_close): Drop this function
	(nih_main_loop): Instead mark them close on exec.
	* nih/main.h: Update.

	* nih/main.c (nih_main_loop): Change the main loop to use select
	instead of poll, as its semantics are a lot easier to deal with.
	We also use allow select to be interrupted by writing to a pipe
	from the signal handlers, for when Linux gets around to supporting
	SA_RESTART properly.
	(nih_main_loop_interrupt): Write to the pipe so the select call gets
	interrupted.
	(nih_main_loop_exit): Interrupt the main loop, in case we're
	waiting forever.
	(nih_main_loop_close): Close the interrupt pipe, used in children.
	* nih/main.h: Update.
	* nih/io.c (nih_io_add_watch): Change type of events parameter.
	(nih_io_poll_fds): Remove this function.
	(nih_io_select_fds): And replace with this that sets the select
	file descriptor sets instead.
	(nih_io_handle_fds): Now receives select file descriptor sets, and
	becomes rather more obvious in the process.  Restore the previous
	behaviour where a callback isn't called unless requests events
	occur.
	(nih_io_reopen): Always poll for reading so we pick up errors.
	(nih_io_cb): Change type of events parameter and events settings.
	(nih_io_write): Change event settings.
	* nih/io.h: Update.
	(NihIoEvents): replace the previous poll events with a new enum.
	* nih/signal.c (nih_signal_handler): Interrupt the select call in
	the main loop.
	* nih/tests/test_io.c: Update with new test cases.
	* nih/tests/test_child.c: Use select() rather than poll()

	* nih/tests/test_io.c (test_buffer_push, test_write): Correct
	uninitialised return value.

	* nih/main.c (nih_main_loop): Correct a memory leak, we forgot
	to clean up the poll fds list.

	* nih/io.c (nih_io_handle_fds): Always call the callback, even if
	unexpected events happen, otherwise we'll miss ERR, HUP, etc.
	(nih_io_shutdown): Allow a socket to be closed lazily, so we can
	send (or receive) a whole bunch of stuff and expect the structure to
	go away afterwards.
	(nih_io_cb): If the shutdown flag has been marked and we run out
	of things in either buffer, act as if one end was closed.
	(nih_io_reopen): Mark sockets as not shutdown by default.
	* nih/io.h: Update.
	* nih/tests/test_io.c (test_shutdown): Test behaviour.
	(test_handle_fds): Take out some of the tests due to changed
	behaviour.  While "clever" I think overall this is undesirable.

	* nih/io.c (nih_io_set_cloexec): Function to set the FD_CLOEXEC flag.
	* nih/io.h: Update.
	* nih/tests/test_io.c (test_set_cloexec): Test the function.

2006-08-11  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.h, nih/child.h, nih/hash.h, nih/logging.h, nih/signal.h,
	nih/timer.h: Document arguments to function pointers.

	* nih/io.c: Add a whole bunch of code to provide us with a high-
	throughput, async file/socket layer; largely copied from the
	dircproxy code (well, it works!).  This allows read and write calls
	to happen inside the main loop based on whenever poll thinks either
	is possible, while user space can just write what it likes or get
	called when there's data in the recv buffer.
	* nih/io.h: Add the new typedefs, structures and prototypes.
	* nih/tests/test_io.c: Lots of test cases for this stuff.

2006-08-10  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_realloc): Fix a fairly critical bug, we weren't
	dealing with the fact that the children list head can move;
	do some fancy shifting to make that work.

	* nih/string.c (nih_str_split): Add a function to split a string
	based on delimiters into an array.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_str_split): Test the new function.

2006-08-09  Scott James Remnant  <scott@netsplit.com>

	* nih/tests/test_child.c (test_poll): Add extra sleep calls for
	safety.

	* nih/libnih.h: Include errors.h

2006-08-04  Scott James Remnant  <scott@netsplit.com>

	* nih/errors.h: Include errno.h for helpfulness.

2006-08-03  Scott James Remnant  <scott@netsplit.com>

	* nih/child.c (nih_child_add_watch): Also takes a parent now.
	* nih/child.h: Update.
	* nih/tests/test_child.c: Update.

	* nih/io.c (nih_io_add_watch): And once more, with feeling; takes
	a parent for the watch.
	* nih/io.h: Update.
	* nih/tests/test_io.c: Update.

	* nih/signal.c (nih_signal_add_callback): Give this the same treatment,
	it takes the parent for the signal callback.
	* nih/signal.h: Update.
	* nih/tests/test_signal.c: Update.

	* nih/timer.c (nih_timer_add_timeout, nih_timer_add_periodic) 
	(nih_timer_add_scheduled): Use nih_alloc properly by taking a parent
	for the timer object and setting a destructor on it so that it's
	automatically removed when the parent is freed.
	* nih/timer.h: Update.
	* nih/tests/test_timer.c: Update function calls.
	* nih/tests/test_main.c (test_main_loop): Update also.

	* nih/list.c (nih_list_destructor): Add a destructor function that
	just cuts the entry out of the list in preperation for being freed.
	* nih/list.h: Update.
	* nih/tests/test_list.c (test_destructor): Test the behaviour of
	the new function.

	* nih/tests/test_error.c: Include fixes.

2006-08-02  Scott James Remnant  <scott@netsplit.com>

	* nih/signal.c (nih_signal_set_handler, nih_signal_set_default) 
	(nih_signal_set_ignore): Reset sa_flags so that we don't pass
	uninitialised data for SIGALRM.
	(nih_signal_reset): Add function to reset signals back to their
	default state.
	* nih/signal.h: Update.
	* nih/tests/test_signal.c (test_reset): Add test case.

	* nih/error.c (nih_error_raise_system): Be a lot more careful in
	this function!  Save the value of errno in case we overwrite it
	and call nih_error_init()

	* nih/signal.c (nih_signal_set_handler): Add the SA_NOCLDSTOP
	signal for SIGCHLD.

	* nih/main.c (nih_main_loop): Drop the code that masked out the
	child signal, it was inherently racy and there's no particular
	reason to do it anyway since we use SA_RESTART in signal.c for
	most things.

	* nih/signal.c (nih_signal_set_handler, nih_signal_set_default)
	(nih_signal_set_ignore): don't set SA_RESTART for SIGALRM.

	* nih/signal.c (nih_signal_set_handler, nih_signal_set_default)
	(nih_signal_set_ignore): use nih_return_system_error to make the
	code rather cleaner.

	* nih/error.h (nih_return_error): Add missing doc for retval
	(nih_return_system_error): Add additional useful function.
	* nih/tests/test_error.c (test_return_system_error): Add test
	case for the new macro.

	* nih/child.c (nih_child_poll): Convert to use waitid() so that
	we can obtain the information about the dead child without reaping
	it until we're done processing; useful because it means /proc/$PID
	and the child itself is still around during the handlers.
	* nih/child.h (NihReaper): Gains a new third argument that indicates
	whether the child exited normally or was killed.
	* nih/tests/test_child.c (test_poll): Update.

	* nihify: Add a few useful sanity checks so that it works with
	relative paths and already-nihified directories.

	* m4/misc.m4: Remove older force code.

	* TODO: Updated.

	* m4/Makefile.am (dist_aclocal_DATA): Distribute misc.m4, long
	missed.

	* nihify: Add useful script for symlinking into source trees until
	we intend to get released.

	* HACKING: Correct typo (our -> out)

2006-07-28  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_term_signal): Handy signal callback.
	* nih/main.h: Update.
	* nih/tests/test_main.c (my_timeout): Cheat and ensure the latest
	exit status is used.

	* nih/main.c (nih_main_loop): Implement a main loop by calling
	various other functions in the right manner.
	(nih_main_loop_exit): Function to break the main loop.
	* nih/main.h: Update.
	* nih/tests/test_main.c (test_main_loop): Add a trivial test case
	for the main loop, it's damned difficult to test, but at least this
	ensures the bases are touched.

	* nih/signal.c (nih_signal_poll): Add missing call to
	nih_signal_init()
	* nih/child.c (nih_child_poll): Add missing call to nih_child_init()
	* nih/io.c (nih_io_poll_fds, nih_io_handle_fds): Add missing calls
	to nih_io_init()

	* nih/io.c: Code for watching file descriptors and sockets for
	events through poll(), but not actually the poll() call itself.
	* nih/io.h: Typedefs, structures and prototypes.
	* nih/libnih.h: Include io.h
	* nih/tests/test_io.c: Test cases for I/O watches.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link io.c
	(nihinclude_HEADERS): Install io.h
	(TESTS): Build and run I/O test cases
	(test_io_SOURCES, test_io_LDFLAGS, test_io_LDADD): Details for I/O
	test case binary.

	* nih/tests/test_timer.c (test_poll): Free entry after testing.

	* nih/child.c (nih_child_poll): When the reaper is for a particular
	process, be sure to remove it from the list.
	* nih/tests/test_child.c (test_poll): Test for that.
	
	* nih/child.c: Simple bit of code to wait for children to
	terminate and dispatch the reaper functions for them.
	* nih/child.h: Typedefs, structures and prototypes.
	* nih/libnih.h: Include child.h
	* nih/tests/test_child.c: Test cases for child handling code.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link child.c
	(nihinclude_HEADERS): Install child.h
	(TESTS): Build and run child test cases
	(test_child_SOURCES, test_child_LDFLAGS, test_child_LDADD): Details
	for child test case binary.

	* nih/timer.c (nih_timer_add_timeout, nih_timer_add_periodic)
	(nih_timer_add_scheduled): Change argument order so that the time
	information is first, to match signal functions.
	* nih/timer.h: Update.
	* nih/tests/test_timer.c: Update.

	* nih/signal.h: Include the system signal.h for ease of use.

	* nih/signal.c: Code for handling signals inside the main loop,
	rather than trying to fit delicate code in a signal handler; and
	for making it generally easier to handle signals.
	* nih/signal.h: Typedefs and prototypes.
	* nih/libnih.h: Include signal.h
	* nih/Makefile.am (libnih_la_SOURCES): Build and link signal.c
	(nihinclude_HEADERS): Install signal.h
	(TESTS): Build and run signal test cases
	(test_signal_SOURCES, test_signal_LDFLAGS, test_signal_LDADD): Details
	for signal test case binary.

2006-07-27  Scott James Remnant  <scott@netsplit.com>

	* nih/timer.c: Code for timeouts, periodic and scheduled timers,
	note that the actual scheduling part of scheduled timers it not
	implemented yet (we need to think a bit more about it)
	* nih/timer.h: Structures, macros and prototypes.
	* nih/libnih.h: Include timer.h
	* nih/tests/test_timer.c: Test cases for timer code.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link timer.c
	(nihinclude_HEADERS): Install timer.h
	(TESTS): Build and run timer test cases
	(test_timer_SOURCES, test_timer_LDFLAGS, test_timer_LDADD): Details
	for timer test case binary.

	* nih/alloc.c (nih_free): Use new safe list iteration macro.

	* nih/hash.c (nih_hash_add_unique, nih_hash_replace)
	(nih_hash_search): Use new list iteration macros.

	* nih/list.h (NIH_LIST_FOREACH): New macro that expands to the usual
	list iteration for loop, prevents mistakes.
	(NIH_LIST_FOREACH_SAFE): Macro that does the same as above, but also
	includes a "next" variable to allow safe iteration; especially useful
	to prevent us getting this wrong!
	* nih/tests/test_list.c (test_foreach, test_foreach_safe): Add test
	cases for iteration.

	* nih/error.c (nih_error_init): Make inline and check value first.
	(nih_error_raise, nih_error_raise_printf, nih_error_raise_again)
	(nih_error_push_context): Unconditionally call nih_error_init.

	* nih/alloc.c (nih_alloc_init): Make inline and check value first.
	(nih_alloc): Unconditionally call nih_alloc_init.

	* nih/logging.c (nih_log_init): Use the proper functions to
	initialise details, check values first; also make inline.
	(nih_log_message): Unconditionally call nih_log_init.

	* nih/Makefile.am (DEFS): Append to the default DEFS list, rather
	than overriding, otherwise we lose HAVE_CONFIG_H

	* nih/macros.h: Check for ENABLE_NLS instead of HAVE_GETTEXT and
	include libintl.h if defined as well.

2006-07-20  Scott James Remnant  <scott@netsplit.com>

	* nih/string.c (nih_strv_free): Add a function to free an array
	of strings.
	* nih/string.h: Update.
	* nih/tests/test_string.c (test_strv_free): Test the function.

	* nih/error.c: Error handling code.
	* nih/error.h: Structures, macros and prototypes.
	* nih/errors.h: Error enum and message definitions.
	* nih/libnih.h: Include error.h and errors.h
	* nih/tests/test_error.c: Error handling test cases.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link error.h
	(nihinclude_HEADERS): Install error.h
	(TESTS): Build and run error handling test cases.
	(test_error_SOURCES, test_error_LDFLAGS, test_error_LDADD): Binary
	for error handling test cases.

	* nih/macros.h (NIH_MUST, NIH_MUST_NOT): Add handy macros to spin
	until we get a true or false value from an assignment.  Usually
	used around a call to memory allocation functions that we can't
	deal with failing.

	* nih/main.c (nih_main_package_string): Change package_string
	to be a module-level static so it can be reset by a call to
	nih_main_init_full.  Always return if not NULL.
	* nih/tests/test_main.c (test_package_string): Call nih_main_init_full
	instead of futzing with variables so the static string is reset.

	* nih/alloc.c (nih_alloc_using, nih_alloc, nih_realloc)
	(nih_alloc_size, nih_alloc_parent): Make various argument pointers
	const.
	* nih/alloc.h: Update.

	* nih/libnih.h, nih/logging.c, nih/main.c: Update to include
	string.h not strutil.h

	* nih/strutil.c: Renamed to nih/string.c
	* nih/strutil.h: Renamed to nih/string.h
	* nih/tests/test_strutil.c: Renamed to nih/tests/test_string.h
	* nih/Makefile.am (DEFAULT_INCLUDES): Override to stop automake doing
	silly things like putting -I. in the pre-processor flags.
	(libnih_la_SOURCES, nihinclude_HEADERS, TESTS)
	(test_string_SOURCES, test_string_LDFLAGS, test_string_LDADD): Update.

2006-07-19  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.h, nih/logging.h, nih/strutil.h: Reformat attribute
	declarations to not upset emacs indentation.

2006-07-17  Scott James Remnant  <scott@netsplit.com>

	* nih/strutil.c (nih_strdup): Implement an nih_alloc-based strdup.
	(nih_strdup): and strndup.
	* nih/strutil.h: Update.
	* nih/tests/test_strutil.c: Test new functions.

2006-07-13  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_free): Remove the entry from the parent's list.

	* nih/logging.h (nih_assert): Reexpress to avoid polluting if
	statements without an else.

	* nih/alloc.c (nih_realloc): Implement a function that reallocates
	a block of memory with the original allocator.
	(nih_alloc_init): Don't double-check the allocator.
	* nih/alloc.h: Update.
	* nih/tests/test_alloc.c (test_realloc): Check behaviour of realloc.

	* nih/alloc.c (NihAllocCtx): Drop the name pointer, we never used
	that anyway.
	(nih_alloc_using): Drop name parameter.
	(nih_alloc_named): Rename to nih_alloc.
	(nih_alloc_set_name): Drop this function.
	(nih_alloc_name): And this one.
	* nih/alloc.h (nih_new): Simplify.
	(nih_alloc): Drop entirely now it's unneeded.
	* nih/tests/test_alloc.c: Update.
	* nih/tests/test_list.c (test_new): Test using nih_alloc_size
	rather than nih_alloc_name.

	* nih/logging.h: Put the log priorities back in ascending order,
	but use the zero to mean "unknown".  Fix up the descriptions to be
	a little more consistent.
	* nih/logging.c: Rename max_priority back to min_priority so it
	all makes more sense again.
	(nih_log_init): Warning is the default minimum priority to show.
	(nih_log_set_priority): Set minimum priority.
	(nih_log_message): Discard messages below the minimum priority.
	(nih_logger_printf): Use stderr when priority is greater than or
	equal to warning.
	* nih/tests/test_logging.c: Update to match.

	* nih/logging.c (nih_log_message): Use nih_vsprintf which makes the
	function not core dump (always good, that).

2006-07-12  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_package_string): Use nih_sprintf and make
	the function rather simpler.

	* nih/tests/test_alloc.c (main): Formatting fix.

	* nih/strutil.c (nih_sprintf): Function to wrap sprintf, allocating
	the necessary space using nih_alloc first.
	(nih_vsprintf): Function to wrap vsprintf, allocating the necessary
	space using nih_alloc first.
	* nih/strutil.h: Prototypes.
	* nih/libnih.h: Include strutil.h
	* nih/Makefile.am (libnih_la_SOURCES): Build and link strutil.c
	(nihinclude_HEADERS): Install strutil.h
	(TESTS): Build and run strutil test cases
	(test_strutil_SOURCES, test_strutil_LDFLAGS)
	(test_strutil_LDADD): Binary for strutil test cases.

2006-07-05  Scott James Remnant  <scott@netsplit.com>

	* nih/logging.c (nih_log_message): Don't bother catching
	vsnprintf's return value, C99 doesn't allow it to fail.
	* nih/main.c (nih_main_package_string): Likewise for here.

	* nih/logging.c (nih_log_message): Don't use a static variable
	for no apparent reason, just free afterwards.  Catch vsnprintf and
	malloc failing.
	* nih/main.c (nih_main_package_string): Catch snprintf and realloc
	failing here too.

2006-05-30  Scott James Remnant  <scott@netsplit.com>

	* nih/logging.h (nih_assert): Assertion macro that uses our logging
	rather than stderr.
	* nih/alloc.c, nih/hash.c, nih/list.c, nih/logging.c, nih/main.c:
	Use nih_assert rather than assert.
	* nih/Makefile.am (test_alloc_LDFLAGS, test_list_LDFLAGS)
	(test_hash_LDFLAGS, test_main_LDFLAGS, test_logging_LDFLAGS): Link
	libraries statically.
	(test_alloc_LDADD, test_list_LDADD, test_hash_LDADD)
	(test_main_LDADD, test_logging_LDADD): Just link to the library.

	* nih/macros.h (NIH_STRINGIFY): Correct typo (-s -> _s)
	(NIH_LIKELY, NIH_UNLIKELY): Add branch prediction macros.

2006-05-29  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_alloc_init): Restore this function, it's better
	style to keep variables in shared libraries as zero.
	(nih_alloc_named): Call nih_alloc_init once more.
	* nih/logging.h: Reorder such that NONE is the lowest value.
	* nih/logging.c (min_priority): Rename to max_priority and set value
	to NIH_LOG_NONE (zero).
	(nih_log_init): Initialise the default logger and priority.
	(nih_log_set_priority): Assert priority is greater than NONE.
	(nih_log_message): Initialise the logging if necessary.
	(nih_logger_printf): Check priority with <=

	* TODO: Update.

	* nih/logging.c: Code for formatting log messages and filtering
	based on priority.
	* nih/logging.h: Prototypes and macros.
	* nih/libnih.h: Include logging.h
	* nih/tests/test_logging.c: Logging test cases.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link logging.c
	(nihinclude_HEADERS): Install logging.h
	(TESTS): Build and run logging test cases.
	(test_logging_SOURCES, test_logging_LDADD): Binary for logging
	test cases.

	* nih/tests/test_main.c (test_package_string, test_suggest_help)
	(test_version): Add missing comments before tests.
	(test_suggest_help, test_version): Close the duplicated stdout/stderr
	before leaving the test.

	* nih/alloc.h: Declare nih_alloc_named and nih_alloc_using with
	the warn_unused_result and malloc attributes.

2006-05-27  Scott James Remnant  <scott@netsplit.com>

	* m4/compiler.m4 (NIH_COMPILER_WARNINGS): Drop -pedantic as we
	usually want gcc extensions (all the world IS gcc).

2006-05-26  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_init_full): Only take the basename of
	the program name, not the full path.
	(nih_main_package_string): Use an allocated piece of memory rather
	than some on the stack, with C99-style snprintf to do the right thing
	with it.
	* nih/tests/test_main.c (test_init): Include check for basename.
	(test_package_string): Drop tests involving basename here.

	* m4/compiler.m4 (NIH_TRY_C99): Macro that tries compiling
	some code full of C99 features.
	(NIH_C_C99): Use the above macro to determine whether the compiler
	supports C99, or whether it can do it with a compiler flag.
	* configure.ac: Make sure the compiler does C99.

	* nih/list.c: Add missing prototype for nih_list_cut.
	* nih/hash.c: Add missing prototype for fnv_hash.

	* nih/macros.h (_, N_): Define gettext-wrapper macros if
	HAVE_GETTEXT, otherwise define them to just expand to their string.

	* nih/main.h: Drop comments for global variables.
	* nih/main.c: Provide proper docstrings for them here.

	* nih/alloc.c (nih_alloc_init): Drop this function, instead just
	initialise the static variable directly.
	(nih_alloc_set_allocator): Correct parameter name in docstring,
	don't call nih_alloc_init (it's already initialised).

2006-05-24  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c (nih_main_package_string): Clarify documentation.

2006-05-23  Scott James Remnant  <scott@netsplit.com>

	* nih/main.c: Add code for the various little functions that we
	usually call from main().
	* nih/main.h: Prototypes and macros.
	* nih/libnih.h: Include main.h
	* nih/Makefile.am (libnih_la_SOURCES): Build and link main.c
	(nihinclude_HEADERS): Install main.h
	(TESTS): Build and run main test-cases
	(test_main_SOURCES, test_main_LDADD): Code for main tests.
	* m4/misc.m4 (AC_COPYRIGHT): Wraps the Autoconf AC_COPYRIGHT macro
	but also defines PACKAGE_COPYRIGHT
	* m4/compiler.m4: Temporary hack to make sure misc.m4 gets dragged
	in as aclocal doesn't notice it, will go away once we get something
	that aclocal will notice.

2006-04-26  Scott James Remnant  <scott@netsplit.com>

	* nih/hash.c: Add code for FNV hash tables that uses NihList for
	the actual bins so is largely polymorphic.
	* nih/hash.h: Prototypes, macros and structures.
	* nih/macros.h: Include stdint.h as well, we use that a lot.
	* nih/libnih.h: Include hash.h
	* nih/tests/test_hash.c: Test cases for new hash table code.
	* nih/Makefile.am (libnih_la_SOURCES): Build and link hash.c
	(nihinclude_HEADERS): Install hash.h
	(TESTS): Build and run hash table test-cases.
	(test_hash_SOURCES, test_hash_LDADD): Code for hash table tests.
	* TODO: Update.

	* nih/tests/test_list.c (test_empty): Fix faulty test case that
	actually proved one-entry lists were showing up as empty!
	* nih/list.h (NIH_LIST_EMPTY): Compare the next and previous pointers
	against the list pointer itself!

	* nih/list.c (nih_list_cut): Add an inline function that does the
	job of nih_list_remove without calling nih_list_init afterwards.
	(nih_list_remove): Call nih_list_cut rather than modifying pointers.
	(nih_list_free): Use nih_list_cut for efficiency, no point fixing
	the pointers if we're just going to free it.
	(nih_list_add, nih_list_add_after): Use nih_list_cut as the pointers
	get modified afterwards anyway, more efficient this way.

2006-04-25  Scott James Remnant  <scott@netsplit.com>

	* nih/list.c: Remove unnecessary include of stdlib.h

	* nih/list.c (nih_list_new): Fix formatting of docstring.
	* nih/alloc.c (nih_alloc_using, nih_alloc_parent): Fix formatting
	of docstring.
	(nih_alloc_named): Fix docstring to mention NULL can be returned.
	* nih/tests/test_alloc.c, nih/tests/test_list.c: Add missing blank
	line before includes.

	* nih/alloc.c (nih_alloc_using): Return NULL if the allocation
	fails.
	* nih/list.c (nih_list_new): Also return NULL if the allocation
	fails.

	* nih/alloc.c (nih_alloc_set_allocator, nih_alloc_using)
	(nih_free, nih_alloc_set_name, nih_alloc_set_destructor)
	(nih_alloc_name, nih_alloc_size, nih_alloc_parent): Use assert
	to uncover programming errors.
	* nih/list.c (nih_list_init, nih_list_remove, nih_list_free)
	(nih_list_add, nih_list_add_after): Use assert to uncover
	programming errors.
	(nih_list_new): Comment that nih_new may return NULL and we need
	to make sure we catch that.

2006-04-24  Scott James Remnant  <scott@netsplit.com>

	* m4/Makefile.am (dist_aclocal_DATA): Add missing \
	* nih/Makefile.am (INCLUDES): Include top_srcdir otherwise we
	can't be built out of tree.

	* m4/Makefile.am (dist_aclocal_DATA): Install the m4 files into
	the aclocal directory, not a package specific one.
	* m4/compiler.m4, m4/linker.m4: Fix closing comment style.

	* TODO: Add TODO file.
	* nih/list.h (NIH_LIST_EMPTY): Document what this actually does.

2006-04-19  Scott James Remnant  <scott@netsplit.com>

	* nih/list.c (nih_list_entry_new): Removed.  This makes the list
	code more focussed and generic, but also we'll nearly always want
	the data member to be an nih_alloc child of the list, rather than
	the other way around!
	* nih/list.h (NihListEntry, nih_list_add_new)
	(nih_list_add_new_after): Likewise, remove the structure and helper
	macros; if we find ourselves wanting this, we can put it in a new
	file and just make it polymorphic like we plan for hashes.
	* nih/tests/test_list.c: Replace all uses of NihListEntry with plain
	NihList, we never checked the data members anyway.
	(test_entry_new): Remove test case.
	(test_add): Remove test of nih_list_add_new macro.
	(test_add_after): Remove test of nih_list_add_new_after macro.
	(test_empty): Check macro works with any list entry.
	(test_remove): Test removal of the last list entry, and removal
	on an already empty list.
	(test_free): Don't check the pointers of a block we've just freed!

2006-04-18  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (nih_alloc_init): Call nih_alloc_set_allocator.
	* nih/alloc.h (NihDestructor): Clarify docstring to not refer
	to internal structures.
	* nih/list.h (NIH_LIST_EMPTY): Add convenience macro for this
	common operation.
	* nih/tests/test_list.c (test_empty): Test the new macro.

2006-04-16  Scott James Remnant  <scott@netsplit.com>

	* nih/list.c (nih_list_new, nih_list_entry_new): Call nih_new rather
	than malloc so the list can be a context for data members.
	(nih_list_free): Call nih_free rather than free.
	* nih/tests/test_list.c: Test cases should not be static.
	(test_new, test_entry_new): Check the new object was allocated using
	our nih_alloc function.
	(test_remove): Test a second removal.
	(destructor_called): Function to test whether destructor was called.
	(test_free): Test now that we can use an NihDestructor.
	* nih/Makefile.am (test_list_LDADD): Link alloc.o now that lists
	depend on the allocator.

	* nih/list.c, nih/list.h: Fix docstrings to use references where
	useful.  Split functions into blocks separated by a newline.

	* nih/alloc.h: Update and fix formatting.
	(NihAllocDestructor): Rename to NihDestructor.
	* nih/alloc.c (nih_alloc_init): Make safe against repeated calls.
	(nih_alloc_set_allocator): New function to set the default allocator,
	overriding any set already.
	(nih_alloc_set_destructor): Update type of destructor argument..
	(NihAllocCtx): Update type of destructor member.
	* nih/tests/test_alloc.c (my_realloc): Wrapper around realloc so
	we can check custom allocators are called properly.
	(test_alloc_using): Test allocation with a custom allocator.
	(test_free): Check that the block is freed using the allocator,
	also update destructor checking.
	(test_set_allocator): Test new allocator is used.

	* nih/alloc.c (nih_alloc_using): New one-shot function to use a given
	realloc-style function to make a named block of memory of a given size.
	(nih_alloc_named): Replace with a thin-wrapper around nih_alloc_using
	that passes in the default allocator.
	(NihAllocCtx): Add new allocator member to store the allocator used,
	so we free with the right one.
	(nih_alloc_init): Set the default allocator to realloc().  Drop
	pool initialisation code.
	(nih_free): Call the context's original allocator with zero size.
	(used_pool, unused_pool, NIH_ALLOC_SMALLEST): Remove, these really
	belong in distinct memory handling code.
	(nih_alloc_set, nih_alloc_new): Drop functions only needed if we're
	doing our own memory management.
	(nih_alloc_size, nih_alloc_parent): Add a couple of useful functions.
	* nih/alloc.h (NihAllocator): Typedef for allocator function prototype.
	(nih_alloc): Rename to nih_new.
	(nih_alloc_size): Rename to nih_alloc.
	* nih/tests/test_alloc.c (test_alloc_named, test_new, test_alloc): Test
	behaviour of standard functions with and without parents.
	(destructor_called): Allow it to be called multiple times, change
	to static to enforce modularity.
	(child_destructor_called): Another function for testing multiple
	destructors.
	(test_free): Test nih_free using alloc destructors.
	(test_alloc_set_name): Rename to just test_set_name for consistency.

	* nih/macros.h (NIH_STRINGIFY): Generic hack to turn a numeric
	macro into a string.
	* nih/alloc.h (nih_alloc, nih_alloc_size): Use generic NIH_STRINGIFY
	macro instead of our home-cooked one.

2006-03-31  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c, nih/alloc.h, nih/list.c, nih/list.h, nih/macros.h,
	nih/libnih.h, nih/tests/test_alloc.c,
	nih/tests/test_list.c: Update FSF address in GPL header.

2006-03-03  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c, nih/alloc.h, nih/list.c, nih/list.h: Formatting fixes,
	correct erroneous references to d_* functions and D* structures.
	* nih/list.h: Correct docstring for nih_list_new and nih_list_entry_new
	functions so that @data is described for the right one.
	* nih/Makefile.am: Add blank line between SOURCES and LDFLAGS.

2005-09-29  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c, nih/alloc.h, nih/list.c, nih/list.h: Fix docstring
	terminators to be **/ not */.
	* nih/alloc.h: Align function parameters.
	* nih/tests/test_alloc.c (test_alloc_set_name): Fix to return
	ret and not zero all the time.

2005-08-29  Scott James Remnant  <scott@netsplit.com>

	* nih/alloc.c (NIH_ALLOC_SMALLEST): Set to the size of the
	NihAllocCtx structure shifted left twice; this will divide evenly
	into a page.

	* nih/alloc.c (nih_alloc_init): No need to pass NULL to nih_list_new.
	(nih_alloc_new): No need to initialise data member of NihList structs
	or cast children member.
	(nih_alloc_named): Can cast NihList directly to NihAllocCtx now,
	simplify difference test.
	(nih_free): Use iter as variable name for clarity.
	(nih_alloc_return_unused): Cast NihList directly to NihAllocCtx.
	* nih/tests/test_alloc.c: Output "BAD:" instead of "FAIL:"

	* nih/list.h (NihList): Remove data pointer, it'll save us 4 bytes
	where we want to make lists of structures that are always in lists.
	(NihListEntry): Define new structure for those still wanting data
	pointers.
	(nih_list_add_new, nih_list_add_new_after): Use nih_list_entry_new.
	* nih/list.c (nih_list_new): Remove argument and don't initialise
	data pointer, this simply allocates and initialises the two-pointer
	structure.
	(nih_list_entry_new): New function to allocate and initialise an
	NihListEntry structure.
	* nih/tests/test_list.c: Output "BAD:" instead of "FAIL:"
	(test_new): Test without data pointer.
	(test_entry_new): Test with data pointer.
	(test_add, test_add_after, test_remove): Mix and cast NihList and
	NihListEntry properly.

	* nih/alloc.c: Implement a heirarchial allocator in a similar
	style to halloc and talloc, but designed never to return data to
	the system and re-use it instead.
	* nih/alloc.h: Prototypes and macros for allocator.
	* nih/libnih.h: Include allocator header.
	* nih/tests/test_alloc.c: Test-cases for allocator.
	* nih/macros.h (MIN, MAX): Define MIN and MAC macros if not already
	available.
	* nih/Makefile.am (libnih_la_SOURCES): Compile and link alloc.c
	(nihinclude_HEADERS): Install alloc.h
	(TESTS): Build and run the allocator test-cases.
	(test_alloc_SOURCES, alloc_list_LDADD): Identify the test sources and
	objects it needs.

2005-08-28  Scott James Remnant  <scott@netsplit.com>

	* nih/list.c (nih_list_init): Add new function for dealing with
	statically allocated list entries, and initialising them.
	(nih_list_new): Use nih_list_init() to initialise the list.
	(nih_list_new): Use nih_list_init() to re-initialise the list
	to a single-member.
	* nih/list.h: Add prototype for nih_list_init.
	(NihListIter): Remove the iterator structure, it turns
	out to be harder work to try and use lists in an "all nodes are
	interesting" manner; so we'll iterate them normally instead.
	(NIH_LIST_FIRST, NIH_LIST_LAST): Remove iterator test functions.
	(NIH_LIST_PREV, NIH_LIST_NEXT): Remove iterator change functions.
	* nih/tests/test_list.c: Use NULL for nih_list_new in all functions.
	(test_init): New test case for nih_list_init().
	(test_iterator): Removed iterator tests.

2005-08-21  Scott James Remnant  <scott@netsplit.com>

	* nih/list.c: Add code for generic circular doubly-linked lists.
	* nih/list.h: Prototypes and macros.
	* nih/macros.h: Some generic macros.
	* nih/libnih.h: Header to import everything.
	* nih/tests/test_list.c: Test-cases for linked-list code.
	* nih/Makefile.am (libnih_la_SOURCES): Link list.c in.
	(nihincludedir): Define directory to contain header files to be
	$includedir/nih.
	(include_HEADERS): Install libnih.h into the main include directory.
	(nihinclude_HEADERS): Install header files.
	(TESTS): Build and run the list test-cases.
	(test_list_SOURCES, test_list_LDADD): Identify the test sources and
	objects it needs.

	* nih/libnih.ver: Add simple "everything beginning nih_* is global"
	version script.
	* nih/Makefile.am (libnih_la_LDFLAGS): Use the version script
	if we can pass an argument to do that to the linker.
	(EXTRA_DIST): Distribute the version script.

2005-07-09  Scott James Remnant  <scott@netsplit.com>

	* m4/compiler.m4 (NIH_COMPILER_WARNINGS): Macro to add -Wall,
	-Werror and -pedantic to CFLAGS and CXXFLAGS if using gcc or g++.
	(NIH_COMPILER_OPTIMISATIONS): Macro to remove any optimisation
	arguments from CFLAGS and CXXFLAGS and replace them with -O0 to
	override any default level.
	(NIH_COMPILER_COVERAGE): Macro to add compiler coverage testing
	arguments to CFLAGS and CXXFLAGS.
	* m4/linker.m4 (NIH_LINKER_OPTIMISATIONS): Macro to add -Wl,-O1
	to LDFLAGS to increase the optimisation of the linker hash tables.
	(NIH_LINKER_VERSION_SCRIPT): Macro to test for the right argument
	to pass a version script to the linker and define
	HAVE_VERSION_SCRIPT and VERSION_SCRIPT_ARG.
	* m4/Makefile.am (dist_pkgdata_DATA): Ship macros.
	* configure.ac: Use new macros.

	* ChangeLog: Initial project infrastructure created.


Copyright 2K16 - 2K18 Indonesian Hacker Rulez