redjack/libcork — pull request #76 by dcreager (2013-12-09 15:18:45+00:00)
Title: Fixed iteration order in hash tables

When iterating through a hash table (whether explicitly via a `cork_hash_table_iterator`, or autoatically via `cork_hash_table_map`), we now guarantee that the elements will be processed in the same order that they were added to the hash table.

To support this, we need an additional doubly-linked list to keep track of the insertion order. This requires adding fields to the `cork_hash_table` type. So, I'm taking this opportunity to make that type completely opaque. That means that this will be a backwards-incompatible change; all code that still embeds a copy of `cork_hash_table`, and uses `cork_hash_table_init` to initialize it, will need to be updated to use `cork_hash_table_new` instead.

Finally, at the same time, I've made a couple of other backwards-incompatible changes to make the hash table API more consistent with our current best practices. First, the hashing and comparison functions now take in a `user_data` parameter, just like any other callback. Second, the signature of the `cork_hash_table_map`, and its `map` callback, have been reordered so that `user_data` comes first.