Merge remote-tracking branch 'upstream/master'

Re-add last reverted patch "Use if/else instead of goto".