URL: <http://gna.org/patch/?2123>
Summary: Generic hash tables Project: Freeciv Submitted by: pepeto Submitted on: vendredi 29.10.2010 à 21:47 Category: general Priority: 5 - Normal Status: Ready For Test Privacy: Public Assigned to: pepeto Originator Email: Open/Closed: Open Discussion Lock: Any Planned Release: 2.3.0 _______________________________________________________ Details: New module to generate hash tables. It duplicates the current implementation, with slightly differences. ---- BUG FIXES: * The free callbacks are used only on data the user set. It was also calling them on unset data too int hash_replace() and hash_insert(). * When hash_insert() was failing, the data and keys generated by fc_strdup() were never freed and lost. Added copy callbacks, notably for string data or keys. * hash_lookup() was returning the internal key. If the user modify it, then it will break the whole table, because the hash values may have changed. Now, the function returns the old keys only after usage. * hash_lookup_data() was unable to handle the NULL data. * hash_copy() was not safe if the table was created with free callbacks. The addition of copy callbacks fixes it. ---- FEATURES: * Removed the DELETED_BUCKET handling, as it was not working anymore and it's a poor design. The user shouldn't be able to access deleted data. * Removed the function hash_equal, because it is very unclear about how it would compare data, callbacks, etc. And it was not used anywhere. * Removed the concept of hash_key_by_number() and hash_value_by_number(). If we use hash tables, it's not to slow down doing square linear researches into vectors. * Updated and clarified interface. * Updated documentation and comment. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: vendredi 29.10.2010 à 21:47 Name: 0001-Added-generic-hash-table-module-genhash.patch Size: 40 ko By: pepeto <http://gna.org/patch/download.php?file_id=10992> _______________________________________________________ Reply to this item at: <http://gna.org/patch/?2123> _______________________________________________ Message posté via/par Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev