Removed "redefinition of typedef" build errors

While compiling libqgit2 project I found a bunch of "redefinition of typedef" build errors (gcc version 4.7.3), similar to that in #355.

I basically implemented the following idiom, which is used many times in this library: non-recursive structs are defined as

``` c
typedef struct NAME_t {
    [...]
} NAME;
```

while recursive structs are defined as

``` c
typedef struct NAME_t NAME;
struct NAME_t {
    [...]
    NAME var;
    [...]
};
```

Most of the time the C pattern is the contrary (NAME_t is the type and NAME is the struct name), but such a change would have involved too much code, and I did not want to be so invasive. There are also come structs that are not defined as types; I left them unchanged for the same reason.

The code compiles and tests work. However, changes have been tested only on Linux, I cannot compile on other platforms.