Maybe move`facet` to the for loop setup?

```C
for(int i = 0, stl_facet *facet = NULL; kl_shift(stl_facet, facets, &facet) != -1; i++) {
```

Or does that offend you?