The following commit has been merged in the master branch: commit 6431c053b78533afafb1193e1dc66391580e6eaf Author: Guillem Jover <guil...@debian.org> Date: Sat Mar 31 21:55:05 2012 +0200
Use cmp() == 0 instead of !cmp() diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index 361ba1e..d0b04a1 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -130,7 +130,7 @@ extracthalf(const char *debar, const char *dir, const char *taroption, if (r < 0) read_fail(r, debar, _("archive magic version number")); - if (!strcmp(versionbuf, DPKG_AR_MAGIC)) { + if (strcmp(versionbuf, DPKG_AR_MAGIC) == 0) { oldformat = false; ctrllennum= 0; @@ -216,7 +216,7 @@ extracthalf(const char *debar, const char *dir, const char *taroption, versionbuf, (intmax_t)stab.st_size, (intmax_t)ctrllennum); m_output(stdout, _("<standard output>")); } - } else if (!strncmp(versionbuf,"0.93",4) && + } else if (strncmp(versionbuf, "0.93", 4) == 0 && sscanf(versionbuf,"%f%c%d",&versionnum,&nlc,&dummy) == 2 && nlc == '\n') { char ctrllenbuf[40]; @@ -250,7 +250,7 @@ extracthalf(const char *debar, const char *dir, const char *taroption, m_output(stdout, _("<standard output>")); } } else { - if (!strncmp(versionbuf,"!<arch>",7)) { + if (strncmp(versionbuf, "!<arch>", 7) == 0) { fprintf(stderr, _("dpkg-deb: file looks like it might be an archive which has been\n" "dpkg-deb: corrupted by being downloaded in ASCII mode\n")); diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c index 5c1a153..53eb4cf 100644 --- a/dpkg-deb/info.c +++ b/dpkg-deb/info.c @@ -240,7 +240,7 @@ info_field(const char *debar, const char *dir, const char *const *fields, *pf = '\0'; doing= fnl >= MAXFIELDNAME || c=='\n' || c==EOF; for (fp=fields; !doing && *fp; fp++) - if (!strcasecmp(*fp, fieldname)) + if (strcasecmp(*fp, fieldname) == 0) doing = true; if (showfieldname) { if (doing) diff --git a/dpkg-split/queue.c b/dpkg-split/queue.c index 748f16c..2ed2866 100644 --- a/dpkg-split/queue.c +++ b/dpkg-split/queue.c @@ -115,7 +115,7 @@ static bool partmatches(struct partinfo *pi, struct partinfo *refi) { return (pi->md5sum && - !strcmp(pi->md5sum,refi->md5sum) && + strcmp(pi->md5sum, refi->md5sum) == 0 && pi->maxpartn == refi->maxpartn && pi->maxpartlen == refi->maxpartlen); } diff --git a/dpkg-split/split.c b/dpkg-split/split.c index cae4531..d18f81b 100644 --- a/dpkg-split/split.c +++ b/dpkg-split/split.c @@ -257,7 +257,7 @@ do_split(const char *const *argv) l = strlen(sourcefile); palloc = nfmalloc(l + 1); strcpy(palloc, sourcefile); - if (!strcmp(palloc + l - (sizeof(DEBEXT) - 1), DEBEXT)) { + if (strcmp(palloc + l - (sizeof(DEBEXT) - 1), DEBEXT) == 0) { l -= (sizeof(DEBEXT) - 1); palloc[l] = '\0'; } diff --git a/dselect/basecmds.cc b/dselect/basecmds.cc index 58a3110..cfe0f43 100644 --- a/dselect/basecmds.cc +++ b/dselect/basecmds.cc @@ -112,7 +112,7 @@ baselist::matchsearch(int index) searchlen=strlen(searchstring); lendiff = strlen(name) - searchlen; for (i=0; i<=lendiff; i++) - if (!strncasecmp(name + i, searchstring, searchlen)) + if (strncasecmp(name + i, searchstring, searchlen) == 0) return true; return false; diff --git a/dselect/bindings.cc b/dselect/bindings.cc index b544e29..a6440eb 100644 --- a/dselect/bindings.cc +++ b/dselect/bindings.cc @@ -97,7 +97,7 @@ const char **keybindings::describenext() { for (;;) { if (!iterate->action) return 0; for (count=0, search=bindings; search; search=search->next) - if (!strcmp(search->interp->action,iterate->action)) + if (strcmp(search->interp->action, iterate->action) == 0) count++; if (count) break; iterate++; @@ -105,7 +105,7 @@ const char **keybindings::describenext() { const char **retarray= new const char *[count+2]; retarray[0]= iterate->desc; for (count=1, search=bindings; search; search=search->next) - if (!strcmp(search->interp->action,iterate->action)) + if (strcmp(search->interp->action, iterate->action) == 0) retarray[count++]= key2name(search->key); retarray[count]= 0; iterate++; diff --git a/dselect/pkgcmds.cc b/dselect/pkgcmds.cc index 3fe71c4..a19fc64 100644 --- a/dselect/pkgcmds.cc +++ b/dselect/pkgcmds.cc @@ -195,7 +195,7 @@ void packagelist::resortredisplay() { int index; for (index=0; index<nitems; index++) { if (table[index]->pkg->set->name && - !strcasecmp(oldname, table[index]->pkg->set->name)) { + strcasecmp(oldname, table[index]->pkg->set->name) == 0) { newcursor= index; break; } diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c index 0f2297c..a04b741 100644 --- a/lib/dpkg/fields.c +++ b/lib/dpkg/fields.c @@ -324,7 +324,7 @@ f_conffiles(struct pkginfo *pigp, struct pkgbin *pifp, &hashstart, &hashlen, &endfn, ps); obsolete= (hashlen == sizeof(obsolete_str)-1 && - !memcmp(hashstart, obsolete_str, hashlen)); + memcmp(hashstart, obsolete_str, hashlen) == 0); if (obsolete) conffvalue_lastword(value, endfn, endent, &hashstart, &hashlen, &endfn, diff --git a/lib/dpkg/options.c b/lib/dpkg/options.c index 8aa41e2..7cea001 100644 --- a/lib/dpkg/options.c +++ b/lib/dpkg/options.c @@ -106,10 +106,11 @@ myfileopt(const char *fn, const struct cmdinfo *cmdinfos) for (cip=cmdinfos; cip->olong || cip->oshort; cip++) { if (!cip->olong) continue; - if (!strcmp(cip->olong,linebuf)) break; + if (strcmp(cip->olong, linebuf) == 0) + break; l=strlen(cip->olong); if ((cip->takesvalue==2) && (linebuf[l]=='-') && - !opt && !strncmp(linebuf,cip->olong,l)) { + !opt && strncmp(linebuf, cip->olong, l) == 0) { opt=linebuf+l+1; break; } @@ -217,16 +218,18 @@ myopt(const char *const **argvp, const struct cmdinfo *cmdinfos, ++(*argvp); while ((p= **argvp) && *p == '-') { ++(*argvp); - if (!strcmp(p,"--")) break; + if (strcmp(p, "--") == 0) + break; if (*++p == '-') { ++p; value=NULL; for (cip= cmdinfos; cip->olong || cip->oshort; cip++) { if (!cip->olong) continue; - if (!strcmp(p,cip->olong)) break; + if (strcmp(p, cip->olong) == 0) + break; l= strlen(cip->olong); - if (!strncmp(p,cip->olong,l) && + if (strncmp(p, cip->olong, l) == 0 && (p[l]== ((cip->takesvalue==2) ? '-' : '='))) { value=p+l+1; break; } } if (!cip->olong) badusage(_("unknown option --%s"),p); diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c index 2c1f4d2..9e79209 100644 --- a/lib/dpkg/parse.c +++ b/lib/dpkg/parse.c @@ -150,7 +150,7 @@ pkg_parse_field(struct parsedb_state *ps, struct field_state *fs, fs->fieldlen, fs->fieldstart); larpp = &pkg_obj->pkgbin->arbs; while ((arp = *larpp) != NULL) { - if (!strncasecmp(arp->name, fs->fieldstart, fs->fieldlen)) + if (strncasecmp(arp->name, fs->fieldstart, fs->fieldlen) == 0) parse_error(ps, _("duplicate value for user-defined field `%.*s'"), fs->fieldlen, fs->fieldstart); diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c index e55261c..ce65531 100644 --- a/lib/dpkg/triglib.c +++ b/lib/dpkg/triglib.c @@ -667,13 +667,13 @@ trig_parse_ci(const char *file, trig_parse_cicb *interest, *spc++ = '\0'; while (cisspace(*spc)) spc++; - if (!strcmp(cmd, "interest")) { + if (strcmp(cmd, "interest") == 0) { parse_ci_call(file, cmd, interest, spc, pkg, pkgbin, trig_await); - } else if (!strcmp(cmd, "interest-noawait")) { + } else if (strcmp(cmd, "interest-noawait") == 0) { parse_ci_call(file, cmd, interest, spc, pkg, pkgbin, trig_noawait); - } else if (!strcmp(cmd, "activate")) { + } else if (strcmp(cmd, "activate") == 0) { parse_ci_call(file, cmd, activate, spc, pkg, pkgbin, trig_await); - } else if (!strcmp(cmd, "activate-noawait")) { + } else if (strcmp(cmd, "activate-noawait") == 0) { parse_ci_call(file, cmd, activate, spc, pkg, pkgbin, trig_noawait); } else { ohshit(_("triggers ci file contains unknown directive `%.250s'"), @@ -789,7 +789,7 @@ th_simple_nn_find(const char *name, bool nonew) struct filenamenode *search; for (search = trigger_files; search; search = search->next) - if (!strcmp(search->name, name)) + if (strcmp(search->name, name) == 0) return search; /* Not found. */ diff --git a/lib/dpkg/trignote.c b/lib/dpkg/trignote.c index 62ab502..6e3d45f 100644 --- a/lib/dpkg/trignote.c +++ b/lib/dpkg/trignote.c @@ -41,7 +41,7 @@ trig_note_pend_core(struct pkginfo *pend, const char *trig) struct trigpend *tp; for (tp = pend->trigpend_head; tp; tp = tp->next) - if (!strcmp(tp->name, trig)) + if (strcmp(tp->name, trig) == 0) return false; tp = nfmalloc(sizeof(*tp)); diff --git a/src/configure.c b/src/configure.c index 5c4414d..e005088 100644 --- a/src/configure.c +++ b/src/configure.c @@ -118,13 +118,13 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) cdr.buf); /* Select what to do. */ - if (!strcmp(currenthash, newdisthash)) { + if (strcmp(currenthash, newdisthash) == 0) { /* They're both the same so there's no point asking silly * questions. */ useredited = -1; distedited = -1; what = cfo_identical; - } else if (!strcmp(currenthash, NONEXISTENTFLAG) && fc_conff_miss) { + } else if (strcmp(currenthash, NONEXISTENTFLAG) == 0&& fc_conff_miss) { fprintf(stderr, _("\n" "Configuration file `%s', does not exist on system.\n" @@ -133,8 +133,8 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) what = cfo_newconff; useredited = -1; distedited = -1; - } else if (!strcmp(conff->hash, NEWCONFFILEFLAG)) { - if (!strcmp(currenthash, NONEXISTENTFLAG)) { + } else if (strcmp(conff->hash, NEWCONFFILEFLAG) == 0) { + if (strcmp(currenthash, NONEXISTENTFLAG) == 0) { what = cfo_newconff; useredited = -1; distedited = -1; @@ -153,7 +153,7 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) else what = conffoptcells[useredited][distedited]; - if (!strcmp(currenthash, NONEXISTENTFLAG)) + if (strcmp(currenthash, NONEXISTENTFLAG) == 0) what |= cfof_userrmd; } diff --git a/src/filesdb.c b/src/filesdb.c index 17c1708..de6000a 100644 --- a/src/filesdb.c +++ b/src/filesdb.c @@ -673,7 +673,8 @@ struct filenamenode *findnamenode(const char *name, enum fnnflags flags) { while (*pointerp) { /* XXX: Why is the assert needed? It's checking already added entries. */ assert((*pointerp)->name[0] == '/'); - if (!strcmp((*pointerp)->name+1,name)) break; + if (strcmp((*pointerp)->name + 1, name) == 0) + break; pointerp= &(*pointerp)->next; } if (*pointerp) return *pointerp; diff --git a/src/main.c b/src/main.c index 43019b9..b04d6ae 100644 --- a/src/main.c +++ b/src/main.c @@ -557,7 +557,7 @@ static void setforce(const struct cmdinfo *cip, const char *value) { size_t l; const struct forceinfo *fip; - if (!strcmp(value,"help")) { + if (strcmp(value, "help") == 0) { printf(_( "%s forcing options - control behaviour when problems found:\n" " warn but continue: --force-<thing>,<thing>,...\n" @@ -580,7 +580,8 @@ static void setforce(const struct cmdinfo *cip, const char *value) { comma= strchr(value,','); l = comma ? (size_t)(comma - value) : strlen(value); for (fip=forceinfos; fip->name; fip++) - if (!strncmp(fip->name,value,l) && strlen(fip->name)==l) break; + if (strncmp(fip->name, value, l) == 0 && strlen(fip->name) == l) + break; if (!fip->name) { badusage(_("unknown force/refuse option `%.*s'"), diff --git a/src/processarc.c b/src/processarc.c index f0bccc6..50e27b8 100644 --- a/src/processarc.c +++ b/src/processarc.c @@ -1065,7 +1065,7 @@ void process_archive(const char *filename) { if ((namenode->flags & fnnf_old_conff)) { if (sameas) { if (sameas->namenode->flags & fnnf_new_conff) { - if (!strcmp(sameas->namenode->oldhash, NEWCONFFILEFLAG)) { + if (strcmp(sameas->namenode->oldhash, NEWCONFFILEFLAG) == 0) { sameas->namenode->oldhash= namenode->oldhash; debug(dbg_eachfile, "process_archive: old conff %s" " is same as new conff %s, copying hash", @@ -1244,7 +1244,7 @@ void process_archive(const char *filename) { assert(otherpkg->clientdata->istobe == itb_normal || otherpkg->clientdata->istobe == itb_deconfigure); for (cfile= otherpkg->clientdata->files; - cfile && !strcmp(cfile->namenode->name,"/."); + cfile && strcmp(cfile->namenode->name, "/.") == 0; cfile= cfile->next); if (!cfile) { debug(dbg_stupidlyverbose, "process_archive no non-root, no disappear"); diff --git a/src/remove.c b/src/remove.c index 58f34a5..8cc1466 100644 --- a/src/remove.c +++ b/src/remove.c @@ -538,10 +538,11 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { debug(dbg_stupidlyverbose, "removal_bulk conffile dsd entry='%s'" " conffbasename='%s' conffnameused=%d conffbasenamelen=%d", de->d_name, conffbasename, conffnameused, conffbasenamelen); - if (!strncmp(de->d_name,conffbasename,conffbasenamelen)) { + if (strncmp(de->d_name, conffbasename, conffbasenamelen) == 0) { debug(dbg_stupidlyverbose, "removal_bulk conffile dsd entry starts right"); for (ext= removeconffexts; *ext; ext++) - if (!strcmp(*ext,de->d_name+conffbasenamelen)) goto yes_remove; + if (strcmp(*ext, de->d_name + conffbasenamelen) == 0) + goto yes_remove; p= de->d_name+conffbasenamelen; if (*p++ == '~') { while (*p && cisdigit(*p)) p++; @@ -550,8 +551,8 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) { } debug(dbg_stupidlyverbose, "removal_bulk conffile dsd entry starts wrong"); if (de->d_name[0] == '#' && - !strncmp(de->d_name+1,conffbasename,conffbasenamelen) && - !strcmp(de->d_name+1+conffbasenamelen,"#")) + strncmp(de->d_name + 1, conffbasename, conffbasenamelen) == 0 && + strcmp(de->d_name + 1 + conffbasenamelen, "#") == 0) goto yes_remove; debug(dbg_stupidlyverbose, "removal_bulk conffile dsd entry not it"); continue; diff --git a/src/trigcmd.c b/src/trigcmd.c index 04fa6d1..f3aa9ee 100644 --- a/src/trigcmd.c +++ b/src/trigcmd.c @@ -144,7 +144,7 @@ parse_awaiter_package(void) static void tdm_add_trig_begin(const char *trig) { - ctrig = !strcmp(trig, activate); + ctrig = strcmp(trig, activate) == 0; trigdef_update_printf("%s", trig); if (!ctrig || done_trig) return; @@ -155,7 +155,7 @@ tdm_add_trig_begin(const char *trig) static void tdm_add_package(const char *awname) { - if (ctrig && !strcmp(awname, bypackage)) + if (ctrig && strcmp(awname, bypackage) == 0) return; yespackage(awname); } diff --git a/src/trigproc.c b/src/trigproc.c index 7dbde7b..73a1939 100644 --- a/src/trigproc.c +++ b/src/trigproc.c @@ -244,7 +244,7 @@ check_trigger_cycle(struct pkginfo *processing_now) " tortoisetrig=%s haretrig=%s", processing_now_name, tortoise_name, tortoise_trig->name, hare_trig->name); - if (!strcmp(hare_trig->name, tortoise_trig->name)) + if (strcmp(hare_trig->name, tortoise_trig->name) == 0) goto found_in_hare; } /* Not found in hare, yay! */ diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index f5dce6a..c2766f6 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -667,7 +667,7 @@ parse_schedule_item(const char *string, struct schedule_item *item) { const char *after_hyph; - if (!strcmp(string, "forever")) { + if (strcmp(string, "forever") == 0) { item->type = sched_forever; } else if (isdigit(string[0])) { item->type = sched_timeout; -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org