Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: replace NULL with nullptr #2836

Merged
merged 1 commit into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/examples/libpmemobj++/map_cli/map_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ exec_op(pool_base pop, T &map, queue_op op, char *argv[], int &argn)
map->clear();
break;
case MAP_PRINT:
map->foreach (printer<typename K::value_type>, 0);
map->foreach (printer<typename K::value_type>, nullptr);
break;
default:
throw std::invalid_argument("invalid queue operation");
Expand Down
6 changes: 3 additions & 3 deletions src/examples/libpmemobj++/panaconda/panaconda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ game::game(struct parameters *par)

init_colors();

srand(time(0));
srand(time(nullptr));
}

game::~game()
Expand Down Expand Up @@ -918,13 +918,13 @@ int
game::parse_conf_create_dynamic_layout(void)
{
FILE *cfg_file;
char *line = NULL;
char *line = nullptr;
size_t len = 0;
unsigned i = 0;
ssize_t col_no = 0;

cfg_file = fopen(params->maze_path.c_str(), "r");
if (cfg_file == NULL)
if (cfg_file == nullptr)
return -1;

persistent_ptr<game_state> r = state.get_root();
Expand Down
6 changes: 3 additions & 3 deletions src/include/libpmemobj++/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class transaction {
template <typename... L>
manual(obj::pool_base &pop, L &... locks)
{
if (pmemobj_tx_begin(pop.get_handle(), NULL,
if (pmemobj_tx_begin(pop.get_handle(), nullptr,
TX_PARAM_NONE) != 0)
throw transaction_error(
"failed to start transaction");
Expand Down Expand Up @@ -392,8 +392,8 @@ class transaction {
static void
exec_tx(pool_base &pool, std::function<void()> tx, Locks &... locks)
{
if (pmemobj_tx_begin(pool.get_handle(), NULL, TX_PARAM_NONE) !=
0)
if (pmemobj_tx_begin(pool.get_handle(), nullptr,
TX_PARAM_NONE) != 0)
throw transaction_error("failed to start transaction");

auto err = add_lock(locks...);
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_cpp_cond_var/obj_cpp_cond_var.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ cond_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::condition_variable *placed_mtx =
new (pmemobj_direct(raw_cnd)) nvobj::condition_variable;
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_cpp_cond_var_posix/obj_cpp_cond_var_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ cond_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::condition_variable *placed_mtx =
new (pmemobj_direct(raw_cnd)) nvobj::condition_variable;
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_cpp_mutex/obj_cpp_mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mutex_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::mutex *placed_mtx = new (pmemobj_direct(raw_mutex)) nvobj::mutex;
std::unique_lock<nvobj::mutex> lck(*placed_mtx);
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_cpp_mutex_posix/obj_cpp_mutex_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ mutex_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::mutex *placed_mtx = new (pmemobj_direct(raw_mutex)) nvobj::mutex;
std::unique_lock<nvobj::mutex> lck(*placed_mtx);
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_cpp_shared_mutex/obj_cpp_shared_mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ mutex_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::shared_mutex *placed_mtx =
new (pmemobj_direct(raw_mutex)) nvobj::shared_mutex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mutex_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::shared_mutex *placed_mtx =
new (pmemobj_direct(raw_mutex)) nvobj::shared_mutex;
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_cpp_timed_mtx/obj_cpp_timed_mtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ mutex_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::timed_mutex *placed_mtx =
new (pmemobj_direct(raw_mutex)) nvobj::timed_mutex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ mutex_zero_test(nvobj::pool<struct root> &pop)
pmemobj_memset_persist(pop, mtx, 1, sizeof(*mtx));
return 0;
},
NULL);
nullptr);

nvobj::timed_mutex *placed_mtx =
new (pmemobj_direct(raw_mutex)) nvobj::timed_mutex;
Expand Down