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:
parent
4c6a5bbd89
commit
cc5efa45ba
|
|
@ -65,7 +65,7 @@ static int draw_stask_finish(vhdl_procedural *proc, stmt_container *container,
|
||||||
static char parse_octal(const char *p)
|
static char parse_octal(const char *p)
|
||||||
{
|
{
|
||||||
assert(*p && *(p+1) && *(p+2));
|
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
|
return (*p - '0') * 64
|
||||||
+ (*(p+1) - '0') * 8
|
+ (*(p+1) - '0') * 8
|
||||||
|
|
|
||||||
|
|
@ -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. */
|
/* Handle special case that value is 0 or 1. */
|
||||||
if (res.base == 0 || res.base == 1)
|
if (res.base == 0 || res.base == 1)
|
||||||
break;
|
break;
|
||||||
if (res.base == 2 || res.base == 2) {
|
if (res.base == 2 || res.base == 3) {
|
||||||
res.base = 0;
|
res.base = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ int ComponentInstantiation::emit(ostream&out, Entity*ent, Architecture*arc)
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
out << cname_;
|
out << cname_;
|
||||||
if (generic_map_.size() > 0) {
|
if (! generic_map_.empty()) {
|
||||||
out << " #(";
|
out << " #(";
|
||||||
comma = "";
|
comma = "";
|
||||||
for (map<perm_string,Expression*>::iterator cur = generic_map_.begin()
|
for (map<perm_string,Expression*>::iterator cur = generic_map_.begin()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue