libgit2/libgit2 — pull request #2575 by cirosantilli (2014-09-18 11:22:56+00:00)
Title: Join typedef and struct definitions in single file.

It was already the dominant style by far (70:14), so I converted the missing ones. It is DRYer (only use the name type 2 times instead of 3), and removes the question: "should I typedef before or after the struct definition?".

The related question on my mind is: should we use `typedef struct {} S` or or `typedef struct S {} S`?

Both styles have about an equal number of occurrences on the codebase, but on the public includes there are 3x more `typedef struct S {} S`.

I think `typedef struct {} S` is better because:

- makes it impossible to use `struct S` and forces use of just `S`. So we decide to someday transform a struct into, say, an int, no problem.

- DRYer: write the identifier only once instead of twice.

The only problem is that it is a backwards incompatible change if someone used `struct S` from the outside... but they shouldn't have in the first place!

We should also clarify which one to use on the CONVENTIONS.