restricting scope of variable per cppcheck