3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Use nullptr.

This commit is contained in:
Bruce Mitchener 2018-02-12 14:05:55 +07:00
parent f01328c65f
commit 76eb7b9ede
625 changed files with 4639 additions and 4639 deletions

View file

@ -74,7 +74,7 @@ public:
typedef T * iterator;
typedef const T * const_iterator;
array():m_data(0) {}
array():m_data(nullptr) {}
/**
\brief Store the array in the given chunk of memory (mem).
@ -123,7 +123,7 @@ public:
if (CallDestructors)
destroy_elements();
a.deallocate(space(size()), raw_ptr());
m_data = 0;
m_data = nullptr;
}
}
@ -148,7 +148,7 @@ public:
}
unsigned size() const {
if (m_data == 0) {
if (m_data == nullptr) {
return 0;
}
return static_cast<unsigned>(reinterpret_cast<size_t *>(m_data)[SIZE_IDX]);

View file

@ -62,7 +62,7 @@ public:
bit_vector():
m_num_bits(0),
m_capacity(0),
m_data(0) {
m_data(nullptr) {
}
bit_vector(unsigned reserve_num_bits) :
@ -75,7 +75,7 @@ public:
bit_vector(bit_vector const & source):
m_num_bits(source.m_num_bits),
m_capacity(source.m_capacity),
m_data(0) {
m_data(nullptr) {
if (source.m_data) {
m_data = alloc_svect(unsigned, m_capacity);
memcpy(m_data, source.m_data, m_capacity * sizeof(unsigned));

View file

@ -106,13 +106,13 @@ protected:
SASSERT(target_it < target + target_slots);
if (target_it->is_free()) {
target_it->m_data = list_it->m_data;
target_it->m_next = 0;
target_it->m_next = nullptr;
used_slots++;
}
else {
SASSERT((get_hash(target_it->m_data) & target_mask) == idx);
if (target_cellar == target_end)
return 0; // the cellar is too small...
return nullptr; // the cellar is too small...
SASSERT(target_cellar >= target + target_slots);
SASSERT(target_cellar < target_end);
*target_cellar = *target_it;
@ -123,7 +123,7 @@ protected:
SASSERT(!target_it->is_free());
list_it = list_it->m_next;
}
while (list_it != 0);
while (list_it != nullptr);
}
}
#if 0
@ -164,13 +164,13 @@ protected:
cell * next_cell = copy_table(m_table, m_slots, m_capacity,
new_table, new_slots, new_capacity,
m_used_slots);
if (next_cell != 0) {
if (next_cell != nullptr) {
delete_table();
m_table = new_table;
m_capacity = new_capacity;
m_slots = new_slots;
m_next_cell = next_cell;
m_free_cell = 0;
m_free_cell = nullptr;
CASSERT("chashtable", check_invariant());
return;
}
@ -180,11 +180,11 @@ protected:
}
bool has_free_cells() const {
return m_free_cell != 0 || m_next_cell < m_table + m_capacity;
return m_free_cell != nullptr || m_next_cell < m_table + m_capacity;
}
cell * get_free_cell() {
if (m_free_cell != 0) {
if (m_free_cell != nullptr) {
cell * c = m_free_cell;
m_free_cell = c->m_next;
return c;
@ -211,7 +211,7 @@ protected:
m_used_slots = 0;
m_size = 0;
m_next_cell = m_table + slots;
m_free_cell = 0;
m_free_cell = nullptr;
}
public:
@ -281,7 +281,7 @@ public:
m_size++;
m_used_slots++;
c->m_data = d;
c->m_next = 0;
c->m_next = nullptr;
CASSERT("chashtable_bug", check_invariant());
return;
}
@ -297,7 +297,7 @@ public:
CHS_CODE(m_collisions++;);
it = it->m_next;
}
while (it != 0);
while (it != nullptr);
// d is not in the table.
m_size++;
cell * new_c = get_free_cell();
@ -320,7 +320,7 @@ public:
m_size++;
m_used_slots++;
c->m_data = d;
c->m_next = 0;
c->m_next = nullptr;
CASSERT("chashtable_bug", check_invariant());
return c->m_data;
}
@ -335,7 +335,7 @@ public:
CHS_CODE(m_collisions++;);
it = it->m_next;
}
while (it != 0);
while (it != nullptr);
// d is not in the table.
m_size++;
cell * new_c = get_free_cell();
@ -358,7 +358,7 @@ public:
m_size++;
m_used_slots++;
c->m_data = d;
c->m_next = 0;
c->m_next = nullptr;
CASSERT("chashtable_bug", check_invariant());
return true;
}
@ -373,7 +373,7 @@ public:
CHS_CODE(m_collisions++;);
it = it->m_next;
}
while (it != 0);
while (it != nullptr);
// d is not in the table.
m_size++;
cell * new_c = get_free_cell();
@ -399,7 +399,7 @@ public:
CHS_CODE(const_cast<chashtable*>(this)->m_collisions++;);
c = c->m_next;
}
while (c != 0);
while (c != nullptr);
return false;
}
@ -409,7 +409,7 @@ public:
unsigned idx = h & mask;
cell * c = m_table + idx;
if (c->is_free())
return 0;
return nullptr;
do {
if (equals(c->m_data, d)) {
return &(c->m_data);
@ -417,8 +417,8 @@ public:
CHS_CODE(const_cast<chashtable*>(this)->m_collisions++;);
c = c->m_next;
}
while (c != 0);
return 0;
while (c != nullptr);
return nullptr;
}
bool find(T const & d, T & r) {
@ -436,7 +436,7 @@ public:
CHS_CODE(const_cast<chashtable*>(this)->m_collisions++;);
c = c->m_next;
}
while (c != 0);
while (c != nullptr);
return false;
}
@ -447,13 +447,13 @@ public:
cell * c = m_table + idx;
if (c->is_free())
return;
cell * prev = 0;
cell * prev = nullptr;
do {
if (equals(c->m_data, d)) {
m_size--;
if (prev == 0) {
if (prev == nullptr) {
cell * next = c->m_next;
if (next == 0) {
if (next == nullptr) {
m_used_slots--;
c->mark_free();
SASSERT(c->is_free());
@ -474,7 +474,7 @@ public:
prev = c;
c = c->m_next;
}
while (c != 0);
while (c != nullptr);
}
class iterator {
@ -490,12 +490,12 @@ public:
}
m_it++;
}
m_list_it = 0;
m_list_it = nullptr;
}
public:
iterator(cell * start, cell * end): m_it(start), m_end(end) { move_to_used(); }
iterator():m_it(0), m_end(0), m_list_it(0) {}
iterator():m_it(nullptr), m_end(nullptr), m_list_it(nullptr) {}
T & operator*() {
return m_list_it->m_data;
}
@ -506,7 +506,7 @@ public:
T * operator->() { return &(operator*()); }
iterator & operator++() {
m_list_it = m_list_it->m_next;
if (m_list_it == 0) {
if (m_list_it == nullptr) {
m_it++;
move_to_used();
}
@ -658,7 +658,7 @@ public:
bool find(Key const & k, Value & v) const {
key_value * e = m_table.find_core(key_value(k));
if (e == 0)
if (e == nullptr)
return false;
v = e->m_value;
return true;

View file

@ -91,8 +91,8 @@ public:
virtual void reset(cmd_context & ctx) {}
virtual void finalize(cmd_context & ctx) {}
virtual symbol get_name() const { return m_name; }
virtual char const * get_usage() const { return 0; }
virtual char const * get_descr(cmd_context & ctx) const { return 0; }
virtual char const * get_usage() const { return nullptr; }
virtual char const * get_descr(cmd_context & ctx) const { return nullptr; }
virtual unsigned get_arity() const { return 0; }
// command invocation

View file

@ -28,7 +28,7 @@ struct cooperation_lock {
cooperation_lock() {
omp_set_nested(1);
omp_init_nest_lock(&m_lock);
m_task = 0;
m_task = nullptr;
m_owner_thread = -1;
}
~cooperation_lock() {

View file

@ -41,7 +41,7 @@ void notify_assertion_violation(const char * fileName, int line, const char * co
std::cerr << condition << "\n";
}
static str_hashtable* g_enabled_debug_tags = 0;
static str_hashtable* g_enabled_debug_tags = nullptr;
static void init_debug_table() {
if (!g_enabled_debug_tags) {
@ -51,7 +51,7 @@ static void init_debug_table() {
void finalize_debug() {
dealloc(g_enabled_debug_tags);
g_enabled_debug_tags = 0;
g_enabled_debug_tags = nullptr;
}
void enable_debug(const char * tag) {
@ -72,7 +72,7 @@ bool is_debug_enabled(const char * tag) {
#ifndef _WINDOWS
void invoke_gdb() {
char buffer[1024];
int * x = 0;
int * x = nullptr;
for (;;) {
std::cerr << "(C)ontinue, (A)bort, (S)top, (T)hrow exception, Invoke (G)DB\n";
char result;
@ -103,7 +103,7 @@ void invoke_gdb() {
else {
std::cerr << "error starting GDB...\n";
// forcing seg fault.
int * x = 0;
int * x = nullptr;
*x = 0;
}
return;

View file

@ -138,7 +138,7 @@ public:
}
dependency * mk_empty() {
return 0;
return nullptr;
}
dependency * mk_leaf(value const & v) {
@ -148,10 +148,10 @@ public:
}
dependency * mk_join(dependency * d1, dependency * d2) {
if (d1 == 0) {
if (d1 == nullptr) {
return d2;
}
else if (d2 == 0) {
else if (d2 == nullptr) {
return d1;
}
else if (d1 == d2) {

View file

@ -21,12 +21,12 @@ Revision History:
#include <cstring>
inline char const * get_extension(char const * file_name) {
if (file_name == 0)
return 0;
char const * last_dot = 0;
if (file_name == nullptr)
return nullptr;
char const * last_dot = nullptr;
for (;;) {
char const * tmp = strchr(file_name, '.');
if (tmp == 0) {
if (tmp == nullptr) {
return last_dot;
}
last_dot = tmp + 1;

View file

@ -23,7 +23,7 @@ Notes:
extern void gparams_register_modules();
static char const * g_old_params_names[] = {
"arith_adaptive","arith_adaptive_assertion_threshold","arith_adaptive_gcd","arith_adaptive_propagation_threshold","arith_add_binary_bounds","arith_blands_rule_threshold","arith_branch_cut_ratio","arith_dump_lemmas","arith_eager_eq_axioms","arith_eager_gcd","arith_eq_bounds","arith_euclidean_solver","arith_expand_eqs","arith_force_simplex","arith_gcd_test","arith_ignore_int","arith_lazy_adapter","arith_lazy_pivoting","arith_max_lemma_size","arith_process_all_eqs","arith_propagate_eqs","arith_propagation_mode","arith_propagation_threshold","arith_prop_strategy","arith_random_initial_value","arith_random_lower","arith_random_seed","arith_random_upper","arith_reflect","arith_skip_big_coeffs","arith_small_lemma_size","arith_solver","arith_stronger_lemmas","array_always_prop_upward","array_canonize","array_cg","array_delay_exp_axiom","array_extensional","array_laziness","array_lazy_ieq","array_lazy_ieq_delay","array_solver","array_weak","async_commands","at_labels_cex","auto_config","bb_eager","bb_ext_gates","bb_quantifiers","bin_clauses","bit2int","bv2int_distribute","bv_blast_max_size","bv_cc","bv_enable_int2bv_propagation","bv_lazy_le","bv_max_sharing","bv_reflect","bv_solver","case_split","check_at_labels","check_proof","cnf_factor","cnf_mode","context_simplifier","dack","dack_eq","dack_factor","dack_gc","dack_gc_inv_decay","dack_threshold","default_qid","default_table","default_table_checked","delay_units","delay_units_threshold","der","display_config","display_dot_proof","display_error_for_visual_studio","display_features","display_proof","display_unsat_core","distribute_forall","dt_lazy_splits","dump_goal_as_smt","elim_and","elim_bounds","elim_nlarith_quantifiers","elim_quantifiers","elim_term_ite","ematching","engine","eq_propagation","hi_div0","ignore_bad_patterns","ignore_setparameter","instruction_max","inst_gen","interactive","internalizer_nnf","lemma_gc_factor","lemma_gc_half","lemma_gc_initial","lemma_gc_new_clause_activity","lemma_gc_new_clause_relevancy","lemma_gc_new_old_ratio","lemma_gc_old_clause_activity","lemma_gc_old_clause_relevancy","lemma_gc_strategy","lift_ite","lookahead_diseq","macro_finder","max_conflicts","max_counterexamples","mbqi","mbqi_force_template","mbqi_max_cexs","mbqi_max_cexs_incr","mbqi_max_iterations","mbqi_trace","minimize_lemmas","model","model_compact","model_completion","model_display_arg_sort","model_hide_unused_partitions","model_on_final_check","model_on_timeout","model_partial","model_v1","model_v2","model_validate","new_core2th_eq","ng_lift_ite","nl_arith","nl_arith_branching","nl_arith_gb","nl_arith_gb_eqs","nl_arith_gb_perturbate","nl_arith_gb_threshold","nl_arith_max_degree","nl_arith_rounds","nnf_factor","nnf_ignore_labels","nnf_mode","nnf_sk_hack","order","order_var_weight","order_weights","phase_selection","pi_arith","pi_arith_weight","pi_avoid_skolems","pi_block_looop_patterns","pi_max_multi_patterns","pi_non_nested_arith_weight","pi_nopat_weight","pi_pull_quantifiers","pi_use_database","pi_warnings","pp_bounded","pp_bv_literals","pp_bv_neg","pp_decimal","pp_decimal_precision","pp_fixed_indent","pp_flat_assoc","pp_max_depth","pp_max_indent","pp_max_num_lines","pp_max_ribbon","pp_max_width","pp_min_alias_size","pp_simplify_implies","pp_single_line","precedence","precedence_gen","pre_demodulator","pre_simplifier","pre_simplify_expr","profile_res_sub","progress_sampling_freq","proof_mode","propagate_booleans","propagate_values","pull_cheap_ite_trees","pull_nested_quantifiers","qi_conservative_final_check","qi_cost","qi_eager_threshold","qi_lazy_instantiation","qi_lazy_quick_checker","qi_lazy_threshold","qi_max_eager_multi_patterns","qi_max_instances","qi_max_lazy_multi_pattern_matching","qi_new_gen","qi_profile","qi_profile_freq","qi_promote_unsat","qi_quick_checker","quasi_macros","random_case_split_freq","random_initial_activity","random_seed","recent_lemma_threshold","reduce_args","refine_inj_axiom","relevancy","relevancy_lemma","rel_case_split_order","restart_adaptive","restart_agility_threshold","restart_factor","restart_initial","restart_strategy","restricted_quasi_macros","simplify_clauses","smtlib2_compliant","smtlib_category","smtlib_dump_lemmas","smtlib_logic","smtlib_source_info","smtlib_trace_path","soft_timeout","solver","spc_bs","spc_es","spc_factor_subsumption_index_opt","spc_initial_subsumption_index_opt","spc_max_subsumption_index_features","spc_min_func_freq_subsumption_index","spc_num_iterations","spc_trace","statistics","strong_context_simplifier","tick","trace","trace_file_name","type_check","user_theory_persist_axioms","user_theory_preprocess_axioms","verbose","warning","well_sorted_check","z3_solver_ll_pp","z3_solver_smt_pp", 0 };
"arith_adaptive","arith_adaptive_assertion_threshold","arith_adaptive_gcd","arith_adaptive_propagation_threshold","arith_add_binary_bounds","arith_blands_rule_threshold","arith_branch_cut_ratio","arith_dump_lemmas","arith_eager_eq_axioms","arith_eager_gcd","arith_eq_bounds","arith_euclidean_solver","arith_expand_eqs","arith_force_simplex","arith_gcd_test","arith_ignore_int","arith_lazy_adapter","arith_lazy_pivoting","arith_max_lemma_size","arith_process_all_eqs","arith_propagate_eqs","arith_propagation_mode","arith_propagation_threshold","arith_prop_strategy","arith_random_initial_value","arith_random_lower","arith_random_seed","arith_random_upper","arith_reflect","arith_skip_big_coeffs","arith_small_lemma_size","arith_solver","arith_stronger_lemmas","array_always_prop_upward","array_canonize","array_cg","array_delay_exp_axiom","array_extensional","array_laziness","array_lazy_ieq","array_lazy_ieq_delay","array_solver","array_weak","async_commands","at_labels_cex","auto_config","bb_eager","bb_ext_gates","bb_quantifiers","bin_clauses","bit2int","bv2int_distribute","bv_blast_max_size","bv_cc","bv_enable_int2bv_propagation","bv_lazy_le","bv_max_sharing","bv_reflect","bv_solver","case_split","check_at_labels","check_proof","cnf_factor","cnf_mode","context_simplifier","dack","dack_eq","dack_factor","dack_gc","dack_gc_inv_decay","dack_threshold","default_qid","default_table","default_table_checked","delay_units","delay_units_threshold","der","display_config","display_dot_proof","display_error_for_visual_studio","display_features","display_proof","display_unsat_core","distribute_forall","dt_lazy_splits","dump_goal_as_smt","elim_and","elim_bounds","elim_nlarith_quantifiers","elim_quantifiers","elim_term_ite","ematching","engine","eq_propagation","hi_div0","ignore_bad_patterns","ignore_setparameter","instruction_max","inst_gen","interactive","internalizer_nnf","lemma_gc_factor","lemma_gc_half","lemma_gc_initial","lemma_gc_new_clause_activity","lemma_gc_new_clause_relevancy","lemma_gc_new_old_ratio","lemma_gc_old_clause_activity","lemma_gc_old_clause_relevancy","lemma_gc_strategy","lift_ite","lookahead_diseq","macro_finder","max_conflicts","max_counterexamples","mbqi","mbqi_force_template","mbqi_max_cexs","mbqi_max_cexs_incr","mbqi_max_iterations","mbqi_trace","minimize_lemmas","model","model_compact","model_completion","model_display_arg_sort","model_hide_unused_partitions","model_on_final_check","model_on_timeout","model_partial","model_v1","model_v2","model_validate","new_core2th_eq","ng_lift_ite","nl_arith","nl_arith_branching","nl_arith_gb","nl_arith_gb_eqs","nl_arith_gb_perturbate","nl_arith_gb_threshold","nl_arith_max_degree","nl_arith_rounds","nnf_factor","nnf_ignore_labels","nnf_mode","nnf_sk_hack","order","order_var_weight","order_weights","phase_selection","pi_arith","pi_arith_weight","pi_avoid_skolems","pi_block_looop_patterns","pi_max_multi_patterns","pi_non_nested_arith_weight","pi_nopat_weight","pi_pull_quantifiers","pi_use_database","pi_warnings","pp_bounded","pp_bv_literals","pp_bv_neg","pp_decimal","pp_decimal_precision","pp_fixed_indent","pp_flat_assoc","pp_max_depth","pp_max_indent","pp_max_num_lines","pp_max_ribbon","pp_max_width","pp_min_alias_size","pp_simplify_implies","pp_single_line","precedence","precedence_gen","pre_demodulator","pre_simplifier","pre_simplify_expr","profile_res_sub","progress_sampling_freq","proof_mode","propagate_booleans","propagate_values","pull_cheap_ite_trees","pull_nested_quantifiers","qi_conservative_final_check","qi_cost","qi_eager_threshold","qi_lazy_instantiation","qi_lazy_quick_checker","qi_lazy_threshold","qi_max_eager_multi_patterns","qi_max_instances","qi_max_lazy_multi_pattern_matching","qi_new_gen","qi_profile","qi_profile_freq","qi_promote_unsat","qi_quick_checker","quasi_macros","random_case_split_freq","random_initial_activity","random_seed","recent_lemma_threshold","reduce_args","refine_inj_axiom","relevancy","relevancy_lemma","rel_case_split_order","restart_adaptive","restart_agility_threshold","restart_factor","restart_initial","restart_strategy","restricted_quasi_macros","simplify_clauses","smtlib2_compliant","smtlib_category","smtlib_dump_lemmas","smtlib_logic","smtlib_source_info","smtlib_trace_path","soft_timeout","solver","spc_bs","spc_es","spc_factor_subsumption_index_opt","spc_initial_subsumption_index_opt","spc_max_subsumption_index_features","spc_min_func_freq_subsumption_index","spc_num_iterations","spc_trace","statistics","strong_context_simplifier","tick","trace","trace_file_name","type_check","user_theory_persist_axioms","user_theory_preprocess_axioms","verbose","warning","well_sorted_check","z3_solver_ll_pp","z3_solver_smt_pp", nullptr };
bool is_old_param_name(symbol const & name) {
char const * const * it = g_old_params_names;
@ -64,7 +64,7 @@ static char const * g_params_renames[] = {
"pp_bv_neg", "pp.bv_neg",
"pp_max_depth", "pp.max_depth",
"pp_min_alias_size", "pp.min_alias_size",
0 };
nullptr };
char const * get_new_param_name(symbol const & p) {
char const * const * it = g_params_renames;
@ -75,7 +75,7 @@ char const * get_new_param_name(symbol const & p) {
}
it += 2;
}
return 0;
return nullptr;
}
struct gparams::imp {
@ -191,7 +191,7 @@ public:
return m_params;
}
else {
params_ref * p = 0;
params_ref * p = nullptr;
if (!m_module_params.find(mod_name, p)) {
p = alloc(params_ref);
m_module_params.insert(mod_name, p);
@ -279,7 +279,7 @@ public:
throw_unknown_parameter(param_name, d, mod_name);
}
else if (k == CPK_UINT) {
long val = strtol(value, 0, 10);
long val = strtol(value, nullptr, 10);
ps.set_uint(param_name, static_cast<unsigned>(val));
}
else if (k == CPK_DOUBLE) {
@ -374,7 +374,7 @@ public:
throw_unknown_parameter(p, d, m);
}
char const * r = d.get_default(p);
if (r == 0)
if (r == nullptr)
return "default";
return r;
}
@ -397,7 +397,7 @@ public:
}
}
else {
params_ref * ps = 0;
params_ref * ps = nullptr;
if (m_module_params.find(m, ps) && ps->contains(p)) {
r = get_value(*ps, p);
}
@ -427,7 +427,7 @@ public:
params_ref get_module(symbol const & module_name) {
params_ref result;
params_ref * ps = 0;
params_ref * ps = nullptr;
#pragma omp critical (gparams)
{
if (m_module_params.find(module_name, ps)) {
@ -468,7 +468,7 @@ public:
dictionary<param_descrs*>::iterator end = get_module_param_descrs().end();
for (; it != end; ++it) {
out << "[module] " << it->m_key;
char const * descr = 0;
char const * descr = nullptr;
if (get_module_descrs().find(it->m_key, descr)) {
out << ", description: " << descr;
}
@ -485,7 +485,7 @@ public:
dictionary<param_descrs*>::iterator end = get_module_param_descrs().end();
for (; it != end; ++it) {
out << "[module] " << it->m_key;
char const * descr = 0;
char const * descr = nullptr;
if (get_module_descrs().find(it->m_key, descr)) {
out << ", description: " << descr;
}
@ -500,14 +500,14 @@ public:
#pragma omp critical (gparams)
{
try {
param_descrs * d = 0;
param_descrs * d = nullptr;
if (!get_module_param_descrs().find(module_name, d)) {
std::stringstream strm;
strm << "unknown module '" << module_name << "'";
throw exception(strm.str());
}
out << "[module] " << module_name;
char const * descr = 0;
char const * descr = nullptr;
if (get_module_descrs().find(module_name, descr)) {
out << ", description: " << descr;
}
@ -566,7 +566,7 @@ public:
}
};
gparams::imp * gparams::g_imp = 0;
gparams::imp * gparams::g_imp = nullptr;
void gparams::reset() {
SASSERT(g_imp != 0);
@ -651,9 +651,9 @@ void gparams::init() {
void gparams::finalize() {
TRACE("gparams", tout << "gparams::finalize()\n";);
if (g_imp != 0) {
if (g_imp != nullptr) {
dealloc(g_imp);
g_imp = 0;
g_imp = nullptr;
}
}

View file

@ -91,9 +91,9 @@ class ptr_hash_entry {
T * m_ptr;
public:
typedef T * data;
ptr_hash_entry():m_ptr(0) {}
ptr_hash_entry():m_ptr(nullptr) {}
unsigned get_hash() const { return m_hash; }
bool is_free() const { return m_ptr == 0; }
bool is_free() const { return m_ptr == nullptr; }
bool is_deleted() const { return m_ptr == reinterpret_cast<T *>(1); }
bool is_used() const { return m_ptr != reinterpret_cast<T *>(0) && m_ptr != reinterpret_cast<T *>(1); }
T * get_data() const { return m_ptr; }
@ -101,7 +101,7 @@ public:
void set_data(T * d) { m_ptr = d; }
void set_hash(unsigned h) { m_hash = h; }
void mark_as_deleted() { m_ptr = reinterpret_cast<T *>(1); }
void mark_as_free() { m_ptr = 0; }
void mark_as_free() { m_ptr = nullptr; }
};
@ -114,9 +114,9 @@ class ptr_addr_hash_entry : public ptr_hash_entry<T> {
T * m_ptr;
public:
typedef T * data;
ptr_addr_hash_entry():m_ptr(0) {}
ptr_addr_hash_entry():m_ptr(nullptr) {}
unsigned get_hash() const { return get_ptr_hash(m_ptr); }
bool is_free() const { return m_ptr == 0; }
bool is_free() const { return m_ptr == nullptr; }
bool is_deleted() const { return m_ptr == reinterpret_cast<T *>(1); }
bool is_used() const { return m_ptr != reinterpret_cast<T *>(0) && m_ptr != reinterpret_cast<T *>(1); }
T * get_data() const { return m_ptr; }
@ -145,7 +145,7 @@ protected:
void delete_table() {
dealloc_vect(m_table, m_capacity);
m_table = 0;
m_table = nullptr;
}
public:
@ -385,7 +385,7 @@ public:
entry * begin = m_table + idx;
entry * end = m_table + m_capacity;
entry * curr = begin;
entry * del_entry = 0;
entry * del_entry = nullptr;
for (; curr != end; ++curr) {
INSERT_LOOP_BODY();
}
@ -441,7 +441,7 @@ public:
entry * begin = m_table + idx;
entry * end = m_table + m_capacity;
entry * curr = begin;
entry * del_entry = 0;
entry * del_entry = nullptr;
for (; curr != end; ++curr) {
INSERT_LOOP_CORE_BODY();
}
@ -504,12 +504,12 @@ public:
for (curr = m_table; curr != begin; ++curr) {
FIND_LOOP_BODY();
}
return 0;
return nullptr;
}
bool find(data const & k, data & r) const {
entry * e = find_core(k);
if (e != 0) {
if (e != nullptr) {
r = e->get_data();
return true;
}
@ -517,7 +517,7 @@ public:
}
bool contains(data const & e) const {
return find_core(e) != 0;
return find_core(e) != nullptr;
}
iterator find(data const & e) const {

View file

@ -28,7 +28,7 @@ class list {
list * m_tail;
public:
list(T const & h, list * t = 0):
list(T const & h, list * t = nullptr):
m_head(h),
m_tail(t) {
}
@ -73,7 +73,7 @@ unsigned length(list<T> * l) {
*/
template<typename T>
list<T> * append(region & r, list<T> * l1, list<T> * l2) {
if (l2 == 0) {
if (l2 == nullptr) {
return l1;
}
ptr_buffer<list<T> > buffer;

View file

@ -481,7 +481,7 @@ public:
}
bool no_r_lu() const {
return m_r_solver.m_factorization == nullptr || m_r_solver.m_factorization->get_status() == LU_status::Degenerated;
return m_r_solver.m_factorization == nullptr || m_r_solver.m_factorization->get_status() == LU_status::Degenerated;
}
void solve_on_signature_tableau(const lar_solution_signature & signature, const vector<unsigned> & changes_of_basis) {

View file

@ -129,7 +129,7 @@ public:
if (e) {
v = e->get_data().m_value;
}
return (0 != e);
return (nullptr != e);
}
value const& get(key const& k, value const& default_value) const {
@ -164,7 +164,7 @@ public:
bool contains(key const & k) const {
return find_core(k) != 0;
return find_core(k) != nullptr;
}
void remove(key const & k) {

View file

@ -342,7 +342,7 @@ void * memory::allocate(size_t s) {
if (counts_exceeded)
throw_alloc_counts_exceeded();
void * r = malloc(s);
if (r == 0)
if (r == nullptr)
throw_out_of_memory();
*(static_cast<size_t*>(r)) = s;
return static_cast<size_t*>(r) + 1; // we return a pointer to the location after the extra field
@ -370,7 +370,7 @@ void* memory::reallocate(void *p, size_t s) {
if (counts_exceeded)
throw_alloc_counts_exceeded();
void *r = realloc(real_p, s);
if (r == 0)
if (r == nullptr)
throw_out_of_memory();
*(static_cast<size_t*>(r)) = s;
return static_cast<size_t*>(r) + 1; // we return a pointer to the location after the extra field

View file

@ -90,7 +90,7 @@ void deallocf(char const* file, int line, T * ptr) {
template<typename T>
void dealloc(T * ptr) {
if (ptr == 0) return;
if (ptr == nullptr) return;
ptr->~T();
memory::deallocate(ptr);
}
@ -111,7 +111,7 @@ T * alloc_vect(unsigned sz) {
template<typename T>
void dealloc_vect(T * ptr, unsigned sz) {
if (ptr == 0) return;
if (ptr == nullptr) return;
T * curr = ptr;
for (unsigned i = 0; i < sz; i++, curr++)
curr->~T();
@ -122,7 +122,7 @@ void dealloc_vect(T * ptr, unsigned sz) {
template<typename T>
void dealloc_svect(T * ptr) {
if (ptr == 0) return;
if (ptr == nullptr) return;
memory::deallocate(ptr);
}

View file

@ -201,7 +201,7 @@ void mpfx_manager::set(mpfx & n, uint64 v) {
n.m_sign = 0;
unsigned * w = words(n);
uint64 * _vp = &v;
unsigned * _v = 0;
unsigned * _v = nullptr;
memcpy(&_v, &_vp, sizeof(unsigned*));
for (unsigned i = 0; i < m_total_sz; i++)
w[i] = 0;

View file

@ -92,9 +92,9 @@ class mpz {
friend class mpbq_manager;
mpz & operator=(mpz const & other) { UNREACHABLE(); return *this; }
public:
mpz(int v):m_val(v), m_ptr(0) {}
mpz():m_val(0), m_ptr(0) {}
mpz(mpz && other) : m_val(other.m_val), m_ptr(0) {
mpz(int v):m_val(v), m_ptr(nullptr) {}
mpz():m_val(0), m_ptr(nullptr) {}
mpz(mpz && other) : m_val(other.m_val), m_ptr(nullptr) {
std::swap(m_ptr, other.m_ptr);
}
void swap(mpz & other) {
@ -333,16 +333,16 @@ public:
~mpz_manager();
static bool is_small(mpz const & a) { return a.m_ptr == 0; }
static bool is_small(mpz const & a) { return a.m_ptr == nullptr; }
static mpz mk_z(int val) { return mpz(val); }
void del(mpz & a) {
if (a.m_ptr != 0) {
if (a.m_ptr != nullptr) {
MPZ_BEGIN_CRITICAL();
deallocate(a.m_ptr);
MPZ_END_CRITICAL();
a.m_ptr = 0;
a.m_ptr = nullptr;
}
}

View file

@ -33,9 +33,9 @@ class obj_hash_entry {
T * m_ptr;
public:
typedef T * data;
obj_hash_entry():m_ptr(0) {}
obj_hash_entry():m_ptr(nullptr) {}
unsigned get_hash() const { return m_ptr->hash(); }
bool is_free() const { return m_ptr == 0; }
bool is_free() const { return m_ptr == nullptr; }
bool is_deleted() const { return m_ptr == reinterpret_cast<T *>(1); }
bool is_used() const { return m_ptr != reinterpret_cast<T *>(0) && m_ptr != reinterpret_cast<T *>(1); }
T * get_data() const { return m_ptr; }
@ -43,7 +43,7 @@ public:
void set_data(T * d) { m_ptr = d; }
void set_hash(unsigned h) { SASSERT(h == m_ptr->hash()); }
void mark_as_deleted() { m_ptr = reinterpret_cast<T *>(1); }
void mark_as_free() { m_ptr = 0; }
void mark_as_free() { m_ptr = nullptr; }
};
template<typename T>
@ -60,7 +60,7 @@ public:
struct key_data {
Key * m_key;
Value m_value;
key_data():m_key(0) {
key_data():m_key(nullptr) {
}
key_data(Key * k):
m_key(k) {
@ -85,7 +85,7 @@ public:
typedef key_data data;
obj_map_entry() {}
unsigned get_hash() const { return m_data.hash(); }
bool is_free() const { return m_data.m_key == 0; }
bool is_free() const { return m_data.m_key == nullptr; }
bool is_deleted() const { return m_data.m_key == reinterpret_cast<Key *>(1); }
bool is_used() const { return m_data.m_key != reinterpret_cast<Key *>(0) && m_data.m_key != reinterpret_cast<Key *>(1); }
key_data const & get_data() const { return m_data; }
@ -93,7 +93,7 @@ public:
void set_data(key_data && d) { m_data = std::move(d); }
void set_hash(unsigned h) { SASSERT(h == m_data.hash()); }
void mark_as_deleted() { m_data.m_key = reinterpret_cast<Key *>(1); }
void mark_as_free() { m_data.m_key = 0; }
void mark_as_free() { m_data.m_key = nullptr; }
};
typedef core_hashtable<obj_map_entry, obj_hash<key_data>, default_eq<key_data> > table;
@ -163,7 +163,7 @@ public:
if (e) {
v = e->get_data().m_value;
}
return (0 != e);
return (nullptr != e);
}
value const & find(key * k) const {
@ -191,7 +191,7 @@ public:
}
bool contains(Key * k) const {
return find_core(k) != 0;
return find_core(k) != nullptr;
}
void remove(Key * k) {

View file

@ -34,7 +34,7 @@ class obj_pair_hash_entry {
public:
typedef std::pair<T1*, T2*> data;
obj_pair_hash_entry():m_data(static_cast<T1*>(0),static_cast<T2*>(0)) {}
obj_pair_hash_entry():m_data(static_cast<T1*>(nullptr),static_cast<T2*>(nullptr)) {}
unsigned get_hash() const { return m_hash; }
bool is_free() const { return m_data.first == 0; }
bool is_deleted() const { return m_data.first == reinterpret_cast<T1 *>(1); }
@ -68,8 +68,8 @@ public:
friend class entry;
public:
key_data():
m_key1(0),
m_key2(0),
m_key1(nullptr),
m_key2(nullptr),
m_hash(0) {
}
key_data(Key1 * k1, Key2 * k2):
@ -96,7 +96,7 @@ protected:
typedef key_data data;
entry() {}
unsigned get_hash() const { return m_data.hash(); }
bool is_free() const { return m_data.m_key1 == 0; }
bool is_free() const { return m_data.m_key1 == nullptr; }
bool is_deleted() const { return m_data.m_key1 == reinterpret_cast<Key1 *>(1); }
bool is_used() const { return m_data.m_key1 != reinterpret_cast<Key1 *>(0) && m_data.m_key1 != reinterpret_cast<Key1 *>(1); }
key_data const & get_data() const { return m_data; }
@ -104,7 +104,7 @@ protected:
void set_data(key_data const & d) { m_data = d; }
void set_hash(unsigned h) { SASSERT(h == m_data.hash()); }
void mark_as_deleted() { m_data.m_key1 = reinterpret_cast<Key1 *>(1); }
void mark_as_free() { m_data.m_key1 = 0; }
void mark_as_free() { m_data.m_key1 = nullptr; }
};
typedef core_hashtable<entry, obj_hash<key_data>, default_eq<key_data> > table;
@ -158,11 +158,11 @@ public:
if (e) {
v = e->get_data().get_value();
}
return (0 != e);
return (nullptr != e);
}
bool contains(Key1 * k1, Key2 * k2) const {
return find_core(k1, k2) != 0;
return find_core(k1, k2) != nullptr;
}
void erase(Key1 * k1, Key2 * k2) {

View file

@ -43,7 +43,7 @@ public:
}
explicit obj_ref(TManager & m):
m_obj(0),
m_obj(nullptr),
m_manager(m) {
}
@ -53,7 +53,7 @@ public:
inc_ref();
}
obj_ref(obj_ref && other) : m_obj(0), m_manager(other.m_manager) {
obj_ref(obj_ref && other) : m_obj(nullptr), m_manager(other.m_manager) {
std::swap(m_obj, other.m_obj);
}
@ -67,9 +67,9 @@ public:
T * get() const { return m_obj; }
operator bool() const { return m_obj != 0; }
operator bool() const { return m_obj != nullptr; }
bool operator!() const { return m_obj == 0; }
bool operator!() const { return m_obj == nullptr; }
operator T*() const { return m_obj; }
@ -94,7 +94,7 @@ public:
void reset() {
dec_ref();
m_obj = 0;
m_obj = nullptr;
}
void swap(obj_ref & n) {

View file

@ -70,9 +70,9 @@ public:
friend class entry;
public:
key_data():
m_key1(0),
m_key2(0),
m_key3(0),
m_key1(nullptr),
m_key2(nullptr),
m_key3(nullptr),
m_hash(0) {
}
key_data(Key1 * k1, Key2 * k2, Key3 * k3):
@ -102,7 +102,7 @@ protected:
typedef key_data data;
entry() {}
unsigned get_hash() const { return m_data.hash(); }
bool is_free() const { return m_data.m_key1 == 0; }
bool is_free() const { return m_data.m_key1 == nullptr; }
bool is_deleted() const { return m_data.m_key1 == reinterpret_cast<Key1 *>(1); }
bool is_used() const { return m_data.m_key1 != reinterpret_cast<Key1 *>(0) && m_data.m_key1 != reinterpret_cast<Key1 *>(1); }
key_data const & get_data() const { return m_data; }
@ -110,7 +110,7 @@ protected:
void set_data(key_data const & d) { m_data = d; }
void set_hash(unsigned h) { SASSERT(h == m_data.hash()); }
void mark_as_deleted() { m_data.m_key1 = reinterpret_cast<Key1 *>(1); }
void mark_as_free() { m_data.m_key1 = 0; }
void mark_as_free() { m_data.m_key1 = nullptr; }
};
typedef core_hashtable<entry, obj_hash<key_data>, default_eq<key_data> > table;
@ -164,7 +164,7 @@ public:
if (e) {
v = e->get_data().get_value();
}
return (0 != e);
return (nullptr != e);
}
bool contains(Key1 * k1, Key2 * k2, Key3 * k3) const {

View file

@ -34,14 +34,14 @@ class optional {
void destroy() {
if (m_initialized == 1) {
dealloc(m_obj);
m_obj = 0;
m_obj = nullptr;
}
m_initialized = 0;
}
public:
optional():
m_obj(0), m_initialized(0) {}
m_obj(nullptr), m_initialized(0) {}
explicit optional(const T & val) {
construct(val);
@ -128,7 +128,7 @@ class optional<T*> {
public:
optional():m_ptr(0) {}
optional():m_ptr(nullptr) {}
explicit optional(T * val):m_ptr(val) {}
@ -140,7 +140,7 @@ public:
operator bool() const { return m_ptr != 0; }
bool operator!() const { return m_ptr == 0; }
bool operator!() const { return m_ptr == nullptr; }
void reset() { m_ptr = 0; }

View file

@ -31,7 +31,7 @@ inline char * alloc_page(size_t s) { char * r = alloc_svect(char, s+PAGE_HEADER_
inline void del_page(char * page) { dealloc_svect(page - PAGE_HEADER_SZ); }
void del_pages(char * page) {
while (page != 0) {
while (page != nullptr) {
char * prev = prev_page(page);
del_page(page);
page = prev;

View file

@ -24,7 +24,7 @@ Notes:
params_ref params_ref::g_empty_params_ref;
std::string norm_param_name(char const * n) {
if (n == 0)
if (n == nullptr)
return "_";
if (*n == ':')
n++;
@ -62,9 +62,9 @@ struct param_descrs::imp {
info():
m_kind(CPK_INVALID),
m_descr(0),
m_default(0),
m_module(0) {
m_descr(nullptr),
m_default(nullptr),
m_module(nullptr) {
}
};
@ -130,21 +130,21 @@ struct param_descrs::imp {
info i;
if (m_info.find(name, i))
return i.m_module;
return 0;
return nullptr;
}
char const * get_descr(symbol const & name) const {
info i;
if (m_info.find(name, i))
return i.m_descr;
return 0;
return nullptr;
}
char const * get_default(symbol const & name) const {
info i;
if (m_info.find(name, i))
return i.m_default;
return 0;
return nullptr;
}
unsigned size() const {
@ -191,7 +191,7 @@ struct param_descrs::imp {
out << " (" << d.m_kind << ")";
if (include_descr)
out << " " << d.m_descr;
if (d.m_default != 0)
if (d.m_default != nullptr)
out << " (default: " << d.m_default << ")";
out << "\n";
}
@ -510,7 +510,7 @@ params_ref::~params_ref() {
}
params_ref::params_ref(params_ref const & p):
m_params(0) {
m_params(nullptr) {
operator=(p);
}
@ -554,7 +554,7 @@ params_ref & params_ref::operator=(params_ref const & p) {
}
void params_ref::copy(params_ref const & src) {
if (m_params == 0)
if (m_params == nullptr)
operator=(src);
else {
init();
@ -563,7 +563,7 @@ void params_ref::copy(params_ref const & src) {
}
void params_ref::copy_core(params const * src) {
if (src == 0)
if (src == nullptr)
return;
svector<params::entry>::const_iterator it = src->m_entries.begin();
svector<params::entry>::const_iterator end = src->m_entries.end();

View file

@ -37,7 +37,7 @@ class params_ref {
void init();
void copy_core(params const * p);
public:
params_ref():m_params(0) {}
params_ref():m_params(nullptr) {}
params_ref(params_ref const & p);
~params_ref();
@ -115,8 +115,8 @@ public:
param_descrs();
~param_descrs();
void copy(param_descrs & other);
void insert(char const * name, param_kind k, char const * descr, char const * def = 0, char const* module = 0);
void insert(symbol const & name, param_kind k, char const * descr, char const * def = 0, char const* module = 0);
void insert(char const * name, param_kind k, char const * descr, char const * def = nullptr, char const* module = nullptr);
void insert(symbol const & name, param_kind k, char const * descr, char const * def = nullptr, char const* module = nullptr);
bool contains(char const * name) const;
bool contains(symbol const & name) const;
void erase(char const * name);

View file

@ -30,7 +30,7 @@ public:
typedef typename C::allocator allocator;
private:
static size_t capacity(value * vs) {
return vs == 0 ? 0 : (reinterpret_cast<size_t*>(vs))[-1];
return vs == nullptr ? 0 : (reinterpret_cast<size_t*>(vs))[-1];
}
value * allocate_values(size_t c) {
@ -44,7 +44,7 @@ private:
}
void deallocate_values(value * vs) {
if (vs == 0)
if (vs == nullptr)
return;
size_t c = capacity(vs);
TRACE("parray_mem", tout << "deallocated values[" << c << "]: " << vs << "\n";);
@ -73,7 +73,7 @@ private:
unsigned size() const { SASSERT(kind() == ROOT); return m_size; }
cell * next() const { SASSERT(kind() != ROOT); return m_next; }
value const & elem() const { SASSERT(kind() == SET || kind() == PUSH_BACK); return m_elem; }
cell(ckind k):m_ref_count(1), m_kind(k), m_size(0), m_values(0) {}
cell(ckind k):m_ref_count(1), m_kind(k), m_size(0), m_values(nullptr) {}
};
value_manager & m_vmanager;
@ -105,7 +105,7 @@ private:
void del(cell * c) {
while (true) {
cell * next = 0;
cell * next = nullptr;
switch (c->kind()) {
case SET:
case PUSH_BACK:
@ -123,7 +123,7 @@ private:
TRACE("parray_mem", tout << "deallocated cell: " << c << "\n";);
c->~cell();
m_allocator.deallocate(sizeof(cell), c);
if (next == 0)
if (next == nullptr)
return;
SASSERT(next->m_ref_count > 0);
next->m_ref_count--;
@ -214,7 +214,7 @@ private:
}
SASSERT(r->kind() == ROOT);
unsigned sz = r->m_size;
vs = 0;
vs = nullptr;
copy_values(r->m_values, sz, vs);
unsigned i = cs.size();
while (i > 0) {
@ -246,7 +246,7 @@ private:
dec_ref(c->m_next);
if (c->kind() == SET || c->kind() == PUSH_BACK)
dec_ref(c->m_elem);
c->m_next = 0;
c->m_next = nullptr;
c->m_kind = ROOT;
c->m_size = sz;
c->m_values = vs;
@ -262,7 +262,7 @@ public:
bool unshared() const { return m_ref->m_ref_count == 1; }
friend class parray_manager;
public:
ref():m_ref(0), m_updt_counter(0) {}
ref():m_ref(nullptr), m_updt_counter(0) {}
};
public:
@ -283,7 +283,7 @@ public:
void del(ref & r) {
dec_ref(r.m_ref);
r.m_ref = 0;
r.m_ref = nullptr;
r.m_updt_counter = 0;
}
@ -296,7 +296,7 @@ public:
unsigned size(ref const & r) const {
cell * c = r.m_ref;
if (c == 0) return 0;
if (c == nullptr) return 0;
while (true) {
switch (c->kind()) {
case SET:
@ -397,7 +397,7 @@ public:
}
void push_back(ref & r, value const & v) {
if (r.m_ref == 0)
if (r.m_ref == nullptr)
mk(r);
if (r.root()) {
if (r.unshared()) {

View file

@ -48,7 +48,7 @@ public:
Plugin * get_plugin(family_id fid) const {
if (fid == null_family_id) {
return 0;
return nullptr;
}
return m_fid2plugins.get(fid, 0);
}

View file

@ -99,7 +99,7 @@ uint64 prime_generator::operator()(unsigned idx) {
prime_generator g_prime_generator;
prime_iterator::prime_iterator(prime_generator * g):m_idx(0) {
if (g == 0) {
if (g == nullptr) {
m_generator = &g_prime_generator;
m_global = true;
}

View file

@ -45,7 +45,7 @@ class prime_iterator {
prime_generator * m_generator;
bool m_global;
public:
prime_iterator(prime_generator * g = 0);
prime_iterator(prime_generator * g = nullptr);
uint64 next();
static void finalize();
/*

View file

@ -23,7 +23,7 @@ Revision History:
#include<strsafe.h>
#endif
synch_mpq_manager * rational::g_mpq_manager = 0;
synch_mpq_manager * rational::g_mpq_manager = nullptr;
rational rational::m_zero;
rational rational::m_one;
rational rational::m_minus_one;
@ -80,6 +80,6 @@ void rational::finalize() {
m_one.~rational();
m_minus_one.~rational();
dealloc(g_mpq_manager);
g_mpq_manager = 0;
g_mpq_manager = nullptr;
}

View file

@ -37,7 +37,7 @@ class ref {
public:
ref():
m_ptr(0) {
m_ptr(nullptr) {
}
ref(T * ptr):
@ -64,7 +64,7 @@ public:
}
operator bool() const {
return m_ptr != 0;
return m_ptr != nullptr;
}
const T & operator*() const {
@ -100,12 +100,12 @@ public:
void reset() {
dec_ref();
m_ptr = 0;
m_ptr = nullptr;
}
T* detach() {
T* tmp = m_ptr;
m_ptr = 0;
m_ptr = nullptr;
return tmp;
}

View file

@ -38,11 +38,11 @@ inline void region::allocate_page() {
}
region::region() {
m_curr_page = 0;
m_curr_ptr = 0;
m_curr_end_ptr = 0;
m_free_pages = 0;
m_mark = 0;
m_curr_page = nullptr;
m_curr_ptr = nullptr;
m_curr_end_ptr = nullptr;
m_free_pages = nullptr;
m_mark = nullptr;
allocate_page();
}
@ -81,13 +81,13 @@ inline void region::recycle_curr_page() {
}
void region::reset() {
while (m_curr_page != 0) {
while (m_curr_page != nullptr) {
recycle_curr_page();
}
SASSERT(m_curr_page == 0);
m_curr_ptr = 0;
m_curr_end_ptr = 0;
m_mark = 0;
m_curr_ptr = nullptr;
m_curr_end_ptr = nullptr;
m_mark = nullptr;
allocate_page();
}
@ -113,7 +113,7 @@ void region::pop_scope() {
void region::display_mem_stats(std::ostream & out) const {
unsigned n = 0;
char * page = m_curr_page;
while (page != 0) {
while (page != nullptr) {
n++;
page = prev_page(page);
}

View file

@ -24,7 +24,7 @@ s_integer s_integer::m_one(1);
s_integer s_integer::m_minus_one(-1);
s_integer::s_integer(const char * str) {
m_val = static_cast<int>(strtol(str, 0, 10));
m_val = static_cast<int>(strtol(str, nullptr, 10));
}
s_integer power(const s_integer & r, unsigned p) {

View file

@ -20,7 +20,7 @@ Revision History:
#include<iostream>
#include "util/scoped_ctrl_c.h"
scoped_ctrl_c * scoped_ctrl_c::g_obj = 0;
scoped_ctrl_c * scoped_ctrl_c::g_obj = nullptr;
void scoped_ctrl_c::on_ctrl_c(int) {
if (g_obj->m_first) {

View file

@ -30,7 +30,7 @@ public:
~scoped_ptr_vector() { reset(); }
void reset() { std::for_each(m_vector.begin(), m_vector.end(), delete_proc<T>()); m_vector.reset(); }
void push_back(T * ptr) { m_vector.push_back(ptr); }
void pop_back() { SASSERT(!empty()); set(size()-1, 0); m_vector.pop_back(); }
void pop_back() { SASSERT(!empty()); set(size()-1, nullptr); m_vector.pop_back(); }
T * operator[](unsigned idx) const { return m_vector[idx]; }
void set(unsigned idx, T * ptr) {
if (m_vector[idx] == ptr)
@ -48,7 +48,7 @@ public:
}
else {
for (unsigned i = m_vector.size(); i < sz; i++)
push_back(0);
push_back(nullptr);
}
}
};

View file

@ -157,9 +157,9 @@ struct scoped_timer::imp {
m_interval = ms?ms:0xFFFFFFFF;
if (pthread_attr_init(&m_attributes) != 0)
throw default_exception("failed to initialize timer thread attributes");
if (pthread_cond_init(&m_condition_var, NULL) != 0)
if (pthread_cond_init(&m_condition_var, nullptr) != 0)
throw default_exception("failed to initialize timer condition variable");
if (pthread_mutex_init(&m_mutex, NULL) != 0)
if (pthread_mutex_init(&m_mutex, nullptr) != 0)
throw default_exception("failed to initialize timer mutex");
clock_serv_t host_clock;
@ -208,7 +208,7 @@ struct scoped_timer::imp {
pthread_cond_signal(&m_condition_var);
pthread_mutex_unlock(&m_mutex);
if (pthread_join(m_thread_id, NULL) != 0)
if (pthread_join(m_thread_id, nullptr) != 0)
throw default_exception("failed to join thread");
if (pthread_mutex_destroy(&m_mutex) != 0)
throw default_exception("failed to destroy pthread mutex");
@ -248,7 +248,7 @@ scoped_timer::scoped_timer(unsigned ms, event_handler * eh) {
if (ms != UINT_MAX && ms != 0)
m_imp = alloc(imp, ms, eh);
else
m_imp = 0;
m_imp = nullptr;
}
scoped_timer::~scoped_timer() {

View file

@ -27,8 +27,8 @@ Revision History:
small_object_allocator::small_object_allocator(char const * id) {
for (unsigned i = 0; i < NUM_SLOTS; i++) {
m_chunks[i] = 0;
m_free_list[i] = 0;
m_chunks[i] = nullptr;
m_free_list[i] = nullptr;
}
DEBUG_CODE({
m_id = id;
@ -60,8 +60,8 @@ void small_object_allocator::reset() {
dealloc(c);
c = next;
}
m_chunks[i] = 0;
m_free_list[i] = 0;
m_chunks[i] = nullptr;
m_free_list[i] = nullptr;
}
m_alloc_size = 0;
}
@ -95,7 +95,7 @@ void small_object_allocator::deallocate(size_t size, void * p) {
void * small_object_allocator::allocate(size_t size) {
if (size == 0) return 0;
if (size == 0) return nullptr;
#if defined(Z3DEBUG) && !defined(_WINDOWS)
// Valgrind friendly
@ -113,7 +113,7 @@ void * small_object_allocator::allocate(size_t size) {
slot_id++;
SASSERT(slot_id < NUM_SLOTS);
SASSERT(slot_id > 0);
if (m_free_list[slot_id] != 0) {
if (m_free_list[slot_id] != nullptr) {
void * r = m_free_list[slot_id];
m_free_list[slot_id] = *(reinterpret_cast<void **>(r));
return r;
@ -121,7 +121,7 @@ void * small_object_allocator::allocate(size_t size) {
chunk * c = m_chunks[slot_id];
size = slot_id << PTR_ALIGNMENT;
SASSERT(size >= osize);
if (c != 0) {
if (c != nullptr) {
char * new_curr = c->m_curr + size;
if (new_curr < c->m_data + CHUNK_SIZE) {
void * r = c->m_curr;
@ -142,7 +142,7 @@ size_t small_object_allocator::get_wasted_size() const {
for (unsigned slot_id = 0; slot_id < NUM_SLOTS; slot_id++) {
size_t slot_obj_size = slot_id << PTR_ALIGNMENT;
void ** ptr = reinterpret_cast<void **>(const_cast<small_object_allocator*>(this)->m_free_list[slot_id]);
while (ptr != 0) {
while (ptr != nullptr) {
r += slot_obj_size;
ptr = reinterpret_cast<void**>(*ptr);
}
@ -154,7 +154,7 @@ size_t small_object_allocator::get_num_free_objs() const {
size_t r = 0;
for (unsigned slot_id = 0; slot_id < NUM_SLOTS; slot_id++) {
void ** ptr = reinterpret_cast<void **>(const_cast<small_object_allocator*>(this)->m_free_list[slot_id]);
while (ptr != 0) {
while (ptr != nullptr) {
r ++;
ptr = reinterpret_cast<void**>(*ptr);
}
@ -177,17 +177,17 @@ void small_object_allocator::consolidate() {
ptr_vector<chunk> chunks;
ptr_vector<char> free_objs;
for (unsigned slot_id = 1; slot_id < NUM_SLOTS; slot_id++) {
if (m_free_list[slot_id] == 0)
if (m_free_list[slot_id] == nullptr)
continue;
chunks.reset();
free_objs.reset();
chunk * c = m_chunks[slot_id];
while (c != 0) {
while (c != nullptr) {
chunks.push_back(c);
c = c->m_next;
}
char * ptr = static_cast<char*>(m_free_list[slot_id]);
while (ptr != 0) {
while (ptr != nullptr) {
free_objs.push_back(ptr);
ptr = *(reinterpret_cast<char**>(ptr));
}
@ -198,8 +198,8 @@ void small_object_allocator::consolidate() {
SASSERT(!chunks.empty());
std::sort(chunks.begin(), chunks.end(), ptr_lt<chunk>());
std::sort(free_objs.begin(), free_objs.end(), ptr_lt<char>());
chunk * last_chunk = 0;
void * last_free_obj = 0;
chunk * last_chunk = nullptr;
void * last_free_obj = nullptr;
unsigned chunk_idx = 0;
unsigned obj_idx = 0;
unsigned num_chunks = chunks.size();

View file

@ -29,7 +29,7 @@ bool is_smt2_simple_symbol_char(char s) {
}
bool is_smt2_quoted_symbol(char const * s) {
if (s == 0)
if (s == nullptr)
return false;
if ('0' <= s[0] && s[0] <= '9')
return true;

View file

@ -62,10 +62,10 @@ inline void stack::store_mark(void * ptr, bool external) {
}
stack::stack() {
m_curr_page = 0;
m_curr_ptr = 0;
m_curr_end_ptr = 0;
m_free_pages = 0;
m_curr_page = nullptr;
m_curr_ptr = nullptr;
m_curr_end_ptr = nullptr;
m_free_pages = nullptr;
allocate_page(0);
SASSERT(empty());
}

View file

@ -22,7 +22,7 @@ Revision History:
#include "util/string_buffer.h"
#include "util/z3_omp.h"
symbol symbol::m_dummy(TAG(void*, static_cast<void*>(0), 2));
symbol symbol::m_dummy(TAG(void*, nullptr, 2));
const symbol symbol::null;
/**
@ -60,7 +60,7 @@ public:
}
};
internal_symbol_table* g_symbol_table = 0;
internal_symbol_table* g_symbol_table = nullptr;
void initialize_symbols() {
if (!g_symbol_table) {
@ -70,12 +70,12 @@ void initialize_symbols() {
void finalize_symbols() {
dealloc(g_symbol_table);
g_symbol_table = 0;
g_symbol_table = nullptr;
}
symbol::symbol(char const * d) {
if (d == 0)
m_data = 0;
if (d == nullptr)
m_data = nullptr;
else
m_data = g_symbol_table->get_str(d);
}
@ -103,7 +103,7 @@ std::string symbol::str() const {
bool symbol::contains(char ch) const {
SASSERT(!is_marked());
if (GET_TAG(m_data) == 0) {
return strchr(m_data, ch) != 0;
return strchr(m_data, ch) != nullptr;
}
else {
return false;

View file

@ -51,7 +51,7 @@ class symbol {
static symbol m_dummy;
public:
symbol():
m_data(0) {
m_data(nullptr) {
}
explicit symbol(char const * d);
explicit symbol(unsigned idx):
@ -69,9 +69,9 @@ public:
unsigned int get_num() const { SASSERT(is_numerical()); return UNBOXINT(m_data); }
std::string str() const;
friend bool operator==(symbol const & s1, char const * s2) {
if (s1.m_data == 0 && s2 == 0)
if (s1.m_data == nullptr && s2 == nullptr)
return true;
if (s1.m_data == 0 || s2 == 0)
if (s1.m_data == nullptr || s2 == nullptr)
return false;
if (!s1.is_numerical())
return strcmp(s1.bare_str(), s2) == 0;
@ -87,7 +87,7 @@ public:
return s;
}
unsigned hash() const {
if (m_data == 0) return 0x9e3779d9;
if (m_data == nullptr) return 0x9e3779d9;
else if (is_numerical()) return get_num();
else return static_cast<unsigned>(reinterpret_cast<size_t const *>(m_data)[-1]);
}

View file

@ -121,7 +121,7 @@ public:
bool find(symbol key, T & result) const {
key_data dummy(key);
hash_entry * e = m_sym_table.find_core(dummy);
if (e == 0) {
if (e == nullptr) {
return false;
}
result = e->get_data().m_data;
@ -140,7 +140,7 @@ public:
if (get_scope_level() > 0) {
key_data dummy(key);
hash_entry * e = m_sym_table.find_core(dummy);
if (e != 0) {
if (e != nullptr) {
m_trail_stack.push_back(e->m_data);
e->m_data.m_data = data;
return;

View file

@ -49,7 +49,7 @@ timeit::timeit(bool enable, char const * msg, std::ostream & out) {
if (enable)
m_imp = alloc(imp, msg, out);
else
m_imp = 0;
m_imp = nullptr;
}
timeit::~timeit() {

View file

@ -27,8 +27,8 @@ Revision History:
#include "util/event_handler.h"
#include "util/scoped_timer.h"
scoped_timer * g_timeout = 0;
void (* g_on_timeout)() = 0;
scoped_timer * g_timeout = nullptr;
void (* g_on_timeout)() = nullptr;
class g_timeout_eh : public event_handler {
public:
@ -41,7 +41,7 @@ public:
g_on_timeout();
if (g_timeout)
delete g_timeout;
g_timeout = 0;
g_timeout = nullptr;
throw z3_error(ERR_TIMEOUT);
}
}

View file

@ -24,7 +24,7 @@ std::ofstream tout(".z3-trace");
#endif
static bool g_enable_all_trace_tags = false;
static str_hashtable* g_enabled_trace_tags = 0;
static str_hashtable* g_enabled_trace_tags = nullptr;
static str_hashtable& get_enabled_trace_tags() {
if (!g_enabled_trace_tags) {
@ -35,7 +35,7 @@ static str_hashtable& get_enabled_trace_tags() {
void finalize_trace() {
dealloc(g_enabled_trace_tags);
g_enabled_trace_tags = 0;
g_enabled_trace_tags = nullptr;
}
void enable_trace(const char * tag) {

View file

@ -77,7 +77,7 @@ public:
}
void undo(Ctx & ctx) override {
m_ptr = 0;
m_ptr = nullptr;
}
};

View file

@ -40,7 +40,7 @@ std::ostream& verbose_stream() {
}
static void (*g_fatal_error_handler)(int) = 0;
static void (*g_fatal_error_handler)(int) = nullptr;
void fatal_error(int error_code) {
if (g_fatal_error_handler) {
@ -120,7 +120,7 @@ bool product_iterator_next(unsigned n, unsigned const * sz, unsigned * it) {
}
char const * escaped::end() const {
if (m_str == 0) return 0;
if (m_str == nullptr) return nullptr;
char const * it = m_str;
char const * e = m_str;
while (*it) {

View file

@ -222,7 +222,7 @@ template<typename T>
class scoped_ptr {
T * m_ptr;
public:
scoped_ptr(T * ptr=0):
scoped_ptr(T * ptr=nullptr):
m_ptr(ptr) {
}
@ -239,7 +239,7 @@ public:
}
operator bool() const {
return m_ptr != 0;
return m_ptr != nullptr;
}
const T & operator*() const {
@ -260,7 +260,7 @@ public:
T * detach() {
T* tmp = m_ptr;
m_ptr = 0;
m_ptr = nullptr;
return tmp;
}

View file

@ -57,7 +57,7 @@ class vector {
}
void expand_vector() {
if (m_data == 0) {
if (m_data == nullptr) {
SZ capacity = 2;
SZ * mem = reinterpret_cast<SZ*>(memory::allocate(sizeof(T) * capacity + sizeof(SZ) * 2));
*mem = capacity;
@ -132,12 +132,12 @@ public:
typedef const T * const_iterator;
vector():
m_data(0) {
m_data(nullptr) {
}
vector(SZ s) {
if (s == 0) {
m_data = 0;
m_data = nullptr;
return;
}
SZ * mem = reinterpret_cast<SZ*>(memory::allocate(sizeof(T) * s + sizeof(SZ) * 2));
@ -155,24 +155,24 @@ public:
}
vector(SZ s, T const & elem):
m_data(0) {
m_data(nullptr) {
resize(s, elem);
}
vector(vector const & source):
m_data(0) {
m_data(nullptr) {
if (source.m_data) {
copy_core(source);
}
SASSERT(size() == source.size());
}
vector(vector&& other) : m_data(0) {
vector(vector&& other) : m_data(nullptr) {
std::swap(m_data, other.m_data);
}
vector(SZ s, T const * data):
m_data(0) {
m_data(nullptr) {
for (SZ i = 0; i < s; i++) {
push_back(data[i]);
}
@ -185,7 +185,7 @@ public:
void finalize() {
destroy();
m_data = 0;
m_data = nullptr;
}
vector & operator=(vector const & source) {
@ -197,7 +197,7 @@ public:
copy_core(source);
}
else {
m_data = 0;
m_data = nullptr;
}
return *this;
}
@ -207,7 +207,7 @@ public:
return *this;
}
destroy();
m_data = 0;
m_data = nullptr;
std::swap(m_data, source.m_data);
return *this;
}
@ -224,18 +224,18 @@ public:
void clear() { reset(); }
bool empty() const {
return m_data == 0 || reinterpret_cast<SZ *>(m_data)[SIZE_IDX] == 0;
return m_data == nullptr || reinterpret_cast<SZ *>(m_data)[SIZE_IDX] == 0;
}
SZ size() const {
if (m_data == 0) {
if (m_data == nullptr) {
return 0;
}
return reinterpret_cast<SZ *>(m_data)[SIZE_IDX];
}
SZ capacity() const {
if (m_data == 0) {
if (m_data == nullptr) {
return 0;
}
return reinterpret_cast<SZ *>(m_data)[CAPACITY_IDX];
@ -349,7 +349,7 @@ public:
}
void push_back(T const & elem) {
if (m_data == 0 || reinterpret_cast<SZ *>(m_data)[SIZE_IDX] == reinterpret_cast<SZ *>(m_data)[CAPACITY_IDX]) {
if (m_data == nullptr || reinterpret_cast<SZ *>(m_data)[SIZE_IDX] == reinterpret_cast<SZ *>(m_data)[CAPACITY_IDX]) {
expand_vector();
}
new (m_data + reinterpret_cast<SZ *>(m_data)[SIZE_IDX]) T(elem);
@ -357,7 +357,7 @@ public:
}
void push_back(T && elem) {
if (m_data == 0 || reinterpret_cast<SZ *>(m_data)[SIZE_IDX] == reinterpret_cast<SZ *>(m_data)[CAPACITY_IDX]) {
if (m_data == nullptr || reinterpret_cast<SZ *>(m_data)[SIZE_IDX] == reinterpret_cast<SZ *>(m_data)[CAPACITY_IDX]) {
expand_vector();
}
new (m_data + reinterpret_cast<SZ *>(m_data)[SIZE_IDX]) T(std::move(elem));

View file

@ -62,8 +62,8 @@ void STD_CALL myInvalidParameterHandler(
static bool g_warning_msgs = true;
static bool g_use_std_stdout = false;
static std::ostream* g_error_stream = 0;
static std::ostream* g_warning_stream = 0;
static std::ostream* g_error_stream = nullptr;
static std::ostream* g_warning_stream = nullptr;
static bool g_show_error_msg_prefix = true;
void send_warnings_to_stdout(bool flag) {