1.0.1 2010-02-04
* Add missing __nih_* symbols to the linker version script, otherwise software using TEST_ALLOC_FAIL cannot be compiled (like Upstart). * The glibc __abort_msg symbol is now only linked as a weak reference, if your C library does not have the symbol, libnih will still work. 1.0.0 2009-11-28 * libnih is no longer intended to be copied into an application source tree and linked statically, but is now installed onto the system and dynamically linked normally. The nihify script has been removed accordingly. * Future 1.0.x versions will contain bug fixes, but no API or ABI changes. Future 1.x.0 versions may introduce new things to the API or ABI but will be backwards compatible with previous versions. Future x.0.0 versions will not be backwards compatible. * The NIH_INIT macro has been removed, to check for libnih or libnih-dbus you should now use pkg-config, e.g.: PKG_CHECK_MODULES([NIH], [libnih >= 1.0.0]) any other checks should be added as necessary instead of relying on that macro to do them for you. * An external pre-built nih-dbus-tool may be used instead of the built copy by passing NIH_DBUS_TOOL to configure. If you are cross-compiling, this will be automatically searched for in the PATH and a warning output if it doesn't exist and you fail to specify it. (Bug: #426740) * nih_alloc() has been fixed to work on platforms with alignment greater than 4 bytes. (Bug: #436758) * nih_alloc() no longer permits objects to have zero references, passing NULL for the parent now creates a special reference from a NULL parent. * nih_discard() removes this special reference before checking whether remaining references free the object. * nih_ref() and nih_unref() may have NULL as the parent reference and add or remove the special reference respectively. * nih_ref() does not remove the NULL reference, you must now use nih_discard() or nih_local to construct floating objects. * Since nih_ref() may be used when parent is NULL, there's no reason for an nih_unref_only() function so it has been dropped; the following code is now perfectly safe: nih_ref (obj, new_parent); nih_unref (object, old_parent); * nih_alloc_parent() has changed again, now when passed NULL it only returns TRUE if the object has the special NULL parent. * TEST_ALLOC_PARENT() has likewise changed, restoring the previous behaviour that TEST_ALLOC_PARENT(ptr, NULL) tests whether it has the NULL parent. * The TEST_ALLOC_ORPHAN() macro has been dropped, objects may no longer have no parents. * A new TEST_ALLOC_NOT_PARENT() macro has been added that is the exact inverse of TEST_ALLOC_PARENT() * These changes solve the problem where the object "obj" in the following code would be freed, even though it was intended that it be a top-level object: obj = nih_new (NULL, Obj); nih_ref (obj, tmp_obj); nih_unref (obj, tmp_obj); This comes at a cost of breaking the previous behaviour where a NULL-parented object could be considered floating and ignored once referenced. This kind of code was brittle anyway and nih_local far better solves it, e.g. replace code such as: Obj *obj; obj = nih_new (NULL, Obj); func_that_will_ref (obj); with: nih_local Obj *obj = NULL; obj = nih_new (NULL, Obj); func_that_will_ref (obj); * nih_log_message() will set the glibc __abort_msg variable to any log message of NIH_LOG_FATAL priority or greater, this means that should you call abort() core dump analysers can retrieve the message; especially useful for nih_assert(). (Bug: #429411) * nih-dbus-tool generated code has been fixed so that when a method call function is called on a disconnected connection it returns a raised DBUS_ERROR_DISCONNECTED rather than causing an assertion error. (Bug: #477116) 0.3.2 2009-08-02 * D-Bus 1.2.16 is now required. * Fixed compilation on ia64. * nih-dbus-tool(1) manpage will not be installed, since the binary is not. (Bug: #403103) 0.3.1 2009-07-09 * The licence for libnih has been changed back to version 2 of the GNU GPL. * D-Bus 1.2.15 is now required, this is the current GIT HEAD pending a 1.2.16 release. * TEST_EXPECTED_STR and TEST_EXPECTED_FILE added. These compare the contents of a string and file respectively against the contents of a given filename relative to the "expected" directory alongside the test binary, e.g.: TEST_EXPECTED_STR (code, "foo.c"); in tests/test_foo will be TRUE if the contents of the C string "code" match the contents of the file tests/expected/foo.c * NihFileFilter (the function type passed to nih_dir_walk and nih_watch_new) now has an extra is_dir argument, this is set without calling stat() * NihTimer now uses a monotonic clock, so is unaffected by changes in the system clock; this means that you'll need to use clock_gettime (CLOCK_MONOTONIC) when manually adjusting the due time rather than time (). (Bug: #389589) * NihError may now be directly embedded into other structures with the NIH_ERROR_MEMBERS macro. * NihDBusError now directly embeds the members of NihError, there is no longer an "error" member, instead you can directly access "number" and "message" members. * NihDBusProxy has gained an auto_start member, TRUE by default. If you do not want method calls to automatically start a service, you may set this to FALSE after creating the proxy. nih-dbus-tool generated method calls will respect this flag. * nih_dbus_proxy_connect() no longer has both a parent and proxy argument, it now only takes the proxy and is always a child of it. * NihDBusProxySignal no longer has connection, name or path members and instead has a proxy member from which the values can be found. * nih_dbus_proxy_new() will now begin tracking any name given, even if there is no lost_handler passed. This (and the above changes) allows signal handlers to compare the sender of a signal (which is always a unique name) against the owner of the associated proxy. * Attempting to read from a D-Bus property that is write-only, or attempting to write to a D-Bus property that is read-only will now return the DBUS_ERROR_ACCESS_DENIED error rather than DBUS_ERROR_UNKNOWN_METHOD. * An empty com.netsplit.Nih.Symbol annotation is no longer permitted for D-Bus interfaces. Instead use the new --default-interface option to nih-dbus-tool. * nih-dbus-tool now properly supports structures, including arrays of structures and arrays of dictionary entries. The default naming of the structure is derived from the method or signal name and argument or the property name; the default naming of the members is "item0".."itemN". Structure definitions appear in the generated header file. * nih-dbus-tool now generates prefix_interface_get_all() and prefix_interface_get_all_sync() methods for each interface, these get the values of all of the properties and store them in a PrefixInterfaceProperties structure defined in the header file. * A side-effect of the above is that it's no longer possible to name properties after C keywords. 0.3.0 2009-06-17 * The licence for libnih has been changed to MIT/X11. * The --enable-compiler-warnings configure option has been extended to add -Wextra, but turns off a few of the more extreme warnings * TEST_FILE_MATCH() added to allow matching of a line in a file against a wildcard string * NIH_MUST(), NIH_ZERO() and NIH_SHOULD() now expand to an expression with the value of the expression inside. This means that the code like the following is now valid: ret = NIH_SHOULD (some_function_call ()); if (ret < 0) ... This style is preferred to the previous way of doing it (set ret inside the macro call) and the code has been updated. * nih_option_parser() fixed to not eat an argument containing a lone dash. * nih_error_raise_again() renamed to nih_error_raise_error(). * Errors are no longer removed from the context when you call nih_error_get(), this means that to clear the error you must free it and it's now a bug to call nih_error_raise_error() to raise it again. * Unhandled errors now result in an assertion error, rather than a log message being emitted. This assertion will include the filename, line number and function name where the error was originally raised. The assertion may be generated on exit from the program. * nih_option_help() produces slightly different output if the bug reporting address is a URL. * GNU C Library v2.4 (or backported inotify support) is required * D-Bus object and proxy interface structure definitions have been moved to nih-dbus/dbus_interface.h, this file is still included by nih-dbus/dbus_object.h and nih-dbus/dbus_proxy.h so there may be no need to include it directly. * nih_dbus_proxy_new() has additional arguments, a lost handler function which enables tracking of the owner of the well-known name, and a data pointer. NihDBusProxy has a new owner member which contains this. * Signals may be connected using nih_dbus_proxy_connect(), this requires both a handler function and an intermediate filter function. The NihDBusSignal structure gained a filter member to specify the latter. * The D-Bus binding tool has moved into a separate nih-dbus-tool subdirectory, and rewritten from Python to C. * The D-Bus binding tool now uses annotations rather than XML namespaced attributes to adjust the output: - set com.netsplit.Nih.Method.Async to "true" instead of using nih:object="async" - com.netsplit.Nih.Symbol may be used to override C symbol name generation - org.freedesktop.DBus.Deprecated results in a deprecated attribute on external API * Function names generated by the D-Bus binding tool now include the last element of the interface name; my_method() would now be named my_interface_method(). The interface name can be ommitted by setting the com.netsplit.Nih.Symbol annotation to "" * Proxy method functions are now asynchronous by default, the synchronous version has _sync() appended to its name. * Signal function names now always include "emit" in them. * Signal filter functions are generated by the binding tool for use with nih_dbus_proxy_connect() * Get and Set access functions are now generated for properties, and in object mode are expected to be provided. * Arrays of arrays are now fully supported; if the array is an array of basic types, the function will have two arguments; a NULL-terminated array of arrays, and a second NULL-terminated array of those array lengths. This is supported to infinite depths. * D-Bus 1.2.4 is now required. * pkg-config 0.22 is now required, it probably was anyway but we now explicitly check for it. * Dependency on Python for the D-Bus binding tool has been dropped and replaced with a dependency on expat 2.0.0 * The NIH_DBUS_ERROR and NIH_DBUS_INVALID_ARGS error enums have been moved to nih-dbus/errors.h 0.2.0 2009-01-29 * nih_alloc_set_allocator() is now a macro that casts the function to the right typedef, so such casts are no longer needed * nih_alloc() now permits multiple parent references - nih_ref(ptr, parent) creates a new parent reference - nih_unref(ptr, parent) drops a reference and frees if the last - nih_unref_only(ptr, parent) drops a reference without freeing - nih_free() unconditionally frees as it always has - nih_discard() only frees if there are no references * nih_local may be added to variable definitions to have the pointer automatically discarded when it goes out of scope, unless it is referenced in the meantime: { nih_local char *str = NULL; str = nih_strdup (NULL, "some string"); pass_to_func (str); } * nih_alloc_reparent() has been dropped, it can be replaced with an nih_unref_only()/nih_ref() pair - however many uses of this are no longer necessary and it's worth taking some time to refactor the code. * nih_alloc_parent() has changed; it now accepts both an object ptr and a parent and returns TRUE if the object has that parent, if parent is NULL is returns TRUE of the object has any parent. (previously it was used to return _the_ parent). * TEST_ALLOC_PARENT() now behaves as nih_alloc_parent(), which means testing for no parent with NULL has the exact opposite behaviour use the new TEST_ALLOC_ORPHAN(ptr) macro instead. * nih_str_array_addp() now references the passed pointer, instead of reparenting it. Calling code should be modified to make sure it either calls nih_discard() or uses nih_local to be safe in case of error. * nih_strv_free() has been dropped since it did not match the behaviour of the other functions * new NIH_LIST_ITER(iter, type, member) macro to handle the case of an offset head in an iterated structure * nih_hash_pointer_new(), nih_hash_pointer_key(), nih_hash_pointer_hash() and nih_hash_pointer_cmp() have been dropped since they did strange things to pointers that probably aren't legal C. * nih_config_parse() now reads the file into memory, instead of using mmap(). The API is unchanged, however the errors may be different. * The D-Bus bindings have been moved into a separate sub-directory and split out into multiple files. You will need to update your includes as follows: - NihDBusError and nih_dbus_error_*() are in nih-dbus/dbus_error.h - nih_dbus_connect(), nih_dbus_bus(), nih_dbus_setup() and nih_dbus_server() are in nih-dbus/dbus_connection.h - NihDBusMessage and nih_dbus_message_*() are in nih-dbus/dbus_message.h - NihDBusObject, NihDBusInterface and nih_dbus_object_new() are in nih-dbus/dbus_object.h - NihDBusProxy and nih_dbus_proxy_new() are in nih-dbus/dbus_proxy.h - nih_dbus_path() is now in nih-dbus/dbus_util.h * The D-Bus test macros are now in nih-dbus/test_dbus.h * nih_dbus_message_new() now exists as a function in its own right * Asynchronous method callbacks must take a reference to the NihDBusMessage object they are passed, otherwise it will be freed * Reply functions and nih_dbus_message_error() no longer free the message passed in, this is consistent with the above change. * libtool 2.2.4 is now required * The MIN() and MAX() macros are no longer defined, instead use nih_min() and nih_max() which do not re-evaluate their parameters multiple times. * The nih_main_package_string() function has been dropped, instead just access the package_string global set by nih_main_init_full() 0.1.0 2008-10-24 * Initial public release. |