updated C extension accordingly

I have updated the C extension with the changes made in pull request (fabpot/Twig/#878). All test cases pass.

I'm not a C guru so it may be wise if the experts on the matter could review the changes.