The importing_count is of type int, thus it can go underflow and
assert(importing_count) can still return false positive while it
should not supposed to do so.
Also this can make the assert itself more sensitive, e.g., can
catch underflow errors.
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
++importing_count;
}
void dec_importing() {
- assert(importing_count);
+ assert(importing_count > 0);
--importing_count;
}
bool is_importing() { return importing_count > 0; }