CERT.STATIC.SINGLE.USE

File scope static variable is only accessed in one function.

Prevention

An object with internal linkage that is only referenced in one function could be defined at block scope to reduce visibility and improve maintainability.

Vulnerable code example

static int g_FireCount; void fire() { g_FireCount++; }

If g_FireCount is only accessed in fire() it can be defined at block scope