Well, when you define functions like g, you have to make sure that they do not depend on the path you chose (think of it like testing for a normal function to be well-defined, ie. that two paths that join the same points do not give two different values).

the integrals over the two paths are the same because the sum of them is a closed curve, and since you have f holomorphic in a simply connected domain, Cauchy's theorem gives that the integral over the sum of paths is zero, hence they only differ in sign, but this is to be expected because you're going in opposite directions.