@@ -250,9 +250,9 @@ string value_t::getstr() const
250250 return boost::get<string>(val);
251251}
252252
253- value_t eval (expr); // forward declaration
253+ value_t eval (const expr& ); // forward declaration
254254
255- value_t getvar (expr var, int use_preset = 0 )
255+ value_t getvar (const expr& var, int use_preset = 0 )
256256{
257257 // Construct index array. The cast to mpz_class automatically
258258 // verifies that the index value is of type mpz_class.
@@ -277,7 +277,7 @@ value_t getvar(expr var, int use_preset = 0)
277277 exit (exit_failure);
278278}
279279
280- void setvar (expr var, value_t val, int use_preset = 0 )
280+ void setvar (const expr& var, value_t val, int use_preset = 0 )
281281{
282282 // Construct index array. The cast to mpz_class automatically
283283 // verifies that the index value is of type mpz_class.
@@ -302,22 +302,22 @@ void setvar(expr var, value_t val, int use_preset = 0)
302302 (*revlist)[var][val].insert (ind);
303303}
304304
305- void setvars (vector<parse_t > varlist, int use_preset = 0 )
305+ void setvars (const vector<parse_t >& varlist, int use_preset = 0 )
306306{
307307 for (size_t i=0 ; i<varlist.size (); i++) {
308308 setvar (varlist[i].args [0 ],eval (varlist[i].args [1 ]),use_preset);
309309 }
310310}
311311
312- void unsetvars (args_t varlist)
312+ void unsetvars (const args_t & varlist)
313313{
314314 for (size_t i=0 ; i<varlist.size (); i++) {
315315 variable.erase (varlist[i].val );
316316 rev_variable.erase (varlist[i].val );
317317 }
318318}
319319
320- value_t value (expr x)
320+ value_t value (const expr& x)
321321{
322322 debug (" value '%s'" ,x.val .c_str ());
323323
@@ -477,7 +477,7 @@ value_t evalfun(args_t funargs)
477477 exit (exit_failure);
478478}
479479
480- value_t eval (expr e)
480+ value_t eval (const expr& e)
481481{
482482 debug (" eval op='%c', val='%s', #args=%d" ,e.op ,e.val .c_str (),(int )e.args .size ());
483483 switch ( e.op ) {
@@ -500,7 +500,7 @@ value_t eval(expr e)
500500 }
501501}
502502
503- bool compare (expr cmp)
503+ bool compare (const expr& cmp)
504504{
505505 string op = cmp.val ;
506506 value_t l = eval (cmp.args [0 ]);
@@ -518,7 +518,7 @@ bool compare(expr cmp)
518518 exit (exit_failure);
519519}
520520
521- bool unique (args_t varlist)
521+ bool unique (const args_t & varlist)
522522{
523523 debug (" unique, #args=%d" ,(int )varlist.size ());
524524
@@ -585,7 +585,7 @@ bool unique(args_t varlist)
585585 return true ;
586586}
587587
588- bool inarray (expr e, expr array)
588+ bool inarray (const expr& e, const expr& array)
589589{
590590 string var = array.val ;
591591 value_t val = eval (e);
@@ -601,7 +601,7 @@ bool inarray(expr e, expr array)
601601 return rev_variable[var].count (val) && rev_variable[var][val].size ()>0 ;
602602}
603603
604- bool dotest (test t)
604+ bool dotest (const test& t)
605605{
606606 debug (" test op='%c', #args=%d" ,t.op ,(int )t.args .size ());
607607 switch ( t.op ) {
@@ -836,7 +836,7 @@ string genregex(string exp)
836836}
837837
838838// Parse {min,max}decimals in FLOATP command.
839- void getdecrange (command cmd, int *decrange)
839+ void getdecrange (const command& cmd, int *decrange)
840840{
841841 // Read {min,max}decimals range for float.
842842 for (int i=0 ; i<2 ; i++) {
@@ -960,7 +960,7 @@ void gentoken(command cmd, ostream &datastream)
960960 }
961961}
962962
963- void checktoken (command cmd)
963+ void checktoken (const command& cmd)
964964{
965965 currcmd = cmd;
966966 debug (" checking token %s at %lu,%lu" ,
@@ -986,7 +986,9 @@ void checktoken(command cmd)
986986 mpz_class hi = eval (cmd.args [1 ]);
987987
988988// debug("%s <= %s <= %s",lo.get_str().c_str(),num.c_str(),hi.get_str().c_str());
989- if ( cmd.nargs ()>=3 ) debug (" '%s' = '%s'" ,cmd.args [2 ].c_str (),num.c_str ());
989+ if ( cmd.nargs ()>=3 ) debug (" '%s' = '%s'" ,
990+ const_cast <char *>(cmd.args [2 ].c_str ()),
991+ const_cast <char *>(num.c_str ()));
990992
991993 if ( num.size ()==0 ) error ();
992994 if ( num.size ()>=2 && num[0 ]==' 0' ) error (" prefix zero(s)" );
0 commit comments