Fix two bugs and use the more efficient !empty() vs size() > 0

These two bugs were found with a recent cppcheck addition. It also
changes one occurrence of size() > 0 for the more efficient ! empty().
This commit is contained in:
Cary R 2011-11-22 19:44:13 -08:00
parent 4c6a5bbd89
commit cc5efa45ba
3 changed files with 3 additions and 3 deletions

View File

@ -65,7 +65,7 @@ static int draw_stask_finish(vhdl_procedural *proc, stmt_container *container,
static char parse_octal(const char *p)
{
assert(*p && *(p+1) && *(p+2));
assert(isdigit(*p) && isdigit(*(p+1)) && isdigit(*(p+1)));
assert(isdigit(*p) && isdigit(*(p+1)) && isdigit(*(p+2)));
return (*p - '0') * 64
+ (*(p+1) - '0') * 8

View File

@ -3299,7 +3299,7 @@ static struct vector_info draw_unary_expr(ivl_expr_t expr, unsigned wid)
/* Handle special case that value is 0 or 1. */
if (res.base == 0 || res.base == 1)
break;
if (res.base == 2 || res.base == 2) {
if (res.base == 2 || res.base == 3) {
res.base = 0;
break;
}

View File

@ -136,7 +136,7 @@ int ComponentInstantiation::emit(ostream&out, Entity*ent, Architecture*arc)
int errors = 0;
out << cname_;
if (generic_map_.size() > 0) {
if (! generic_map_.empty()) {
out << " #(";
comma = "";
for (map<perm_string,Expression*>::iterator cur = generic_map_.begin()