mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	reorder fields of context_params to save memory
plus improve error checking in context_params::set_uint
This commit is contained in:
		
							parent
							
								
									49906a5a58
								
							
						
					
					
						commit
						524dcd35f9
					
				
					 2 changed files with 7 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -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<unsigned>(val);
 | 
			
		||||
 | 
			
		||||
    if (is_uint) {
 | 
			
		||||
        long val = strtol(value, nullptr, 10);
 | 
			
		||||
        opt = static_cast<unsigned>(val);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
    if (!*value || *endptr) {
 | 
			
		||||
        std::stringstream strm;
 | 
			
		||||
        strm << "invalid value '" << value << "' for unsigned int parameter '" << param << "'";
 | 
			
		||||
        throw default_exception(strm.str());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue