libgit2/libgit2 — pull request #1463 by arrbee (2013-04-11 21:29:15+00:00)
Title: Add callbacks for object free/parse

This adds a "free" callback to all `git_cached_obj` which allows us to remove a couple of switch statements in the code (since each object now knows how to free itself), plus it adds the free and parse/parse_buffer callbacks to the `git_objects_table` object type definitions to eliminate other switches. All in all, this allowed the removal of a number of functions across the code.

@vmg I'm not sure if you'd want to merge this or not. It removes a bunch of code, but I can understand that you might not like the direction I took this in. It wasn't a ton of work, so I won't be disappointed if we discard it.

Also, I moved both the `free` functionality and `parse` and `parse_buffer` into callbacks. Frankly, we get 80% of the benefit of this code just from the change to `free`, so I can drop the `parse` stuff if you don't care for it.

If you do want to merge this, let's merge it before #1461 because it conflicts with that PR (and removes many of the lines of code that that PR was even modifying).