• Alfred Klomp's avatar
    timing.c: avoid referencing garbage value · b308dd72
    Alfred Klomp authored
    Found with Clang's `scan-build` tool.
    When get_timer() is called with `reset` set to 1, the value of
    t->start.tv_sec is used as a rvalue without being initialized first.
    This is relatively harmless because the result of get_timer() is not
    used by the callers when called in "reset mode". However, scan-build
    prints a warning.
    Silence the warning by only calculating the delta on non-reset runs,
    returning zero otherwise.
timing.c 11.8 KB