diff --git a/ml.cpp b/ml.cpp index 7419c84..084ec26 100644 --- a/ml.cpp +++ b/ml.cpp @@ -104,7 +104,7 @@ std::string read_file_contents(const std::string &filename) { #define to_string(x) static_cast((std::ostringstream() << std::dec << x )).str() // Replace a substring with a replacement string in a source string -void replace_substring(std::string &src, std::string substr, std::string replacement) { +void replace_substring(std::string &src, const std::string& substr, const std::string &replacement) { size_t i = 0; for (i = src.find(substr, i); i != std::string::npos; i = src.find(substr, i)) { src.replace(i, substr.size(), replacement); @@ -148,7 +148,7 @@ MlValue::MlValue(double f) : type(FLOAT) { stack_data.f = f; } MlValue::MlValue(const std::vector &list) : type(LIST), list(list) {} -MlValue MlValue::quote(MlValue quoted) { +MlValue MlValue::quote(const MlValue "ed) { MlValue result; result.type = QUOTE; diff --git a/ml.h b/ml.h index 1e7f842..e5d8036 100644 --- a/ml.h +++ b/ml.h @@ -89,7 +89,7 @@ typedef MlValue (*Builtin)(std::vector, MlEnvironment &); MlValue(const std::vector &list); // Construct a quoted value - static MlValue quote(MlValue quoted); + static MlValue quote(const MlValue& quoted); // Construct an atom static MlValue atom(const std::string &s);