diff options
author | Guillem Jover <guillem@debian.org> | 2013-11-21 06:20:01 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2013-12-05 10:19:33 +0100 |
commit | 80cc83904a4cc04f1b7a4ebe0439fea25bbaaf74 (patch) | |
tree | ee1abb5c5b24fed494cbc1473af37e67e5c82322 /dselect/method.cc | |
parent | cf21cccb98bdb31a84bbe1aa1217c712b47aedd2 (diff) | |
download | dpkg-80cc83904a4cc04f1b7a4ebe0439fea25bbaaf74.tar.gz |
dselect: Use C++11 nullptr instead of 0 or NULL
It is way more descriptive, and has a better type. Check for C++11
compiler support and fallback nullptr to 0 if unavailable.
Diffstat (limited to 'dselect/method.cc')
-rw-r--r-- | dselect/method.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/dselect/method.cc b/dselect/method.cc index 82488ced2..cfa02896c 100644 --- a/dselect/method.cc +++ b/dselect/method.cc @@ -51,10 +51,10 @@ static const char *const methoddirectories[]= { LIBDIR "/" METHODSDIR, LOCALLIBDIR "/" METHODSDIR, - 0 + nullptr }; -static char *methodlockfile= 0; +static char *methodlockfile = nullptr; static int methlockfd= -1; static void @@ -88,7 +88,7 @@ static enum urqresult ensureoptions(void) { int nread; if (!options) { - newoptions= 0; + newoptions = nullptr; nread= 0; for (ccpp= methoddirectories; *ccpp; ccpp++) readmethods(*ccpp, &newoptions, &nread); @@ -105,7 +105,7 @@ static enum urqresult ensureoptions(void) { static enum urqresult lockmethod(void) { struct flock fl; - if (methodlockfile == NULL) + if (methodlockfile == nullptr) methodlockfile = dpkg_db_get_path(METHLOCKFILE); if (methlockfd == -1) { @@ -128,7 +128,7 @@ static enum urqresult lockmethod(void) { sthfailed("unable to lock access method area"); return urqr_fail; } - push_cleanup(cu_unlockmethod,~0, 0,0, 0); + push_cleanup(cu_unlockmethod, ~0, nullptr, 0, 0); return urqr_normal; } @@ -144,7 +144,7 @@ falliblesubprocess(struct command *cmd) pid = subproc_fork(); if (pid == 0) { - subproc_signals_cleanup(0, 0); + subproc_signals_cleanup(0, nullptr); command_exec(cmd); } @@ -180,7 +180,7 @@ static urqresult runscript(const char *exepath, const char *name) { command_init(&cmd, coption->meth->path, name); command_add_args(&cmd, exepath, dpkg_db_get_dir(), - coption->meth->name, coption->name, NULL); + coption->meth->name, coption->name, nullptr); ur = falliblesubprocess(&cmd); command_destroy(&cmd); } else { @@ -206,7 +206,7 @@ static urqresult rundpkgauto(const char *name, const char *dpkgmode) { command_init(&cmd, DPKG, name); command_add_args(&cmd, DPKG, "--admindir", dpkg_db_get_dir(), "--pending", - dpkgmode, NULL); + dpkgmode, nullptr); cursesoff(); printf("running dpkg --pending %s ...\n",dpkgmode); @@ -245,7 +245,7 @@ urqresult urq_setup(void) { command_init(&cmd, coption->meth->path, _("query/setup script")); command_add_args(&cmd, METHODSETUPSCRIPT, dpkg_db_get_dir(), - coption->meth->name, coption->name, NULL); + coption->meth->name, coption->name, nullptr); ur = falliblesubprocess(&cmd); command_destroy(&cmd); if (ur == urqr_normal) writecurrentopt(); |