diff --git a/src/params/context_params.cpp b/src/params/context_params.cpp index 80dac3c72..03f49c028 100644 --- a/src/params/context_params.cpp +++ b/src/params/context_params.cpp @@ -40,18 +40,11 @@ void context_params::set_bool(bool & opt, char const * param, char const * value } void context_params::set_uint(unsigned & opt, char const * param, char const * value) { - bool is_uint = true; - size_t sz = strlen(value); - for (unsigned i = 0; i < sz; i++) { - if (!(value[i] >= '0' && value[i] <= '9')) - is_uint = false; - } + char *endptr; + long val = strtol(value, &endptr, 10); + opt = static_cast(val); - if (is_uint) { - long val = strtol(value, nullptr, 10); - opt = static_cast(val); - } - else { + if (!*value || *endptr) { std::stringstream strm; strm << "invalid value '" << value << "' for unsigned int parameter '" << param << "'"; throw default_exception(strm.str()); diff --git a/src/params/context_params.h b/src/params/context_params.h index 37ff44480..b4c6e914c 100644 --- a/src/params/context_params.h +++ b/src/params/context_params.h @@ -28,19 +28,19 @@ class context_params { unsigned m_rlimit { 0 }; public: + unsigned m_timeout { UINT_MAX } ; + std::string m_dot_proof_file; + std::string m_trace_file_name; bool m_auto_config { true }; bool m_proof { false }; - std::string m_dot_proof_file; bool m_debug_ref_count { false }; bool m_trace { false }; - std::string m_trace_file_name; bool m_well_sorted_check { false }; bool m_model { true }; bool m_model_validate { false }; bool m_dump_models { false }; bool m_unsat_core { false }; bool m_smtlib2_compliant { false }; // it must be here because it enable/disable the use of coercions in the ast_manager. - unsigned m_timeout { UINT_MAX } ; bool m_statistics { false }; bool m_unicode { true }; @@ -71,5 +71,3 @@ public: }; - -