Move mod calculations to a separate helper

We use mod calculations on multiple places, so make a separate helper
from it with proper types.

The "clumsiness" of defining a local variable to pass into the function
and out from it comes from the discrepancies in how c and c++ handles
initializations of variables in a struct.

Thanks goes to Tiago and Linus for pointing me in the right direction.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Add a travis.yml to test a build.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Use new fancy build on both linux and osx thing.
Move to track libgit2 git

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Test new way to run travis builds

Signed-off-by: Anton Lundin <glance@acc.umu.se>