Avoid strcmp as it is buggy when using compiler optimisation.