regex: Fixed several warnings about signed/unsigned conversions.
regex: Fixed warnings about unused parameter values.

There are different solutions to the problem. In this change, we
define an UNUSED macro that maps to __attribute__((unused)) when
compiling with gcc. Otherwise it is a NOOP. We apply this macro
in all function headers for each parameter value that is not used
within the function body.

The change is local to regex.
refspec: prevent git_refspec__free() from segfaulting

Fix libgit2/libgit2sharp#247
tests: plug a couple of leaks
pack: introduce a delta base cache

Many delta bases are re-used. Cache them to avoid inflating the same
data repeatedly.

This version doesn't limit the amount of entries to store, so it can
end up using a considerable amound of memory.
pack: refcount entries and add a mutex around cache access
Merge pull request #1226 from nulltoken/fix/refspec_free

refspec: prevent git_refspec__free() from segfaulting
pack: abstract out the cache into its own functions
pack: limit the amount of memory the base delta cache can use

Currently limited to 16MB (like git) and to objects up to 1MB in
size.
pack: packfile_free -> git_packfile_free and use it in the indexers

It turns out the indexers have been ignoring the pack's free function
and leaking data. Plug that.
Merge pull request #1224 from sba1/some-regex-warning-fixes

Some regex warning fixes
Merge pull request #1228 from carlosmn/delta-base

Introduce a delta base cache
regex: Proper define for this thing
pack: That declaration