Skip to content

Commit b4139b5

Browse files
committed
Remove redundant string initialisation
Both std::string and dstringt are default-initialised to an empty string.
1 parent 11e7efd commit b4139b5

File tree

17 files changed

+17
-18
lines changed

17 files changed

+17
-18
lines changed

jbmc/src/java_bytecode/expr2java.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ std::string expr2javat::convert_rec(
276276
// so we make one up, loosely inspired by the syntax
277277
// of lambda expressions.
278278

279-
std::string dest="";
279+
std::string dest;
280280

281281
dest+='(';
282282
const java_method_typet::parameterst &parameters = method_type.parameters();

src/analyses/local_may_alias.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ void local_may_aliast::output(
458458
if(loc_info.aliases.find(j)==i)
459459
{
460460
assert(j<objects.size());
461-
irep_idt identifier = "";
461+
irep_idt identifier;
462462
if(objects[j].id() == ID_symbol)
463463
identifier = to_symbol_expr(objects[j]).get_identifier();
464464
out << ' ' << from_expr(ns, identifier, objects[j]);

src/cpp/cpp_typecheck_resolve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope(
879879
recursive=false;
880880
}
881881

882-
std::string final_base_name="";
882+
std::string final_base_name;
883883
template_args.make_nil();
884884

885885
while(pos!=cpp_name.get_sub().end())

src/goto-analyzer/show_on_source.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void print_with_indent(
5858
{
5959
const std::size_t p = indent_line.find_first_not_of(" \t");
6060
const std::string indent =
61-
p == std::string::npos ? std::string("") : std::string(indent_line, 0, p);
61+
p == std::string::npos ? std::string() : std::string(indent_line, 0, p);
6262
std::istringstream in(src);
6363
std::string src_line;
6464
while(std::getline(in, src_line))

src/goto-instrument/dot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void dott::write_dot_subgraph(
104104
if(it==instructions.end() ||
105105
seen.find(it)!=seen.end()) continue;
106106

107-
std::stringstream tmp("");
107+
std::stringstream tmp;
108108
if(it->is_goto())
109109
{
110110
if(it->guard.is_true())

src/goto-instrument/dump_c_class.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class dump_ct
7171

7272
explicit typedef_infot(const irep_idt &name):
7373
typedef_name(name),
74-
type_decl_str(""),
7574
early(false)
7675
{
7776
}

src/goto-instrument/goto_program2code.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ void goto_program2codet::cleanup_expr(exprt &expr, bool no_typecast)
18631863
// Replace by a function call to nondet_...
18641864
// We first search for a suitable one in the symbol table.
18651865

1866-
irep_idt id="";
1866+
irep_idt id;
18671867

18681868
for(symbol_tablet::symbolst::const_iterator
18691869
it=symbol_table.symbols.begin();
@@ -1887,7 +1887,7 @@ void goto_program2codet::cleanup_expr(exprt &expr, bool no_typecast)
18871887

18881888
if(id.empty())
18891889
{
1890-
irep_idt base_name="";
1890+
irep_idt base_name;
18911891

18921892
if(expr.type().get(ID_C_c_type)!="")
18931893
{

src/goto-programs/string_abstraction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ bool string_abstractiont::build_symbol(const symbol_exprt &sym, exprt &dest)
942942
const typet &abstract_type=build_abstraction_type(symbol.type);
943943
CHECK_RETURN(!abstract_type.is_nil());
944944

945-
irep_idt identifier="";
945+
irep_idt identifier;
946946

947947
if(current_args.find(symbol.name)!=current_args.end())
948948
identifier=id2string(symbol.name)+arg_suffix;

src/solvers/qbf/qbf_qube.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ propt::resultt qbf_qubet::prop_solve()
5555
write_qdimacs_cnf(out);
5656
}
5757

58-
std::string options="";
58+
std::string options;
5959

6060
// solve it
6161
int res=system(

src/solvers/qbf/qbf_qube_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ propt::resultt qbf_qube_coret::prop_solve()
5151
write_qdimacs_cnf(out);
5252
}
5353

54-
std::string options="";
54+
std::string options;
5555

5656
// solve it
5757
int res=system((

0 commit comments

Comments
 (0)