From: Guillem Jover Date: Wed, 9 Jan 2008 04:24:11 +0000 (+0200) Subject: Use NULL instead of 0 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02680ecbbbf6da2b023891a11b38ecce5346dbbd;p=dpkg Use NULL instead of 0 --- diff --git a/ChangeLog b/ChangeLog index 6ae22557..5be8f7ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2008-01-16 Guillem Jover + + * dpkg-deb/build.c (do_build): Use NULL instead of 0. + * dpkg-deb/extract.c (extracthalf, do_fsystarfile): Likewise. + * dpkg-deb/info.c (info_prepare, info_spew): Likewise. + (do_contents, do_field): Likewise. + * dpkg-deb/main.c (cipaction, action, cmdinfos, main): Likewise. + * dpkg-split/join.c (do_join): Likewise. + * dpkg-split/queue.c (do_auto): Likewise. + * lib/dpkg.h (standard_startup, standard_shutdown): Likewise. + * src/archives.c (destroyobstack, deconfigure, addfiletolist) + (tarobject, check_breaks, check_conflict, archivefiles) + (newconff_append): Likewise. + * src/configure.c (deferred_configure, conffderef, md5hash): Likewise. + * src/depcon.c (findbreakcyclerecursive, findbreakcycle) + (depisok): Likewise. + * src/enquiry.c (limiteddescription, badstatinfos, unpackchk) + (assertversion, assertpredep, assertepoch, assertlongfilenames) + (assertmulticonrep, predeppackage, cmpversions): Likewise. + * src/errors.c (reports, print_error_perpackage): Likewise. + * src/filesdb.c (diversions, diversionsfile, statoverridefile) + (ensure_packagefiles_available, ensure_allinstfiles_available) + (write_filelist_except, reversefilelist_init, reversefilelist_next) + (ensure_diversions, iterfilestart, iterfilenext, filesdbinit) + (findnamenode): Likewise. + * src/help.c (checkpath, ensure_package_clientdata + (vbuildarglist, cu_restorescriptsignals, script_catchsignals) + (clear_istobes): Likewise. + * src/main.c (cipaction, ignoredepends, forceinfos) + (ACTION, OBSOLETE, ACTIONBACKEND, cmdinfos) + (execbackend, commandfd, main): Likewise. + * src/packages.c (queuehead, add_to_queue, packages, process_queue) + (breakses_ok, dependencies_ok): Likewise. + * src/processarc.c (process_archive): Likewise. + * src/remove.c (deferred_remove, removal_bulk_remove_files) + (removal_bulk_remove_leftover_dirs, removal_bulk_remove_configfiles) + (removal_bulk): Likewise. + * src/update.c (updateavailable): Likewise. + * utils/start-stop-daemon.c (xgettimeofday, run_stop_schedule) + (parse_options): Likewise. + (pid_is_cmd, pid_is_user, pid_is_exec) [HAVE_KVM_H]: Likewise. + 2008-01-15 Raphael Hertzog * scripts/dpkg-shlibdeps.pl (filter_deps): Fix filtering of diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index 4c700364..1046c7ef 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -169,7 +169,7 @@ static void free_filist(struct _finfo* fi) { */ void do_build(const char *const *argv) { static const char *const maintainerscripts[]= { - PREINSTFILE, POSTINSTFILE, PRERMFILE, POSTRMFILE, 0 + PREINSTFILE, POSTINSTFILE, PRERMFILE, POSTRMFILE, NULL }; char *m; @@ -197,7 +197,8 @@ void do_build(const char *const *argv) { strcpy(tfbuf,envbuf); strcat(tfbuf,"/dpkg.XXXXXX"); subdir= 0; - if ((debar= *argv++) !=0) { + debar = *argv++; + if (debar != NULL) { if (*argv) badusage(_("--build takes at most two arguments")); if (debar) { if (stat(debar,&debarstab)) { @@ -340,7 +341,8 @@ void do_build(const char *const *argv) { * build something. Lets start by making the ar-wrapper. */ if (!(ar=fopen(debar,"wb"))) ohshite(_("unable to create `%.255s'"),debar); - if (setvbuf(ar, 0, _IONBF, 0)) ohshite(_("unable to unbuffer `%.255s'"),debar); + if (setvbuf(ar, NULL, _IONBF, 0)) + ohshite(_("unable to unbuffer `%.255s'"), debar); /* Fork a tar to package the control-section of the package */ m_pipe(p1); if (!(c1= m_fork())) { @@ -379,7 +381,7 @@ void do_build(const char *const *argv) { if (fprintf(ar, "%-8s\n%ld\n", OLDARCHIVEVERSION, (long)controlstab.st_size) == EOF) werr(debar); } else { - thetime= time(0); + thetime = time(NULL); if (fprintf(ar, "!\n" "debian-binary %-12lu0 0 100644 %-10ld`\n" diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index edd6ab96..760f0e60 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -93,7 +93,7 @@ void extracthalf(const char *debar, const char *directory, size_t ctrllennum, memberlen= 0; int dummy, l= 0; pid_t c1=0,c2,c3; - unsigned char *ctrlarea= 0; + unsigned char *ctrlarea = NULL; int p1[2], p2[2]; FILE *ar, *pi; struct stat stab; @@ -344,7 +344,7 @@ void do_fsystarfile(const char *const *argv) { badusage(_("--%s needs a .deb filename argument"),cipaction->olong); if (*argv) badusage(_("--%s takes only one argument (.deb filename)"),cipaction->olong); - extracthalf(debar,0,0,0); + extracthalf(debar, NULL, NULL, 0); } void do_control(const char *const *argv) { controlextractvextract(1, "x", argv); } diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c index 16fee858..ee7b6214 100644 --- a/dpkg-deb/info.c +++ b/dpkg-deb/info.c @@ -76,7 +76,7 @@ static void info_prepare(const char *const **argvp, ohshite(_("failed to exec rm -rf")); } waitsubproc(c1,"rm -rf",0); - push_cleanup(cu_info_prepare,-1, 0,0, 1, (void*)dbuf); + push_cleanup(cu_info_prepare, -1, NULL, 0, 1, (void *)dbuf); extracthalf(*debarp, dbuf, "mx", admininfo); } @@ -92,7 +92,7 @@ static void info_spew(const char *debar, const char *directory, FILE *co; int re= 0; - while ((component= *argv++) != 0) { + while ((component = *argv++) != NULL) { pathlen = strlen(directory) + strlen(component) + 2; controlfile = (void *) realloc((void *) controlfile, pathlen); if (!controlfile) @@ -256,9 +256,9 @@ void do_field(const char *const *argv) { info_prepare(&argv,&debar,&directory,1); if (*argv) { - info_field(debar, directory, argv, argv[1]!=0); + info_field(debar, directory, argv, argv[1] != NULL); } else { - static const char *const controlonly[]= { "control", 0 }; + static const char *const controlonly[] = { "control", NULL }; info_spew(debar,directory, controlonly); } } @@ -267,7 +267,7 @@ void do_contents(const char *const *argv) { const char *debar; if (!(debar= *argv++) || *argv) badusage(_("--contents takes exactly one argument")); - extracthalf(debar, 0, "tv", 0); + extracthalf(debar, NULL, "tv", 0); } /* vi: sw=2 */ diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c index a8c7fea0..fe7dc68a 100644 --- a/dpkg-deb/main.c +++ b/dpkg-deb/main.c @@ -118,8 +118,8 @@ const char printforhelp[]= int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT; const char* compression=NULL; enum compress_type compress_type = compress_type_gzip; -const struct cmdinfo *cipaction=0; -dofunction *action=0; +const struct cmdinfo *cipaction = NULL; +dofunction *action = NULL; static void helponly(const struct cmdinfo *cip, const char *value) NONRETURNING; static void helponly(const struct cmdinfo *cip, const char *value) { @@ -149,27 +149,29 @@ static dofunction *const dofunctions[]= { * same order as dofunctions: */ static const struct cmdinfo cmdinfos[]= { - { "build", 'b', 0, 0, 0, setaction }, - { "contents", 'c', 0, 0, 0, setaction }, - { "control", 'e', 0, 0, 0, setaction }, - { "info", 'I', 0, 0, 0, setaction }, - { "field", 'f', 0, 0, 0, setaction }, - { "extract", 'x', 0, 0, 0, setaction }, - { "vextract", 'X', 0, 0, 0, setaction }, - { "fsys-tarfile", 0, 0, 0, 0, setaction }, - { "show", 'W', 0, 0, 0, setaction }, - { "new", 0, 0, &oldformatflag, 0, 0, 0 }, - { "old", 0, 0, &oldformatflag, 0, 0, 1 }, - { "debug", 'D', 0, &debugflag, 0, 0, 1 }, - { "nocheck", 0, 0, &nocheckflag, 0, 0, 1 }, - { "compression", 'z', 1, 0, &compression, 0, 1 }, - { "compress_type",'Z', 1, 0, 0, setcompresstype }, - { "showformat", 0, 1, 0, &showformat, 0 }, - { "help", 'h', 0, 0, 0, helponly }, - { "version", 0, 0, 0, 0, versiononly }, - { "licence", 0, 0, 0, 0, showcopyright }, /* UK spelling */ - { "license", 0, 0, 0, 0, showcopyright }, /* US spelling */ - { 0, 0 } + { "build", 'b', 0, NULL, NULL, setaction }, + { "contents", 'c', 0, NULL, NULL, setaction }, + { "control", 'e', 0, NULL, NULL, setaction }, + { "info", 'I', 0, NULL, NULL, setaction }, + { "field", 'f', 0, NULL, NULL, setaction }, + { "extract", 'x', 0, NULL, NULL, setaction }, + { "vextract", 'X', 0, NULL, NULL, setaction }, + { "fsys-tarfile", 0, 0, NULL, NULL, setaction }, + { "show", 'W', 0, NULL, NULL, setaction }, + { "new", 0, 0, &oldformatflag, NULL, NULL, 0 }, + { "old", 0, 0, &oldformatflag, NULL, NULL, 1 }, + { "debug", 'D', 0, &debugflag, NULL, NULL, 1 }, + { "nocheck", 0, 0, &nocheckflag, NULL, NULL, 1 }, + { "compression", 'z', 1, NULL, &compression, NULL, 1 }, + { "compress_type", 'Z', 1, NULL, NULL, setcompresstype }, + { "showformat", 0, 1, NULL, &showformat, NULL }, + { "help", 'h', 0, NULL, NULL, helponly }, + { "version", 0, 0, NULL, NULL, versiononly }, + /* UK spelling. */ + { "licence", 0, 0, NULL, NULL, showcopyright }, + /* US spelling. */ + { "license", 0, 0, NULL, NULL, showcopyright }, + { NULL, 0, 0, NULL, NULL, NULL } }; static void setaction(const struct cmdinfo *cip, const char *value) { @@ -198,12 +200,12 @@ int main(int argc, const char *const *argv) { jmp_buf ejbuf; setlocale(LC_NUMERIC, "POSIX"); - standard_startup(&ejbuf, argc, &argv, NULL, 0, cmdinfos); + standard_startup(&ejbuf, argc, &argv, NULL, NULL, cmdinfos); if (!cipaction) badusage(_("need an action option")); unsetenv("GZIP"); action(argv); - standard_shutdown(0); + standard_shutdown(NULL); exit(0); } diff --git a/dpkg-split/join.c b/dpkg-split/join.c index 4add3904..7fd789fc 100644 --- a/dpkg-split/join.c +++ b/dpkg-split/join.c @@ -114,7 +114,8 @@ void do_join(const char *const *argv) { if (!refi || pq->info.thispartn < refi->thispartn) refi= &pq->info; assert(refi); partlist= nfmalloc(sizeof(struct partinfo*)*refi->maxpartn); - for (i=0; imaxpartn; i++) partlist[i]= 0; + for (i = 0; i < refi->maxpartn; i++) + partlist[i] = NULL; for (pq= queue; pq; pq= pq->nextinqueue) { pi= &pq->info; addtopartlist(partlist,pi,refi); diff --git a/dpkg-split/queue.c b/dpkg-split/queue.c index 342d19fd..bcf7ffe0 100644 --- a/dpkg-split/queue.c +++ b/dpkg-split/queue.c @@ -120,7 +120,8 @@ void do_auto(const char *const *argv) { fclose(part); scandepot(); partlist= nfmalloc(sizeof(struct partinfo*)*refi->maxpartn); - for (i=0; imaxpartn; i++) partlist[i]= 0; + for (i = 0; i < refi->maxpartn; i++) + partlist[i] = NULL; for (pq= queue; pq; pq= pq->nextinqueue) { pi= &pq->info; if (!partmatches(pi,refi)) continue; diff --git a/lib/dpkg.h b/lib/dpkg.h index 9a0808d8..d49fdbd1 100644 --- a/lib/dpkg.h +++ b/lib/dpkg.h @@ -175,7 +175,7 @@ extern const char printforhelp[]; if (setjmp(*ejbuf)) { /* expect warning about possible clobbering of argv */\ error_unwind(ehflag_bombout); exit(2);\ }\ - push_error_handler(ejbuf,print_error_fatal,0);\ + push_error_handler(ejbuf, print_error_fatal, NULL); \ umask(022); /* Make sure all our status databases are readable. */\ if (loadcfg)\ loadcfgfile(prog, cmdinfos);\ @@ -183,7 +183,7 @@ extern const char printforhelp[]; } while (0) #define standard_shutdown(freemem) do {\ - set_error_display(0,0);\ + set_error_display(NULL, NULL); \ error_unwind(ehflag_normaltidy);\ if (freemem)\ nffreeall();\ @@ -284,14 +284,14 @@ struct buffer_data { if (lseek(fd, limit, SEEK_CUR) == -1) { \ if(errno != ESPIPE) ohshite(__VA_ARGS__); \ buffer_copy_setup_IntPtr(fd, BUFFER_READ_FD, NULL, \ - 0, BUFFER_WRITE_NULL, NULL, \ + NULL, BUFFER_WRITE_NULL, NULL, \ limit, __VA_ARGS__);\ } # define stream_null_copy(file, limit, ...) \ if (fseek(file, limit, SEEK_CUR) == -1) { \ if(errno != EBADF) ohshite(__VA_ARGS__); \ buffer_copy_setup_PtrPtr(file, BUFFER_READ_STREAM, NULL, \ - 0, BUFFER_WRITE_NULL, NULL, \ + NULL, BUFFER_WRITE_NULL, NULL, \ limit, __VA_ARGS__);\ } # define stream_fd_copy(file, fd, limit, ...)\ @@ -323,14 +323,14 @@ struct buffer_data { if (lseek(fd, limit, SEEK_CUR) == -1) { \ if(errno != ESPIPE) ohshite(desc); \ buffer_copy_setup_IntPtr(fd, BUFFER_READ_FD, NULL, \ - 0, BUFFER_WRITE_NULL, NULL, \ + NULL, BUFFER_WRITE_NULL, NULL, \ limit, desc);\ } # define stream_null_copy(file, limit, desc...) \ if (fseek(file, limit, SEEK_CUR) == -1) { \ if(errno != EBADF) ohshite(desc); \ buffer_copy_setup_PtrPtr(file, BUFFER_READ_STREAM, NULL, \ - 0, BUFFER_WRITE_NULL, NULL, \ + NULL, BUFFER_WRITE_NULL, NULL, \ limit, desc);\ } # define stream_fd_copy(file, fd, limit, desc...)\ diff --git a/src/archives.c b/src/archives.c index 2309371c..60ee2d54 100644 --- a/src/archives.c +++ b/src/archives.c @@ -149,7 +149,7 @@ static void ensureobstackinit(void) { /* destroy the obstack */ static void destroyobstack(void) { if (tarobs_init) { - obstack_free(&tar_obs, 0); + obstack_free(&tar_obs, NULL); tarobs_init= 0; } } @@ -234,7 +234,7 @@ int fnameidlu; struct varbuf fnamevb; struct varbuf fnametmpvb; struct varbuf fnamenewvb; -struct packageinlist *deconfigure= 0; +struct packageinlist *deconfigure = NULL; static time_t currenttime; @@ -322,7 +322,9 @@ struct fileinlist *addfiletolist(struct tarcontext *tc, nifd= obstack_alloc(&tar_obs, sizeof(struct fileinlist)); nifd->namenode= namenode; - nifd->next= 0; *tc->newfilesp= nifd; tc->newfilesp= &nifd->next; + nifd->next = NULL; + *tc->newfilesp = nifd; + tc->newfilesp = &nifd->next; return nifd; } @@ -583,7 +585,7 @@ int tarobject(struct TarInfo *ti) { if (keepexisting) { obstack_free(&tar_obs, nifd); tc->newfilesp= oldnifd; - *oldnifd = 0; + *oldnifd = NULL; /* We need to advance the tar file to the next object, so read the * file data and set it to oblivion. @@ -602,7 +604,7 @@ int tarobject(struct TarInfo *ti) { * if something goes wrong. Watch out for the CLEANUP comments to * keep an eye on what's installed on the disk at each point. */ - push_cleanup(cu_installnew,~ehflag_normaltidy, 0,0, 1,(void*)nifd); + push_cleanup(cu_installnew, ~ehflag_normaltidy, NULL, 0, 1, (void *)nifd); /* CLEANUP: Now we either have the old file on the disk, or not, in * its original filename. @@ -648,7 +650,7 @@ int tarobject(struct TarInfo *ti) { */ fd= open(fnamenewvb.buf, (O_CREAT|O_EXCL|O_WRONLY), 0); if (fd < 0) ohshite(_("unable to create `%.255s'"),ti->Name); - push_cleanup(cu_closefd,ehflag_bombout, 0,0, 1,&fd); + push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd); debug(dbg_eachfiledetail,"tarobject NormalFile[01] open size=%lu", (unsigned long)ti->Size); { char fnamebuf[256]; @@ -898,7 +900,7 @@ void check_breaks(struct dependency *dep, struct pkginfo *pkg, varbufinit(&why); - fixbydeconf= 0; + fixbydeconf = NULL; if (depisok(dep, &why, &fixbydeconf, 0)) { varbuffree(&why); return; @@ -918,7 +920,7 @@ void check_breaks(struct dependency *dep, struct pkginfo *pkg, fixbydeconf->name, action); ok= try_deconfigure_can(force_breaks, fixbydeconf, dep->list, - action, 0, why.buf); + action, NULL, why.buf); if (ok == 1) { fprintf(stderr, _("dpkg: yes, will deconfigure %s (broken by %s).\n"), fixbydeconf->name, pkg->name); @@ -957,7 +959,7 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg, varbufinit(&conflictwhy); varbufinit(&removalwhy); - fixbyrm= 0; + fixbyrm = NULL; if (depisok(dep, &conflictwhy, &fixbyrm, 0)) { varbuffree(&conflictwhy); varbuffree(&removalwhy); @@ -981,14 +983,15 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg, fprintf(stderr, _("%s is not properly installed - ignoring any dependencies on it.\n"), fixbyrm->name); - pdep= 0; + pdep = NULL; } else { for (pdep= fixbyrm->installed.depended; pdep; pdep= pdep->nextrev) { if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends) continue; - if (depisok(pdep->up, &removalwhy, 0,0)) continue; + if (depisok(pdep->up, &removalwhy, NULL, 0)) + continue; varbufaddc(&removalwhy,0); if (!try_remove_can(pdep,fixbyrm,removalwhy.buf)) break; @@ -1004,7 +1007,8 @@ void check_conflict(struct dependency *dep, struct pkginfo *pkg, pdep= pdep->nextrev) { if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends) continue; - if (depisok(pdep->up, &removalwhy, 0,0)) continue; + if (depisok(pdep->up, &removalwhy, NULL, 0)) + continue; varbufaddc(&removalwhy,0); fprintf(stderr, _("dpkg" ": may have trouble removing %s, as it provides %s ...\n"), @@ -1117,7 +1121,7 @@ void archivefiles(const char *const *argv) { arglist[i++] = "-type"; arglist[i++] = "f"; arglist[i++] = "-print0"; - arglist[i++] = 0; + arglist[i++] = NULL; execvp(FIND, (char *const *)arglist); ohshite(_("failed to exec find for --recursive")); } @@ -1148,7 +1152,7 @@ void archivefiles(const char *const *argv) { arglist[i++]= p; while ((c= *p++) != 0); } - arglist[i]= 0; + arglist[i] = NULL; argp= arglist; } else { @@ -1159,7 +1163,7 @@ void archivefiles(const char *const *argv) { } - currenttime= time(0); + currenttime = time(NULL); varbufinit(&fnamevb); varbufinit(&fnametmpvb); @@ -1173,7 +1177,7 @@ void archivefiles(const char *const *argv) { ensure_diversions(); ensure_statoverrides(); - while ((thisarg= *argp++) != 0) { + while ((thisarg = *argp++) != NULL) { if (setjmp(ejbuf)) { error_unwind(ehflag_bombout); if (onerr_abort > 0) break; @@ -1185,7 +1189,7 @@ void archivefiles(const char *const *argv) { if (ferror(stdout)) werr("stdout"); if (ferror(stderr)) werr("stderr"); onerr_abort--; - set_error_display(0,0); + set_error_display(NULL, NULL); error_unwind(ehflag_normaltidy); } @@ -1271,7 +1275,7 @@ struct fileinlist *newconff_append(struct fileinlist ***newconffileslastp_io, struct fileinlist *newconff; newconff= m_malloc(sizeof(struct fileinlist)); - newconff->next= 0; + newconff->next = NULL; newconff->namenode= namenode; **newconffileslastp_io= newconff; *newconffileslastp_io= &newconff->next; diff --git a/src/configure.c b/src/configure.c index 2b21dafb..800054f8 100644 --- a/src/configure.c +++ b/src/configure.c @@ -81,7 +81,7 @@ void deferred_configure(struct pkginfo *pkg) { char *cdr2rest; int ok, r, useredited, distedited; struct conffile *conff; - char *currenthash= 0, *newdisthash= 0; + char *currenthash = NULL, *newdisthash = NULL; struct stat stab; enum conffopt what; static const char *EMPTY_HASH = "-"; @@ -100,7 +100,7 @@ void deferred_configure(struct pkginfo *pkg) { sincenothing= 0; varbufinit(&aemsgs); - ok= dependencies_ok(pkg,0,&aemsgs); + ok = dependencies_ok(pkg, NULL, &aemsgs); if (ok == 1) { varbuffree(&aemsgs); pkg->clientdata->istobe= itb_installnew; @@ -313,7 +313,7 @@ void deferred_configure(struct pkginfo *pkg) { * Returns 0 if everything went ok, -1 otherwise. */ int conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) { - static char* linkreadbuf = 0; + static char *linkreadbuf = NULL; static int linkreadbufsize = 0; struct stat stab; int r, need; @@ -405,7 +405,7 @@ static void md5hash(struct pkginfo *pkg, char **hashbuf, const char *fn) { fd=open(fn,O_RDONLY); if (fd>=0) { - push_cleanup(cu_closefd,ehflag_bombout, 0,0, 1,&fd); + push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd); fd_md5(fd, hashbuf, -1, _("md5hash")); pop_cleanup(ehflag_normaltidy); /* fd= open(cdr.buf) */ close(fd); diff --git a/src/depcon.c b/src/depcon.c index 5f7f2854..30e59366 100644 --- a/src/depcon.c +++ b/src/depcon.c @@ -108,7 +108,7 @@ static int findbreakcyclerecursive(struct pkginfo *pkg, struct cyclesofarlink *s } thislink.pkg= pkg; thislink.back= sofar; - thislink.possi= 0; + thislink.possi = NULL; for (dep= pkg->installed.depends; dep; dep= dep->next) { if (dep->type != dep_depends && dep->type != dep_predepends) continue; for (possi= dep->list; possi; possi= possi->next) { @@ -144,7 +144,7 @@ int findbreakcycle(struct pkginfo *pkg) { tpkg->color = white; } - return findbreakcyclerecursive(pkg, 0); + return findbreakcyclerecursive(pkg, NULL); } void describedepcon(struct varbuf *addto, struct dependency *dep) { @@ -217,7 +217,8 @@ int depisok(struct dependency *dep, struct varbuf *whynot, dep->type == dep_recommends || dep->type == dep_suggests || dep->type == dep_enhances); - if (canfixbyremove) *canfixbyremove= 0; + if (canfixbyremove) + *canfixbyremove = NULL; /* The dependency is always OK if we're trying to remove the depend*ing* * package. @@ -450,7 +451,8 @@ int depisok(struct dependency *dep, struct varbuf *whynot, provider->up->up->name, possi->ed->name); varbufaddstr(whynot, linebuf); /* We can't remove the one we're about to install: */ - if (canfixbyremove) *canfixbyremove= 0; + if (canfixbyremove) + *canfixbyremove = NULL; return 0; } @@ -499,7 +501,8 @@ int depisok(struct dependency *dep, struct varbuf *whynot, } if (!nconflicts) return 1; - if (nconflicts>1) *canfixbyremove= 0; + if (nconflicts > 1) + *canfixbyremove = NULL; return 0; } /* if (dependency) {...} else {...} */ diff --git a/src/enquiry.c b/src/enquiry.c index 0fd83bd2..7e29606b 100644 --- a/src/enquiry.c +++ b/src/enquiry.c @@ -52,7 +52,7 @@ static void limiteddescription(struct pkginfo *pkg, int maxl, const char *pdesc, *p; int l; - pdesc= pkg->installed.valid ? pkg->installed.description : 0; + pdesc = pkg->installed.valid ? pkg->installed.description : NULL; if (!pdesc) pdesc= _("(no description available)"); p= strchr(pdesc,'\n'); if (!p) p= pdesc+strlen(pdesc); @@ -97,7 +97,7 @@ static const struct badstatinfo badstatinfos[]= { "installation. The installation can probably be completed by retrying it;\n" "the packages can be removed using dselect or dpkg --remove:\n") }, { - 0 + NULL } }; @@ -175,7 +175,7 @@ void unpackchk(const char *const *argv) { modstatdb_init(admindir,msdbrw_readonly|msdbrw_noavail); totalcount= 0; - sectionentries= 0; + sectionentries = NULL; sects= 0; it= iterpkgstart(); while ((pkg= iterpkgnext(it))) { @@ -201,7 +201,8 @@ void unpackchk(const char *const *argv) { if (totalcount <= 12) { it= iterpkgstart(); while ((pkg= iterpkgnext(it))) { - if (!yettobeunpacked(pkg,0)) continue; + if (!yettobeunpacked(pkg, NULL)) + continue; describebriefly(pkg); } iterpkgend(it); @@ -248,7 +249,7 @@ static void assertversion(const char *const *argv, if (verrev_buf->epoch == ~0UL) { verrev_buf->epoch= 0; verrev_buf->version= nfstrsave(reqversion); - verrev_buf->revision= 0; + verrev_buf->revision = NULL; } pkg= findpackage("dpkg"); switch (pkg->status) { @@ -267,22 +268,22 @@ static void assertversion(const char *const *argv, } void assertpredep(const char *const *argv) { - static struct versionrevision predepversion = {~0UL,0,0}; + static struct versionrevision predepversion = { ~0UL, NULL, NULL }; assertversion(argv,&predepversion,"1.1.0"); } void assertepoch(const char *const *argv) { - static struct versionrevision epochversion = {~0UL,0,0}; + static struct versionrevision epochversion = { ~0UL, NULL, NULL }; assertversion(argv,&epochversion,"1.4.0.7"); } void assertlongfilenames(const char *const *argv) { - static struct versionrevision epochversion = {~0UL,0,0}; + static struct versionrevision epochversion = { ~0UL, NULL, NULL }; assertversion(argv,&epochversion,"1.4.1.17"); } void assertmulticonrep(const char *const *argv) { - static struct versionrevision epochversion = {~0UL,0,0}; + static struct versionrevision epochversion = { ~0UL, NULL, NULL }; assertversion(argv,&epochversion,"1.4.1.19"); } @@ -300,7 +301,7 @@ void predeppackage(const char *const *argv) { static struct varbuf vb; struct pkgiterator *it; - struct pkginfo *pkg= 0, *startpkg, *trypkg; + struct pkginfo *pkg = NULL, *startpkg, *trypkg; struct dependency *dep; struct deppossi *possi, *provider; @@ -309,7 +310,7 @@ void predeppackage(const char *const *argv) { modstatdb_init(admindir,msdbrw_readonly); clear_istobes(); /* We use clientdata->istobe to detect loops */ - for (it=iterpkgstart(), dep=0; + for (it = iterpkgstart(), dep = NULL; !dep && (pkg=iterpkgnext(it)); ) { if (pkg->want != want_install) continue; /* Ignore packages user doesn't want */ @@ -317,7 +318,8 @@ void predeppackage(const char *const *argv) { pkg->clientdata->istobe= itb_preinstall; for (dep= pkg->available.depends; dep; dep= dep->next) { if (dep->type != dep_predepends) continue; - if (depisok(dep,&vb,0,1)) continue; + if (depisok(dep, &vb, NULL, 1)) + continue; break; /* This will leave dep non-NULL, and so exit the loop. */ } pkg->clientdata->istobe= itb_normal; @@ -334,7 +336,7 @@ void predeppackage(const char *const *argv) { */ do { /* We search for a package which would satisfy dep, and put it in pkg */ - for (possi=dep->list, pkg=0; + for (possi = dep->list, pkg = NULL; !pkg && possi; possi=possi->next) { trypkg= possi->ed; @@ -363,7 +365,8 @@ void predeppackage(const char *const *argv) { pkg->clientdata->istobe= itb_preinstall; for (dep= pkg->available.depends; dep; dep= dep->next) { if (dep->type != dep_predepends) continue; - if (depisok(dep,&vb,0,1)) continue; + if (depisok(dep, &vb, NULL, 1)) + continue; break; /* This will leave dep non-NULL, and so exit the loop. */ } } while (dep); @@ -407,7 +410,7 @@ void cmpversions(const char *const *argv) { { ">", 1,0,0, 1,0,0 }, /* */ { ">=", 1,0,0, 1,0,0 }, { ">>", 1,1,0, 1,1,0 }, - { 0 } + { NULL } }; const struct relationinfo *rip; diff --git a/src/errors.c b/src/errors.c index b87d850d..ab2c9d27 100644 --- a/src/errors.c +++ b/src/errors.c @@ -46,7 +46,7 @@ struct error_report { const char *what; }; -static struct error_report *reports=0; +static struct error_report *reports = NULL; static struct error_report **lastreport= &reports; static struct error_report emergency; @@ -81,7 +81,7 @@ void print_error_perpackage(const char *emsg, const char *arg) { nr= &emergency; } nr->what= arg; - nr->next= 0; + nr->next = NULL; *lastreport= nr; lastreport= &nr->next; diff --git a/src/filesdb.c b/src/filesdb.c index 6ac572b7..425e7669 100644 --- a/src/filesdb.c +++ b/src/filesdb.c @@ -42,9 +42,9 @@ static int allpackagesdone= 0; static int nfiles= 0; -static struct diversion *diversions= 0; -static FILE *diversionsfile= 0; -static FILE *statoverridefile= 0; +static struct diversion *diversions = NULL; +static FILE *diversionsfile = NULL; +static FILE *statoverridefile = NULL; void note_must_reread_files_inpackage(struct pkginfo *pkg) { allpackagesdone= 0; @@ -95,7 +95,7 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { * the list is null-pointer-terminated. */ packageslump->pkgs[search]= packageslump->pkgs[findlast]; - packageslump->pkgs[findlast]= 0; + packageslump->pkgs[findlast] = NULL; /* This may result in an empty link in the list. This is OK. */ goto xit_search_to_delete_from_perfilenodelist; } @@ -105,7 +105,7 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { * we shouldn't free them. */ } - pkg->clientdata->files= 0; + pkg->clientdata->files = NULL; /* Packages which aren't installed don't have a files list. */ if (pkg->status == stat_notinstalled) { @@ -128,12 +128,12 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { _("dpkg: serious warning: files list file for package `%.250s' missing," " assuming package has no files currently installed.\n"), pkg->name); } - pkg->clientdata->files= 0; + pkg->clientdata->files = NULL; pkg->clientdata->fileslistvalid= 1; return; } - push_cleanup(cu_closefd,ehflag_bombout, 0,0, 1,&fd); + push_cleanup(cu_closefd, ehflag_bombout, NULL, 0, 1, &fd); if(fstat(fd, &stat_buf)) ohshite("unable to stat files list file for package `%.250s'",pkg->name); @@ -159,7 +159,7 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { *ptr = 0; newent= nfmalloc(sizeof(struct fileinlist)); newent->namenode= findnamenode(thisline, fnn_nocopy); - newent->next= 0; + newent->next = NULL; *lendp= newent; lendp= &newent->next; thisline = nextline; @@ -177,7 +177,8 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { if (packageslump) { for (; putat < PERFILEPACKAGESLUMP && packageslump->pkgs[putat]; putat++); - if (putat >= PERFILEPACKAGESLUMP) packageslump= 0; + if (putat >= PERFILEPACKAGESLUMP) + packageslump = NULL; } if (!packageslump) { packageslump= nfmalloc(sizeof(struct filepackages)); @@ -186,7 +187,8 @@ void ensure_packagefiles_available(struct pkginfo *pkg) { putat= 0; } packageslump->pkgs[putat]= pkg; - if (++putat < PERFILEPACKAGESLUMP) packageslump->pkgs[putat]= 0; + if (++putat < PERFILEPACKAGESLUMP) + packageslump->pkgs[putat] = NULL; } pkg->clientdata->fileslistvalid= 1; } @@ -201,7 +203,8 @@ void ensure_allinstfiles_available(void) { printf(_("(Reading database ... ")); } it= iterpkgstart(); - while ((pkg= iterpkgnext(it)) != 0) ensure_packagefiles_available(pkg); + while ((pkg = iterpkgnext(it)) != NULL) + ensure_packagefiles_available(pkg); iterpkgend(it); allpackagesdone= 1; @@ -238,7 +241,7 @@ void write_filelist_except(struct pkginfo *pkg, struct fileinlist *list, int lea file= fopen(newvb.buf,"w+"); if (!file) ohshite(_("unable to create updated files list file for package %s"),pkg->name); - push_cleanup(cu_closefile,ehflag_bombout, 0,0, 1,(void*)file); + push_cleanup(cu_closefile, ehflag_bombout, NULL, 0, 1, (void *)file); while (list) { if (!(leaveout && (list->namenode->flags & fnnf_elide_other_lists))) { fputs(list->namenode->name,file); @@ -271,7 +274,7 @@ void reversefilelist_init(struct reversefilelistiter *iterptr, */ struct fileinlist *newent; - iterptr->todo= 0; + iterptr->todo = NULL; while (files) { newent= m_malloc(sizeof(struct fileinlist)); newent->namenode= files->namenode; @@ -286,7 +289,8 @@ struct filenamenode *reversefilelist_next(struct reversefilelistiter *iterptr) { struct fileinlist *todo; todo= iterptr->todo; - if (!todo) return 0; + if (!todo) + return NULL; ret= todo->namenode; iterptr->todo= todo->next; free(todo); @@ -460,10 +464,10 @@ void ensure_diversions(void) { setcloexec(fileno(diversionsfile), vb.buf); for (ov= diversions; ov; ov= ov->next) { - ov->useinstead->divert->camefrom->divert= 0; - ov->useinstead->divert= 0; + ov->useinstead->divert->camefrom->divert = NULL; + ov->useinstead->divert = NULL; } - diversions= 0; + diversions = NULL; if (!file) { onerr_abort--; return; } while (fgets(linebuf,sizeof(linebuf),file)) { @@ -475,7 +479,7 @@ void ensure_diversions(void) { if (linebuf[--l] != '\n') ohshit(_("diversions file has too-long line or EOF [i]")); linebuf[l]= 0; oialtname->camefrom= findnamenode(linebuf, 0); - oialtname->useinstead= 0; + oialtname->useinstead = NULL; if (!fgets(linebuf,sizeof(linebuf),file)) { if (ferror(file)) ohshite(_("read error in diversions [ii]")); @@ -486,7 +490,7 @@ void ensure_diversions(void) { if (linebuf[--l] != '\n') ohshit(_("diversions file has too-long line or EOF [ii]")); linebuf[l]= 0; oicontest->useinstead= findnamenode(linebuf, 0); - oicontest->camefrom= 0; + oicontest->camefrom = NULL; if (!fgets(linebuf,sizeof(linebuf),file)) { if (ferror(file)) ohshite(_("read error in diversions [iii]")); @@ -498,7 +502,7 @@ void ensure_diversions(void) { linebuf[l]= 0; oicontest->pkg= oialtname->pkg= - strcmp(linebuf,":") ? findpackage(linebuf) : 0; + strcmp(linebuf, ":") ? findpackage(linebuf) : NULL; if (oialtname->camefrom->divert || oicontest->useinstead->divert) ohshit(_("conflicting diversions involving `%.250s' or `%.250s'"), @@ -531,7 +535,7 @@ static struct filenamenode *bins[BINS]; struct fileiterator *iterfilestart(void) { struct fileiterator *i; i= m_malloc(sizeof(struct fileiterator)); - i->namenode= 0; + i->namenode = NULL; i->nbinn= 0; return i; } @@ -540,7 +544,8 @@ struct filenamenode *iterfilenext(struct fileiterator *i) { struct filenamenode *r= NULL; while (!i->namenode) { - if (i->nbinn >= BINS) return 0; + if (i->nbinn >= BINS) + return NULL; i->namenode= bins[i->nbinn++]; } r= i->namenode; @@ -559,8 +564,8 @@ void filesdbinit(void) { for (i=0; inext) { fnn->flags= 0; - fnn->oldhash= 0; - fnn->filestat= 0; + fnn->oldhash = NULL; + fnn->filestat = NULL; } } @@ -587,7 +592,7 @@ struct filenamenode *findnamenode(const char *name, enum fnnflags flags) { if (*pointerp) return *pointerp; newnode= nfmalloc(sizeof(struct filenamenode)); - newnode->packages= 0; + newnode->packages = NULL; if((flags & fnn_nocopy) && name > orig_name && name[-1] == '/') newnode->name = name - 1; else { @@ -596,10 +601,10 @@ struct filenamenode *findnamenode(const char *name, enum fnnflags flags) { newnode->name= newname; } newnode->flags= 0; - newnode->next= 0; - newnode->divert= 0; - newnode->statoverride= 0; - newnode->filestat= 0; + newnode->next = NULL; + newnode->divert = NULL; + newnode->statoverride = NULL; + newnode->filestat = NULL; *pointerp= newnode; nfiles++; diff --git a/src/help.c b/src/help.c index 7f29543b..5c0b8009 100644 --- a/src/help.c +++ b/src/help.c @@ -73,7 +73,9 @@ void checkpath(void) { #if WITH_START_STOP_DAEMON "start-stop-daemon", #endif - "install-info", "update-rc.d", 0 + "install-info", + "update-rc.d", + NULL }; struct stat stab; @@ -116,7 +118,7 @@ void ensure_package_clientdata(struct pkginfo *pkg) { pkg->clientdata= nfmalloc(sizeof(struct perpackagestate)); pkg->clientdata->istobe= itb_normal; pkg->clientdata->fileslistvalid= 0; - pkg->clientdata->files= 0; + pkg->clientdata->files = NULL; } void cu_closepipe(int argc, void **argv) { @@ -209,7 +211,7 @@ static char *const *vbuildarglist(const char *scriptname, va_list ap) { if (!nextarg) break; bufs[i++]= nextarg; } - bufs[i]= 0; + bufs[i] = NULL; return bufs; } @@ -229,7 +231,7 @@ static struct sigaction script_uncatchsignal[NSCRIPTCATCHSIGNALS]; static void cu_restorescriptsignals(int argc, void **argv) { int i; for (i=0; iclientdata->istobe= itb_normal; pkg->clientdata->replacingfilesandsaid= 0; diff --git a/src/main.c b/src/main.c index 86614788..4f2f3d05 100644 --- a/src/main.c +++ b/src/main.c @@ -147,7 +147,7 @@ const char printforhelp[]= N_( "\n" "Options marked [*] produce a lot of output - pipe it through `less' or `more' !"); -const struct cmdinfo *cipaction= 0; +const struct cmdinfo *cipaction = NULL; int f_pending=0, f_recursive=0, f_alsoselect=1, f_skipsame=0, f_noact=0; int f_autodeconf=0, f_nodebsig=0; unsigned long f_debug=0; @@ -162,7 +162,7 @@ int fc_badverify = 0; int errabort = 50; const char *admindir= ADMINDIR; const char *instdir= ""; -struct packageinlist *ignoredependss=0; +struct packageinlist *ignoredependss = NULL; static const struct forceinfo { const char *name; @@ -190,7 +190,7 @@ static const struct forceinfo { { "bad-verify", &fc_badverify }, /* FIXME: obsolete options, remove in the future. */ { "auto-select", NULL }, - { 0 } + { NULL } }; static void helponly(const struct cmdinfo *cip, const char *value) NONRETURNING; @@ -268,7 +268,7 @@ static void ignoredepends(const struct cmdinfo *cip, const char *value) { } p= copy; while (*p) { - pnerr= illegal_packagename(p,0); + pnerr = illegal_packagename(p, NULL); if (pnerr) ohshite(_("--ignore-depends requires a legal package name. " "`%.250s' is not; %s"), p, pnerr); ni= m_malloc(sizeof(struct packageinlist)); @@ -384,11 +384,11 @@ static const struct cmdinfo cmdinfos[]= { * have a very similar structure. */ #define ACTION(longopt,shortopt,code,function) \ - { longopt, shortopt, 0,0,0, setaction, code, 0, (voidfnp)function } + { longopt, shortopt, 0, NULL, NULL, setaction, code, NULL, (voidfnp)function } #define OBSOLETE(longopt,shortopt) \ - { longopt, shortopt, 0,0,0, setobsolete, 0, 0, 0 } + { longopt, shortopt, 0, NULL, NULL, setobsolete, 0, NULL, NULL } #define ACTIONBACKEND(longopt,shortop, backend) \ - { longopt, shortop, 0,0,0, setaction, 0, (void*)backend, (voidfnp)execbackend } + { longopt, shortop, 0, NULL, NULL, setaction, 0, (void *)backend, (voidfnp)execbackend } ACTION( "install", 'i', act_install, archivefiles ), ACTION( "unpack", 0, act_unpack, archivefiles ), @@ -422,34 +422,38 @@ static const struct cmdinfo cmdinfos[]= { ACTION( "command-fd", 'c', act_commandfd, commandfd ), */ - { "status-fd", 0, 1, 0, 0, setpipe, 0, &status_pipes }, - { "log", 0, 1, 0, &log_file, 0 }, - { "pending", 'a', 0, &f_pending, 0, 0, 1 }, - { "recursive", 'R', 0, &f_recursive, 0, 0, 1 }, - { "no-act", 0, 0, &f_noact, 0, 0, 1 }, - { "dry-run", 0, 0, &f_noact, 0, 0, 1 }, - { "simulate", 0, 0, &f_noact, 0, 0, 1 }, - { "no-debsig", 0, 0, &f_nodebsig, 0, 0, 1 }, - { 0, 'G', 0, &fc_downgrade, 0, 0, /* alias for --refuse */ 0 }, - { "selected-only", 'O', 0, &f_alsoselect, 0, 0, 0 }, - { "no-also-select", 'N', 0, &f_alsoselect, 0,0,0 /* fixme: remove sometime */ }, - { "skip-same-version", 'E', 0, &f_skipsame, 0, 0, 1 }, - { "auto-deconfigure", 'B', 0, &f_autodeconf, 0, 0, 1 }, + { "status-fd", 0, 1, NULL, NULL, setpipe, 0, &status_pipes }, + { "log", 0, 1, NULL, &log_file, NULL, 0 }, + { "pending", 'a', 0, &f_pending, NULL, NULL, 1 }, + { "recursive", 'R', 0, &f_recursive, NULL, NULL, 1 }, + { "no-act", 0, 0, &f_noact, NULL, NULL, 1 }, + { "dry-run", 0, 0, &f_noact, NULL, NULL, 1 }, + { "simulate", 0, 0, &f_noact, NULL, NULL, 1 }, + { "no-debsig", 0, 0, &f_nodebsig, NULL, NULL, 1 }, + /* Alias ('G') for --refuse. */ + { NULL, 'G', 0, &fc_downgrade, NULL, NULL, 0 }, + { "selected-only", 'O', 0, &f_alsoselect, NULL, NULL, 0 }, + /* FIXME: Remove ('N') sometime. */ + { "no-also-select", 'N', 0, &f_alsoselect, NULL, NULL, 0 }, + { "skip-same-version", 'E', 0, &f_skipsame, NULL, NULL, 1 }, + { "auto-deconfigure", 'B', 0, &f_autodeconf, NULL, NULL, 1 }, OBSOLETE( "largemem", 0 ), OBSOLETE( "smallmem", 0 ), - { "root", 0, 1, 0, 0, setroot }, - { "abort-after", 0, 1, &errabort, 0, setinteger, 0 }, - { "admindir", 0, 1, 0, &admindir, 0 }, - { "instdir", 0, 1, 0, &instdir, 0 }, - { "ignore-depends", 0, 1, 0, 0, ignoredepends }, - { "force", 0, 2, 0, 0, setforce, 1 }, - { "refuse", 0, 2, 0, 0, setforce, 0 }, - { "no-force", 0, 2, 0, 0, setforce, 0 }, - { "debug", 'D', 1, 0, 0, setdebug }, - { "help", 'h', 0, 0, 0, helponly }, - { "version", 0, 0, 0, 0, versiononly }, - { "licence",/* UK spelling */ 0,0,0,0, showcopyright }, - { "license",/* US spelling */ 0,0,0,0, showcopyright }, + { "root", 0, 1, NULL, NULL, setroot, 0 }, + { "abort-after", 0, 1, &errabort, NULL, setinteger, 0 }, + { "admindir", 0, 1, NULL, &admindir, NULL, 0 }, + { "instdir", 0, 1, NULL, &instdir, NULL, 0 }, + { "ignore-depends", 0, 1, NULL, NULL, ignoredepends, 0 }, + { "force", 0, 2, NULL, NULL, setforce, 1 }, + { "refuse", 0, 2, NULL, NULL, setforce, 0 }, + { "no-force", 0, 2, NULL, NULL, setforce, 0 }, + { "debug", 'D', 1, NULL, NULL, setdebug, 0 }, + { "help", 'h', 0, NULL, NULL, helponly, 0 }, + { "version", 0, 0, NULL, NULL, versiononly, 0 }, + /* UK spelling. */ + { "licence", 0, 0, NULL, NULL, showcopyright, 0 }, + /* US spelling. */ + { "license", 0, 0, NULL, NULL, showcopyright, 0 }, ACTIONBACKEND( "build", 'b', BACKEND), ACTIONBACKEND( "contents", 'c', BACKEND), ACTIONBACKEND( "control", 'e', BACKEND), @@ -460,7 +464,7 @@ static const struct cmdinfo cmdinfos[]= { ACTIONBACKEND( "old", 0, BACKEND), ACTIONBACKEND( "vextract", 'X', BACKEND), ACTIONBACKEND( "fsys-tarfile", 0, BACKEND), - { 0, 0 } + { NULL, 0, 0, NULL, NULL, NULL, 0 } }; void execbackend(const char *const *argv) { @@ -471,7 +475,7 @@ void execbackend(const char *const *argv) { const char *const *arg = argv; int pass_admindir = 0; - while (*arg != 0) { + while (*arg != NULL) { arg++; argc++; } @@ -516,7 +520,7 @@ void execbackend(const char *const *argv) { if (!nargv[i]) ohshite(_("couldn't strdup in execbackend")); } - nargv[i] = 0; + nargv[i] = NULL; execvp(cipaction->parg, nargv); ohshite(_("failed to exec %s"), (char *)cipaction->parg); @@ -550,7 +554,7 @@ void commandfd(const char *const *argv) { const char **oldargs= NULL; int argc= 1, mode= 0; lno= 0; - push_error_handler(&ejbuf,print_error_fatal,0); + push_error_handler(&ejbuf, print_error_fatal, NULL); do { c= getc(in); if (c == '\n') lno++; } while (c != EOF && isspace(c)); if (c == EOF) break; @@ -597,7 +601,7 @@ printf("line=`%*s'\n",(int)linevb.used,linevb.buf); ptr++; } *ptr= 0; - newargs[argc++] = 0; + newargs[argc++] = NULL; /* We strdup each argument, but never free it, because the error messages * contain references back to these strings. Freeing them, and reusing @@ -613,7 +617,7 @@ printf("line=`%*s'\n",(int)linevb.used,linevb.buf); actionfunction= (void (*)(const char* const*))cipaction->farg; actionfunction(newargs); - set_error_display(0,0); + set_error_display(NULL, NULL); error_unwind(ehflag_normaltidy); } } @@ -626,7 +630,7 @@ int main(int argc, const char *const *argv) { standard_startup(&ejbuf, argc, &argv, DPKG, 1, cmdinfos); if (!cipaction) badusage(_("need an action option")); - setvbuf(stdout,0,_IONBF,0); + setvbuf(stdout, NULL, _IONBF, 0); filesdbinit(); actionfunction= (void (*)(const char* const*))cipaction->farg; diff --git a/src/packages.c b/src/packages.c index a88d81b4..59dce61d 100644 --- a/src/packages.c +++ b/src/packages.c @@ -45,7 +45,7 @@ struct pkginqueue { struct pkginfo *pkg; }; -static struct pkginqueue *queuehead= 0, **queuetail= &queuehead; +static struct pkginqueue *queuehead = NULL, **queuetail = &queuehead; int queuelen=0, sincenothing=0, dependtry=0; @@ -54,7 +54,7 @@ void add_to_queue(struct pkginfo *pkg) { newent= m_malloc(sizeof(struct pkginqueue)); newent->pkg= pkg; - newent->next= 0; + newent->next = NULL; *queuetail= newent; queuetail= &newent->next; @@ -79,7 +79,7 @@ void packages(const char *const *argv) { badusage(_("--%s --pending does not take any non-option arguments"),cipaction->olong); it= iterpkgstart(); - while ((pkg= iterpkgnext(it)) != 0) { + while ((pkg = iterpkgnext(it)) != NULL) { switch (cipaction->arg) { case act_configure: if (pkg->status != stat_unpacked && pkg->status != stat_halfconfigured) @@ -108,7 +108,7 @@ void packages(const char *const *argv) { if (!*argv) badusage(_("--%s needs at least one package name argument"), cipaction->olong); - while ((thisarg= *argv++) != 0) { + while ((thisarg = *argv++) != NULL) { pkg= findpackage(thisarg); if (pkg->status == stat_notinstalled) { l= strlen(pkg->name); @@ -158,7 +158,7 @@ void process_queue(void) { default: internerr("unknown action in duplicate"); } - rundown->pkg= 0; + rundown->pkg = NULL; } else { rundown->pkg->clientdata->istobe= istobe; } @@ -206,7 +206,7 @@ void process_queue(void) { } if (ferror(stdout)) werr("stdout"); if (ferror(stderr)) werr("stderr"); - set_error_display(0,0); + set_error_display(NULL, NULL); error_unwind(ehflag_normaltidy); } } @@ -401,7 +401,7 @@ int breakses_ok(struct pkginfo *pkg, struct varbuf *aemsgs) { debug(dbg_depcon, " checking Breaks"); - breaks_check_target(aemsgs, &ok, pkg, pkg, 0); + breaks_check_target(aemsgs, &ok, pkg, pkg, NULL); for (dep= pkg->installed.depends; dep; dep= dep->next) { if (dep->type != dep_provides) continue; @@ -437,7 +437,7 @@ int dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing, debug(dbg_depcondetail," break cycle so ok and found"); found= 3; break; } - thisf= deppossi_ok_found(possi->ed,pkg,removing,0, + thisf = deppossi_ok_found(possi->ed, pkg, removing, NULL, &matched,possi,&interestingwarnings,&oemsgs); if (thisf > found) found= thisf; if (found != 3 && possi->verrel == dvr_none) { @@ -448,7 +448,7 @@ int dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing, if (provider->up->type != dep_provides) continue; debug(dbg_depcondetail," checking provider %s",provider->up->up->name); thisf= deppossi_ok_found(provider->up->up,pkg,removing,possi->ed, - &matched,0,&interestingwarnings,&oemsgs); + &matched, NULL, &interestingwarnings, &oemsgs); if (thisf > found) found= thisf; } } diff --git a/src/processarc.c b/src/processarc.c index cb69504b..15504144 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -57,7 +57,7 @@ void process_archive(const char *filename) { */ static int p1[2]; static char cidirtmpnambuf[L_tmpnam+100]; - static char *cidirbuf=0, *reasmbuf=0; + static char *cidirbuf = NULL, *reasmbuf = NULL; static struct fileinlist *newconffiles, *newfileslist; static enum pkgstatus oldversionstatus; static struct varbuf infofnvb, fnvb, depprobwhy; @@ -110,7 +110,7 @@ void process_archive(const char *filename) { } if (unlink(reasmbuf) && errno != ENOENT) ohshite(_("error ensuring `%.250s' doesn't exist"),reasmbuf); - push_cleanup(cu_pathname,~0, 0,0, 1,(void*)reasmbuf); + push_cleanup(cu_pathname, ~0, NULL, 0, 1, (void *)reasmbuf); c1= m_fork(); if (!c1) { execlp(SPLITTER, SPLITTER, "-Qao", reasmbuf, filename, NULL); @@ -180,7 +180,7 @@ void process_archive(const char *filename) { assert(*cidir && cidirrest[-1] == '/'); cidirrest[-1]= 0; ensure_pathname_nonexisting(cidir); cidirrest[-1]= '/'; - push_cleanup(cu_cidir,~0, 0,0, 2,(void*)cidir,(void*)cidirrest); + push_cleanup(cu_cidir, ~0, NULL, 0, 2, (void *)cidir, (void *)cidirrest); c1= m_fork(); if (!c1) { cidirrest[-1]= 0; @@ -194,8 +194,8 @@ void process_archive(const char *filename) { &pkg,NULL,NULL); if (!pkg->files) { pkg->files= nfmalloc(sizeof(struct filedetails)); - pkg->files->next= 0; - pkg->files->name= pkg->files->msdosname= pkg->files->md5sum= 0; + pkg->files->next = NULL; + pkg->files->name = pkg->files->msdosname = pkg->files->md5sum = NULL; } /* Always nfmalloc. Otherwise, we may overwrite some other field(like md5sum). */ pkg->files->size= nfmalloc(30); @@ -223,7 +223,7 @@ void process_archive(const char *filename) { deconpiltemp= deconpil->next; free(deconpil); } - deconfigure= 0; + deconfigure = NULL; clear_istobes(); if (!wanttoinstall(pkg,&pkg->available.version,1)) { @@ -264,7 +264,7 @@ void process_archive(const char *filename) { /* Ignore these here. */ break; case dep_predepends: - if (!depisok(dsearch,&depprobwhy,0,1)) { + if (!depisok(dsearch, &depprobwhy, NULL, 1)) { varbufaddc(&depprobwhy,0); fprintf(stderr, _("dpkg: regarding %s containing %s, pre-dependency problem:\n%s"), pfilename, pkg->name, depprobwhy.buf); @@ -302,12 +302,13 @@ void process_archive(const char *filename) { /* OK, we're going ahead. First we read the conffiles, and copy the * hashes across. */ - newconffiles= 0; newconffileslastp= &newconffiles; - push_cleanup(cu_fileslist,~0, 0, 0, 0); + newconffiles = NULL; + newconffileslastp = &newconffiles; + push_cleanup(cu_fileslist, ~0, NULL, 0, 0); strcpy(cidirrest,CONFFILESFILE); conff= fopen(cidir,"r"); if (conff) { - push_cleanup(cu_closefile,ehflag_bombout, 0,0, 1,(void*)conff); + push_cleanup(cu_closefile, ehflag_bombout, NULL, 0, 1, (void *)conff); while (fgets(conffilenamebuf,MAXCONFFILENAME-2,conff)) { p= conffilenamebuf + strlen(conffilenamebuf); assert(p != conffilenamebuf); @@ -332,7 +333,7 @@ void process_archive(const char *filename) { * having that file. If several packages are listed as owning * the file we pick one at random. */ - searchconff= 0; + searchconff = NULL; for (packageslump= newconff->namenode->packages; packageslump; packageslump= packageslump->more) { @@ -390,7 +391,7 @@ void process_archive(const char *filename) { pkg->eflag |= eflagf_reinstreq; pkg->status= stat_halfconfigured; modstatdb_note(pkg); - push_cleanup(cu_prermupgrade,~ehflag_normaltidy, 0,0, 1,(void*)pkg); + push_cleanup(cu_prermupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg); maintainer_script_alternative(pkg, PRERMFILE, "pre-removal", cidir, cidirrest, "upgrade", "failed-upgrade"); pkg->status= stat_unpacked; @@ -441,7 +442,7 @@ void process_archive(const char *filename) { conflictor[i]->status == stat_installed)) continue; conflictor[i]->status= stat_halfconfigured; modstatdb_note(conflictor[i]); - push_cleanup(cu_prerminfavour,~ehflag_normaltidy, 0,0, + push_cleanup(cu_prerminfavour, ~ehflag_normaltidy, NULL, 0, 2,(void*)conflictor[i],(void*)pkg); maintainer_script_installed(conflictor[i], PRERMFILE, "pre-removal", "remove", "in-favour", pkg->name, @@ -458,19 +459,19 @@ void process_archive(const char *filename) { pkg->status= stat_halfinstalled; modstatdb_note(pkg); if (oldversionstatus == stat_notinstalled) { - push_cleanup(cu_preinstverynew,~ehflag_normaltidy, 0,0, + push_cleanup(cu_preinstverynew, ~ehflag_normaltidy, NULL, 0, 3,(void*)pkg,(void*)cidir,(void*)cidirrest); maintainer_script_new(pkg->name, PREINSTFILE, "pre-installation", cidir, cidirrest, "install", NULL); } else if (oldversionstatus == stat_configfiles) { - push_cleanup(cu_preinstnew,~ehflag_normaltidy, 0,0, + push_cleanup(cu_preinstnew, ~ehflag_normaltidy, NULL, 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), NULL); } else { - push_cleanup(cu_preinstupgrade,~ehflag_normaltidy, 0,0, + push_cleanup(cu_preinstupgrade, ~ehflag_normaltidy, NULL, 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, @@ -552,7 +553,7 @@ void process_archive(const char *filename) { */ m_pipe(p1); - push_cleanup(cu_closepipe,ehflag_bombout, 0,0, 1,(void*)&p1[0]); + push_cleanup(cu_closepipe, ehflag_bombout, NULL, 0, 1, (void *)&p1[0]); c1= m_fork(); if (!c1) { m_dup2(p1[1],1); close(p1[0]); close(p1[1]); @@ -561,11 +562,12 @@ void process_archive(const char *filename) { } close(p1[1]); - newfileslist= 0; tc.newfilesp= &newfileslist; - push_cleanup(cu_fileslist,~0, 0, 0, 0); + newfileslist = NULL; + tc.newfilesp = &newfileslist; + push_cleanup(cu_fileslist, ~0, NULL, 0, 0); tc.pkg= pkg; tc.backendpipe= p1[0]; - push_cleanup(cu_closefd,~ehflag_bombout, 0,0, 1,&tc.backendpipe); + push_cleanup(cu_closefd, ~ehflag_bombout, NULL, 0, 1, &tc.backendpipe); r= TarExtractor((void*)&tc, &tf); if (r) { @@ -585,7 +587,7 @@ void process_archive(const char *filename) { */ pkg->status= stat_halfinstalled; modstatdb_note(pkg); - push_cleanup(cu_postrmupgrade,~ehflag_normaltidy, 0,0, 1,(void*)pkg); + push_cleanup(cu_postrmupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg); maintainer_script_alternative(pkg, POSTRMFILE, "post-removal", cidir, cidirrest, "upgrade", "failed-upgrade"); } @@ -658,7 +660,7 @@ void process_archive(const char *filename) { * the process a little leaner. We are only worried about new ones * since ones that stayed the same don't really apply here. */ - struct fileinlist *sameas= 0; + struct fileinlist *sameas = NULL; /* If we can't stat the old or new file, or it's a directory, * we leave it up to the normal code */ @@ -749,8 +751,8 @@ void process_archive(const char *filename) { varbufaddc(&infofnvb,0); dsd= opendir(infofnvb.buf); if (!dsd) ohshite(_("cannot read info directory")); - push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd); - while ((de= readdir(dsd)) != 0) { + push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd); + while ((de = readdir(dsd)) != NULL) { debug(dbg_veryverbose, "process_archive info file `%s'", de->d_name); if (de->d_name[0] == '.') continue; /* ignore dotfiles, including `.' and `..' */ p= strrchr(de->d_name,'.'); if (!p) continue; /* ignore anything odd */ @@ -784,7 +786,7 @@ void process_archive(const char *filename) { *cidirrest= 0; /* the directory itself */ dsd= opendir(cidir); if (!dsd) ohshite(_("unable to open temp control directory")); - push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd); + push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd); while ((de= readdir(dsd))) { if (strchr(de->d_name,'.')) { debug(dbg_scripts,"process_archive tmp.ci script/file `%s' contains dot", @@ -835,17 +837,20 @@ void process_archive(const char *filename) { * links (linking our deppossi's into the reverse chains) * can be done by copy_dependency_links. */ - newdeplist= 0; newdeplistlastp= &newdeplist; + newdeplist = NULL; + newdeplistlastp = &newdeplist; for (dep= pkg->available.depends; dep; dep= dep->next) { newdep= nfmalloc(sizeof(struct dependency)); newdep->up= pkg; - newdep->next= 0; - newdep->list= 0; newpossilastp= &newdep->list; + newdep->next = NULL; + newdep->list = NULL; + newpossilastp = &newdep->list; for (possi= dep->list; possi; possi= possi->next) { newpossi= nfmalloc(sizeof(struct deppossi)); newpossi->up= newdep; newpossi->ed= possi->ed; - newpossi->next= 0; newpossi->nextrev= newpossi->backrev= 0; + newpossi->next = NULL; + newpossi->nextrev = newpossi->backrev = NULL; newpossi->verrel= possi->verrel; if (possi->verrel != dvr_none) newpossi->version= possi->version; @@ -883,10 +888,11 @@ void process_archive(const char *filename) { pkg->installed.bugs = pkg->available.bugs; /* We have to generate our own conffiles structure. */ - pkg->installed.conffiles= 0; iconffileslastp= &pkg->installed.conffiles; + pkg->installed.conffiles = NULL; + iconffileslastp = &pkg->installed.conffiles; for (cfile= newconffiles; cfile; cfile= cfile->next) { newiconff= nfmalloc(sizeof(struct conffile)); - newiconff->next= 0; + newiconff->next = NULL; newiconff->name= nfstrsave(cfile->namenode->name); newiconff->hash= nfstrsave(cfile->namenode->oldhash); newiconff->obsolete= !!(cfile->namenode->flags & fnnf_obs_conff); @@ -910,7 +916,7 @@ void process_archive(const char *filename) { * with them !). */ it= iterpkgstart(); - while ((otherpkg= iterpkgnext(it)) != 0) { + while ((otherpkg = iterpkgnext(it)) != NULL) { ensure_package_clientdata(otherpkg); if (otherpkg == pkg || otherpkg->status == stat_notinstalled || @@ -940,7 +946,8 @@ void process_archive(const char *filename) { pdep= pdep->nextrev) { if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends && pdep->up->type != dep_recommends) continue; - if (depisok(pdep->up, &depprobwhy, 0,0)) continue; + if (depisok(pdep->up, &depprobwhy, NULL, 0)) + continue; varbufaddc(&depprobwhy,0); debug(dbg_veryverbose,"process_archive cannot disappear: %s",depprobwhy.buf); break; @@ -957,7 +964,8 @@ void process_archive(const char *filename) { if (pdep->up->type != dep_depends && pdep->up->type != dep_predepends && pdep->up->type != dep_recommends) continue; - if (depisok(pdep->up, &depprobwhy, 0,0)) continue; + if (depisok(pdep->up, &depprobwhy, NULL, 0)) + continue; varbufaddc(&depprobwhy,0); debug(dbg_veryverbose,"process_archive cannot disappear (provides %s): %s", providecheck->list->ed->name, depprobwhy.buf); @@ -990,11 +998,11 @@ void process_archive(const char *filename) { infodirbaseused= fnvb.used; varbufaddc(&fnvb,0); dsd= opendir(fnvb.buf); if (!dsd) ohshite(_("cannot read info directory")); - push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd); + push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd); debug(dbg_general, "process_archive disappear cleaning info directory"); - while ((de= readdir(dsd)) != 0) { + while ((de = readdir(dsd)) != NULL) { debug(dbg_veryverbose, "process_archive info file `%s'", de->d_name); if (de->d_name[0] == '.') continue; p= strrchr(de->d_name,'.'); if (!p) continue; @@ -1014,15 +1022,15 @@ void process_archive(const char *filename) { otherpkg->want= want_purge; otherpkg->eflag= eflagv_ok; - otherpkg->installed.depends= 0; + otherpkg->installed.depends = NULL; otherpkg->installed.essential= 0; - otherpkg->installed.description= otherpkg->installed.maintainer= 0; - otherpkg->installed.installedsize= otherpkg->installed.source= 0; - otherpkg->installed.origin= otherpkg->installed.bugs= 0; - otherpkg->installed.architecture= 0; - otherpkg->installed.conffiles= 0; + otherpkg->installed.description = otherpkg->installed.maintainer = NULL; + otherpkg->installed.installedsize = otherpkg->installed.source = NULL; + otherpkg->installed.origin = otherpkg->installed.bugs = NULL; + otherpkg->installed.architecture = NULL; + otherpkg->installed.conffiles = NULL; blankversion(&otherpkg->installed.version); - otherpkg->installed.arbs= 0; + otherpkg->installed.arbs = NULL; otherpkg->clientdata->fileslistvalid= 0; modstatdb_note(otherpkg); @@ -1053,7 +1061,7 @@ void process_archive(const char *filename) { cfile->namenode->name, divpkg ? divpkg->name : ""); } } else { - divpkg= 0; + divpkg = NULL; debug(dbg_eachfile, "process_archive looking for overwriting `%s'", cfile->namenode->name); } diff --git a/src/remove.c b/src/remove.c index 09d5c14e..4a431678 100644 --- a/src/remove.c +++ b/src/remove.c @@ -169,7 +169,7 @@ void deferred_remove(struct pkginfo *pkg) { oldpkgstatus= pkg->status; pkg->status= stat_halfconfigured; modstatdb_note(pkg); - push_cleanup(cu_prermremove, ~ehflag_normaltidy, 0, 0, 2, + push_cleanup(cu_prermremove, ~ehflag_normaltidy, NULL, 0, 2, (void *)pkg, (void *)&oldpkgstatus); maintainer_script_installed(pkg, PRERMFILE, "pre-removal", "remove", NULL); @@ -208,7 +208,7 @@ static void removal_bulk_remove_files( push_checkpoint(~ehflag_bombout, ehflag_normaltidy); reversefilelist_init(&rlistit,pkg->clientdata->files); - leftover= 0; + leftover = NULL; while ((namenode= reversefilelist_next(&rlistit))) { debug(dbg_eachfile, "removal_bulk `%s' flags=%o", namenode->name, namenode->flags); @@ -291,12 +291,12 @@ static void removal_bulk_remove_files( infodirbaseused= fnvb.used; varbufaddc(&fnvb,0); dsd= opendir(fnvb.buf); if (!dsd) ohshite(_("cannot read info directory")); - push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd); + push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd); *out_foundpostrm= 0; debug(dbg_general, "removal_bulk cleaning info directory"); - while ((de= readdir(dsd)) != 0) { + while ((de = readdir(dsd)) != NULL) { char *p; debug(dbg_veryverbose, "removal_bulk info file `%s'", de->d_name); @@ -335,7 +335,7 @@ static void removal_bulk_remove_leftover_dirs(struct pkginfo *pkg) { push_checkpoint(~ehflag_bombout, ehflag_normaltidy); reversefilelist_init(&rlistit,pkg->clientdata->files); - leftover= 0; + leftover = NULL; while ((namenode= reversefilelist_next(&rlistit))) { debug(dbg_eachfile, "removal_bulk `%s' flags=%o", namenode->name, namenode->flags); @@ -391,7 +391,7 @@ static void removal_bulk_remove_leftover_dirs(struct pkginfo *pkg) { } static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { - static const char *const removeconffexts[]= { REMOVECONFFEXTS, 0 }; + static const char *const removeconffexts[] = { REMOVECONFFEXTS, NULL }; int r, removevbbase; int conffnameused, conffbasenamelen; char *conffbasename; @@ -416,7 +416,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { * are involved in diversions, except if we are the package doing the * diverting. */ - for (lconffp= &pkg->installed.conffiles; (conff= *lconffp) != 0; ) { + for (lconffp = &pkg->installed.conffiles; (conff = *lconffp) != NULL; ) { for (searchfile= pkg->clientdata->files; searchfile && strcmp(searchfile->namenode->name,conff->name); searchfile= searchfile->next); @@ -471,11 +471,11 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { fnvb.buf, conff->name); } debug(dbg_conffdetail, "removal_bulk conffile cleaning dsd %s", fnvb.buf); - push_cleanup(cu_closedir,~0, 0,0, 1,(void*)dsd); + push_cleanup(cu_closedir, ~0, NULL, 0, 1, (void *)dsd); *p= '/'; conffbasenamelen= strlen(++p); conffbasename= fnvb.buf+conffnameused-conffbasenamelen; - while ((de= readdir(dsd)) != 0) { + while ((de = readdir(dsd)) != NULL) { debug(dbg_stupidlyverbose, "removal_bulk conffile dsd entry=`%s'" " conffbasename=`%s' conffnameused=%d conffbasenamelen=%d", de->d_name, conffbasename, conffnameused, conffbasenamelen); @@ -509,7 +509,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { } - pkg->installed.conffiles= 0; + pkg->installed.conffiles = NULL; modstatdb_note(pkg); maintainer_script_installed(pkg, POSTRMFILE, "post-removal", @@ -586,14 +586,14 @@ void removal_bulk(struct pkginfo *pkg) { /* This will mess up reverse links, but if we follow them * we won't go back because pkg->status is stat_notinstalled. */ - pkg->installed.depends= 0; + pkg->installed.depends = NULL; pkg->installed.essential= 0; - pkg->installed.description= pkg->installed.maintainer= 0; - pkg->installed.source= pkg->installed.installedsize= 0; - pkg->installed.origin= pkg->installed.bugs= 0; - pkg->installed.architecture= 0; + pkg->installed.description = pkg->installed.maintainer = NULL; + pkg->installed.source = pkg->installed.installedsize = NULL; + pkg->installed.origin = pkg->installed.bugs = NULL; + pkg->installed.architecture = NULL; blankversion(&pkg->installed.version); - pkg->installed.arbs= 0; + pkg->installed.arbs = NULL; } pkg->eflag= eflagv_ok; diff --git a/src/update.c b/src/update.c index 14ba4eaf..1b14cb3c 100644 --- a/src/update.c +++ b/src/update.c @@ -79,10 +79,11 @@ void updateavailable(const char *const *argv) { varbufaddc(&vb,0); if (cipaction->arg == act_avmerge) - parsedb(vb.buf, pdb_recordavailable|pdb_rejectstatus, 0,0,0); + parsedb(vb.buf, pdb_recordavailable | pdb_rejectstatus, NULL, NULL, NULL); if (cipaction->arg != act_avclear) - count+= parsedb(sourcefile, pdb_recordavailable|pdb_rejectstatus, 0,0,0); + count += parsedb(sourcefile, pdb_recordavailable | pdb_rejectstatus, + NULL, NULL, NULL); if (!f_noact) { writedb(vb.buf,1,0); diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index 3140ceef..014a56c4 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -241,7 +241,7 @@ xmalloc(int size) static void xgettimeofday(struct timeval *tv) { - if (gettimeofday(tv,0) != 0) + if (gettimeofday(tv, NULL) != 0) fatal("gettimeofday failed: %s", strerror(errno)); } @@ -544,7 +544,7 @@ parse_options(int argc, char * const *argv) for (;;) { c = getopt_long(argc, argv, "HKSVa:n:op:qr:s:tu:vx:c:N:k:bmR:g:d:", - longopts, (int *) 0); + longopts, NULL); if (c == -1) break; switch (c) { @@ -907,11 +907,11 @@ pid_is_cmd(pid_t pid, const char *name) kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); - if (kd == 0) + if (kd == NULL) errx(1, "%s", errbuf); - if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0) + if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == NULL) errx(1, "%s", kvm_geterr(kd)); - if ((pid_argv_p = kvm_getargv(kd, kp, argv_len)) == 0) + if ((pid_argv_p = kvm_getargv(kd, kp, argv_len)) == NULL) errx(1, "%s", kvm_geterr(kd)); start_argv_0_p = *pid_argv_p; @@ -947,9 +947,9 @@ pid_is_user(pid_t pid, uid_t uid) kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); - if (kd == 0) + if (kd == NULL) errx(1, "%s", errbuf); - if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0) + if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == NULL) errx(1, "%s", kvm_geterr(kd)); if (kp->kp_proc.p_cred ) kvm_read(kd, (u_long)&(kp->kp_proc.p_cred->p_ruid), @@ -968,9 +968,9 @@ pid_is_exec(pid_t pid, const char *name) char errbuf[_POSIX2_LINE_MAX], *pidexec; kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); - if (kd == 0) + if (kd == NULL) errx(1, "%s", errbuf); - if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == 0) + if ((kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries)) == NULL) errx(1, "%s", kvm_geterr(kd)); pidexec = (&kp->kp_proc)->p_comm; if (strlen(name) != strlen(pidexec)) @@ -1203,7 +1203,7 @@ run_stop_schedule(void) interval.tv_usec <= MIN_POLL_INTERVAL) interval.tv_usec = MIN_POLL_INTERVAL; - r = select(0,0,0,0,&interval); + r = select(0, NULL, NULL, NULL, &interval); if (r < 0 && errno != EINTR) fatal("select() failed for pause: %s", strerror(errno));