From 4e5846ccd3dcc33504aba8ef35a8962bccfd562e Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 8 Aug 2007 05:25:06 +0300 Subject: [PATCH] Use NULL instead of '(char *)0'. --- ChangeLog | 15 +++++++++++++++ dpkg-deb/build.c | 8 +++++--- dpkg-deb/extract.c | 5 +++-- dpkg-deb/info.c | 5 +++-- src/cleanup.c | 18 +++++++++--------- src/configure.c | 4 ++-- src/help.c | 6 +++--- src/processarc.c | 20 ++++++++++---------- src/remove.c | 6 +++--- 9 files changed, 53 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41a56ee7..8afa435e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-08-08 Guillem Jover + + * dpkg-deb/build.c (do_build): Use NULL instead of '(char *)0'. + * dpkg-deb/extract.c (movecontrolfiles, extracthalf): Likewise. + * dpkg-deb/info.c (cu_info_prepare, info_prepare): Likewise. + * src/cleanup.c (cu_prermupgrade, cu_prermdeconfigure) + (cu_prerminfavour, cu_preinstverynew, cu_preinstnew) + (cu_preinstupgrade, cu_postrmupgrade, cu_prermremove): Likewise. + * src/configure.c (deferred_configure, suspend): Likewise. + * src/help.c (maintainer_script_alternative) + (ensure_pathname_nonexisting): Likewise. + * src/processarc.c (process_archive): Likewise. + * src/remove.c (deferred_remove, removal_bulk_remove_files) + (removal_bulk_remove_configfiles): Likewise. + 2007-08-08 Guillem Jover * src/cleanup.c (cu_prermdeconfigure): Split call to diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index 31e66045..0177a743 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -324,7 +324,8 @@ void do_build(const char *const *argv) { m_dup2(p1[1],1); close(p1[0]); close(p1[1]); if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory); if (chdir(BUILDCONTROLDIR)) ohshite(_("failed to chdir to .../DEBIAN")); - execlp(TAR,"tar","-cf","-",".",(char*)0); ohshite(_("failed to exec tar -cf")); + execlp(TAR, "tar", "-cf", "-", ".", NULL); + ohshite(_("failed to exec tar -cf")); } close(p1[1]); /* Create a temporary file to store the control data in. Immediately unlink @@ -396,7 +397,7 @@ void do_build(const char *const *argv) { m_dup2(p1[0],0); close(p1[0]); close(p1[1]); m_dup2(p2[1],1); close(p2[0]); close(p2[1]); if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory); - execlp(TAR,"tar","-cf", "-", "--null", "-T", "-", "--no-recursion", (char*)0); + execlp(TAR, "tar", "-cf", "-", "--null", "-T", "-", "--no-recursion", NULL); ohshite(_("failed to exec tar -cf")); } close(p1[0]); @@ -417,7 +418,8 @@ void do_build(const char *const *argv) { if (!(c3= m_fork())) { m_dup2(p3[1],1); close(p3[0]); close(p3[1]); if (chdir(directory)) ohshite(_("failed to chdir to `%.255s'"),directory); - execlp(FIND,"find",".","-path","./" BUILDCONTROLDIR,"-prune","-o","-print0",(char*)0); + execlp(FIND, "find", ".", "-path", "./" BUILDCONTROLDIR, "-prune", "-o", + "-print0", NULL); ohshite(_("failed to exec find")); } close(p3[1]); diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index 1541980e..24cc1c13 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -48,7 +48,8 @@ static void movecontrolfiles(const char *thing) { sprintf(buf, "mv %s/* . && rmdir %s", thing, thing); if (!(c1= m_fork())) { - execlp("sh","sh","-c",buf,(char*)0); ohshite(_("failed to exec sh -c mv foo/* &c")); + execlp("sh", "sh", "-c", buf, NULL); + ohshite(_("failed to exec sh -c mv foo/* &c")); } waitsubproc(c1,"sh -c mv foo/* &c",0); } @@ -299,7 +300,7 @@ void extracthalf(const char *debar, const char *directory, strcat(buffer, "f"); m_dup2(p2[0],0); close(p2[0]); - execlp(TAR,"tar",buffer,"-",(char*)0); + execlp(TAR, "tar", buffer, "-", NULL); ohshite(_("failed to exec tar")); } close(p2[0]); diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c index 0cebf669..4024d029 100644 --- a/dpkg-deb/info.c +++ b/dpkg-deb/info.c @@ -50,7 +50,7 @@ static void cu_info_prepare(int argc, void **argv) { if (lstat(directory,&stab) && errno==ENOENT) return; if ((c1= fork()) == -1) { perror(_("failed to fork for cleanup")); return; } if (!c1) { - execlp(RM,"rm","-rf",directory,(char*)0); + execlp(RM, "rm", "-rf", directory, NULL); perror(_("failed to exec rm for cleanup")); _exit(1); } if (waitpid(c1,&status,0) != c1) { perror(_("failed to wait for rm cleanup")); return; } @@ -72,7 +72,8 @@ static void info_prepare(const char *const **argvp, *directoryp= dbuf; if (!(c1= m_fork())) { - execlp(RM,"rm","-rf",dbuf,(char*)0); ohshite(_("failed to exec rm -rf")); + execlp(RM, "rm", "-rf", dbuf, NULL); + ohshite(_("failed to exec rm -rf")); } waitsubproc(c1,"rm -rf",0); push_cleanup(cu_info_prepare,-1, 0,0, 1, (void*)dbuf); diff --git a/src/cleanup.c b/src/cleanup.c index 09619929..108ee2c1 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -111,7 +111,7 @@ void cu_prermupgrade(int argc, void **argv) { "abort-upgrade", versiondescribe(&pkg->available.version, vdew_nonambig), - (char*)0); + NULL); pkg->status= stat_installed; pkg->eflag &= ~eflagf_reinstreq; modstatdb_note(pkg); @@ -141,14 +141,14 @@ void cu_prermdeconfigure(int argc, void **argv) { "removing", conflictor->name, versiondescribe(&conflictor->installed.version, vdew_nonambig), - (char*)0); + NULL); } else { maintainer_script_installed(deconf, POSTINSTFILE, "post-installation", "abort-deconfigure", "in-favour", infavour->name, versiondescribe(&infavour->available.version, vdew_nonambig), - (char*)0); + NULL); } deconf->status= stat_installed; @@ -164,7 +164,7 @@ void cu_prerminfavour(int argc, void **argv) { "abort-remove", "in-favour", infavour->name, versiondescribe(&infavour->available.version, vdew_nonambig), - (char*)0); + NULL); conflictor->status= stat_installed; conflictor->eflag &= ~eflagf_reinstreq; modstatdb_note(conflictor); @@ -178,7 +178,7 @@ void cu_preinstverynew(int argc, void **argv) { if (cleanup_pkg_failed++) return; maintainer_script_new(pkg->name, POSTRMFILE,"post-removal",cidir,cidirrest, - "abort-install",(char*)0); + "abort-install", NULL); pkg->status= stat_notinstalled; pkg->eflag &= ~eflagf_reinstreq; blankpackageperfile(&pkg->installed); @@ -195,7 +195,7 @@ void cu_preinstnew(int argc, void **argv) { maintainer_script_new(pkg->name, POSTRMFILE,"post-removal",cidir,cidirrest, "abort-install", versiondescribe(&pkg->installed.version, vdew_nonambig), - (char*)0); + NULL); pkg->status= stat_configfiles; pkg->eflag &= ~eflagf_reinstreq; modstatdb_note(pkg); @@ -213,7 +213,7 @@ void cu_preinstupgrade(int argc, void **argv) { "abort-upgrade", versiondescribe(&pkg->installed.version, vdew_nonambig), - (char*)0); + NULL); pkg->status= *oldstatusp; pkg->eflag &= ~eflagf_reinstreq; modstatdb_note(pkg); @@ -227,7 +227,7 @@ void cu_postrmupgrade(int argc, void **argv) { maintainer_script_installed(pkg,PREINSTFILE,"pre-installation", "abort-upgrade", versiondescribe(&pkg->available.version, vdew_nonambig), - (char*)0); + NULL); cleanup_pkg_failed--; } @@ -236,7 +236,7 @@ void cu_prermremove(int argc, void **argv) { if (cleanup_pkg_failed++) return; maintainer_script_installed(pkg,POSTINSTFILE,"post-installation", - "abort-remove", (char*)0); + "abort-remove", NULL); pkg->status= stat_installed; pkg->eflag &= ~eflagf_reinstreq; modstatdb_note(pkg); diff --git a/src/configure.c b/src/configure.c index 0615728a..c1a70a74 100644 --- a/src/configure.c +++ b/src/configure.c @@ -303,7 +303,7 @@ void deferred_configure(struct pkginfo *pkg) { ? versiondescribe(&pkg->configversion, vdew_nonambig) : "", - (char*)0)) + NULL)) putchar('\n'); pkg->status= stat_installed; @@ -504,7 +504,7 @@ static void suspend(void) { if (!s || !*s) s=DEFAULTSHELL; - execlp(s,s,"-i",(char*)0); + execlp(s, s, "-i", NULL); ohshite(_("failed to exec shell (%.250s)"),s); } diff --git a/src/help.c b/src/help.c index ba4a8455..7f29543b 100644 --- a/src/help.c +++ b/src/help.c @@ -348,7 +348,7 @@ int maintainer_script_alternative(struct pkginfo *pkg, arglist= buildarglist(scriptname, ifok,versiondescribe(&pkg->available.version, vdew_nonambig), - (char*)0); + NULL); sprintf(buf,_("old %s script"),description); if (stat(oldscriptpath,&stab)) { if (errno == ENOENT) { @@ -369,7 +369,7 @@ int maintainer_script_alternative(struct pkginfo *pkg, arglist= buildarglist(scriptname, iffallback,versiondescribe(&pkg->installed.version, vdew_nonambig), - (char*)0); + NULL); strcpy(cidirrest,scriptname); sprintf(buf,_("new %s script"),description); @@ -515,7 +515,7 @@ void ensure_pathname_nonexisting(const char *pathname) { } c1= m_fork(); if (!c1) { - execlp(RM,"rm","-rf","--",pathname,(char*)0); + execlp(RM, "rm", "-rf", "--", pathname, NULL); ohshite(_("failed to exec rm for cleanup")); } debug(dbg_eachfile,"ensure_pathname_nonexisting running rm -rf"); diff --git a/src/processarc.c b/src/processarc.c index 4c1d0573..cb69504b 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -113,7 +113,7 @@ void process_archive(const char *filename) { push_cleanup(cu_pathname,~0, 0,0, 1,(void*)reasmbuf); c1= m_fork(); if (!c1) { - execlp(SPLITTER, SPLITTER,"-Qao",reasmbuf,filename,(char*)0); + execlp(SPLITTER, SPLITTER, "-Qao", reasmbuf, filename, NULL); ohshite(_("failed to exec dpkg-split to see if it's part of a multiparter")); } while ((r= waitpid(c1,&status,0)) == -1 && errno == EINTR); @@ -184,7 +184,7 @@ void process_archive(const char *filename) { c1= m_fork(); if (!c1) { cidirrest[-1]= 0; - execlp(BACKEND, BACKEND,"--control",filename,cidir,(char*)0); + execlp(BACKEND, BACKEND, "--control", filename, cidir, NULL); ohshite(_("failed to exec dpkg-deb to extract control information")); } waitsubproc(c1,BACKEND " --control",0); @@ -426,13 +426,13 @@ void process_archive(const char *filename) { "removing", removing->name, versiondescribe(&removing->installed.version, vdew_nonambig), - (char*)0); + NULL); } else { maintainer_script_installed(deconpil->pkg, PRERMFILE, "pre-removal", "deconfigure", "in-favour", pkg->name, versiondescribe(&pkg->available.version, vdew_nonambig), - (char*)0); + NULL); } } @@ -447,7 +447,7 @@ void process_archive(const char *filename) { "remove", "in-favour", pkg->name, versiondescribe(&pkg->available.version, vdew_nonambig), - (char*)0); + NULL); conflictor[i]->status= stat_halfinstalled; modstatdb_note(conflictor[i]); } @@ -461,21 +461,21 @@ void process_archive(const char *filename) { push_cleanup(cu_preinstverynew,~ehflag_normaltidy, 0,0, 3,(void*)pkg,(void*)cidir,(void*)cidirrest); maintainer_script_new(pkg->name, PREINSTFILE, "pre-installation", cidir, cidirrest, - "install", (char*)0); + "install", NULL); } else if (oldversionstatus == stat_configfiles) { push_cleanup(cu_preinstnew,~ehflag_normaltidy, 0,0, 3,(void*)pkg,(void*)cidir,(void*)cidirrest); maintainer_script_new(pkg->name, PREINSTFILE, "pre-installation", cidir, cidirrest, "install", versiondescribe(&pkg->installed.version, vdew_nonambig), - (char*)0); + NULL); } else { push_cleanup(cu_preinstupgrade,~ehflag_normaltidy, 0,0, 4,(void*)pkg,(void*)cidir,(void*)cidirrest,(void*)&oldversionstatus); maintainer_script_new(pkg->name, PREINSTFILE, "pre-installation", cidir, cidirrest, "upgrade", versiondescribe(&pkg->installed.version, vdew_nonambig), - (char*)0); + NULL); printf(_("Unpacking replacement %.250s ...\n"),pkg->name); } @@ -556,7 +556,7 @@ void process_archive(const char *filename) { c1= m_fork(); if (!c1) { m_dup2(p1[1],1); close(p1[0]); close(p1[1]); - execlp(BACKEND, BACKEND, "--fsys-tarfile", filename, (char*)0); + execlp(BACKEND, BACKEND, "--fsys-tarfile", filename, NULL); ohshite(_("unable to exec dpkg-deb to get filesystem archive")); } close(p1[1]); @@ -981,7 +981,7 @@ void process_archive(const char *filename) { "disappear", pkg->name, versiondescribe(&pkg->available.version, vdew_nonambig), - (char*)0); + NULL); /* OK, now we delete all the stuff in the `info' directory .. */ varbufreset(&fnvb); diff --git a/src/remove.c b/src/remove.c index 5fccac6a..abcfc9ff 100644 --- a/src/remove.c +++ b/src/remove.c @@ -170,7 +170,7 @@ void deferred_remove(struct pkginfo *pkg) { modstatdb_note(pkg); push_cleanup(cu_prermremove,~ehflag_normaltidy, 0,0, 1,(void*)pkg); maintainer_script_installed(pkg, PRERMFILE, "pre-removal", - "remove", (char*)0); + "remove", NULL); } pkg->status= stat_unpacked; /* Will turn into halfinstalled soon ... */ @@ -283,7 +283,7 @@ static void removal_bulk_remove_files( } write_filelist_except(pkg,leftover,0); maintainer_script_installed(pkg, POSTRMFILE, "post-removal", - "remove", (char*)0); + "remove", NULL); varbufreset(&fnvb); varbufaddstr(&fnvb,admindir); varbufaddstr(&fnvb,"/" INFODIR); @@ -512,7 +512,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { modstatdb_note(pkg); maintainer_script_installed(pkg, POSTRMFILE, "post-removal", - "purge", (char*)0); + "purge", NULL); } void removal_bulk(struct pkginfo *pkg) { -- 2.39.5