Always initialize the variable p.
Add explicit braces to avoid dangling else clause.
Initialize the variable v.
Don't track TAGS.