URL: <http://gna.org/bugs/?13800>
Summary: [Patch] Hash table "copy constructor" and equality test Project: Freeciv Submitted by: mbook Submitted on: Sunday 06/28/2009 at 05:06 Category: general Severity: 3 - Normal Priority: 5 - Normal Status: Ready For Test Assigned to: mbook Originator Email: Open/Closed: Open Discussion Lock: Any Release: Operating System: None _______________________________________________________ Details: Attached patch adds functions: struct hash_table *hash_copy(const struct hash_table *h); bool hash_equal(const struct hash_table *a, const struct hash_table *b); for copying and testing equality of hash tables. The copy is a copy in the deep sense (i.e. new buckets are created), but element key and value pointers are just copied by value (i.e. elements are only shallow copied). Equality is satisfied if the pointer is the same, or both are not NULL, have the same fcmp fval, and free functions, have the same number of elements, and all element key/value pointers are equal in the order traversed by the hash iterator. ---------------------------------------------------------------- 平等が写しで保証される。 _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Sunday 06/28/2009 at 05:06 Name: hash_copy_equal.diff Size: 3kB By: mbook <http://gna.org/bugs/download.php?file_id=6065> _______________________________________________________ Reply to this item at: <http://gna.org/bugs/?13800> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev