diff options
author | jbj <devnull@localhost> | 2004-10-09 18:23:00 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-10-09 18:23:00 +0000 |
commit | dfcc57328817fe35c3d23d10a0337e8c95bbe7a2 (patch) | |
tree | 9fcd28d2ff4be03bd748c4014f345b13110b33af | |
parent | f4545b773ce594f3fdeaaf1c03685ecdeb669984 (diff) | |
download | librpm-tizen-dfcc57328817fe35c3d23d10a0337e8c95bbe7a2.tar.gz librpm-tizen-dfcc57328817fe35c3d23d10a0337e8c95bbe7a2.tar.bz2 librpm-tizen-dfcc57328817fe35c3d23d10a0337e8c95bbe7a2.zip |
Splint fiddles.
CVS patchset: 7438
CVS date: 2004/10/09 18:23:00
-rw-r--r-- | build/parseReqs.c | 46 | ||||
-rw-r--r-- | build/parseScript.c | 9 | ||||
-rw-r--r-- | build/parseSpec.c | 32 | ||||
-rw-r--r-- | build/reqprov.c | 42 | ||||
-rw-r--r-- | build/rpmbuild.h | 17 | ||||
-rw-r--r-- | build/rpmspec.h | 1 |
6 files changed, 78 insertions, 69 deletions
diff --git a/build/parseReqs.c b/build/parseReqs.c index 46feb9508..ca7f4b569 100644 --- a/build/parseReqs.c +++ b/build/parseReqs.c @@ -32,15 +32,15 @@ static struct ReqComp { #define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;} #define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;} -int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, +int parseRCPOT(Spec spec, Package pkg, const char *field, rpmTag tagN, int index, rpmsenseFlags tagflags) { const char *r, *re, *v, *ve; - char * req, * version; + char * N, * EVR; + rpmsenseFlags Flags; Header h; - rpmsenseFlags flags; - switch (tag) { + switch (tagN) { case RPMTAG_PROVIDEFLAGS: tagflags |= RPMSENSE_PROVIDES; h = pkg->header; @@ -94,7 +94,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, if (*r == '\0') break; - flags = (tagflags & ~RPMSENSE_SENSEMASK); + Flags = (tagflags & ~RPMSENSE_SENSEMASK); /* Tokens must begin with alphanumeric, _, or / */ if (!(xisalnum(r[0]) || r[0] == '_' || r[0] == '/')) { @@ -105,7 +105,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, } /* Don't permit file names as args for certain tags */ - switch (tag) { + switch (tagN) { case RPMTAG_OBSOLETEFLAGS: case RPMTAG_CONFLICTFLAGS: case RPMTAG_BUILDCONFLICTS: @@ -121,17 +121,17 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, re = r; SKIPNONWHITE(re); - req = xmalloc((re-r) + 1); - strncpy(req, r, (re-r)); - req[re-r] = '\0'; + N = xmalloc((re-r) + 1); + strncpy(N, r, (re-r)); + N[re-r] = '\0'; - /* Parse version */ + /* Parse EVR */ v = re; SKIPWHITE(v); ve = v; SKIPNONWHITE(ve); - re = v; /* ==> next token (if no version found) starts here */ + re = v; /* ==> next token (if no EVR found) starts here */ /* Check for possible logical operator */ if (ve > v) { @@ -147,7 +147,7 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, return RPMERR_BADSPEC; } - switch(tag) { + switch(tagN) { case RPMTAG_BUILDPREREQ: case RPMTAG_PREREQ: case RPMTAG_PROVIDEFLAGS: @@ -159,9 +159,9 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, default: /*@switchbreak@*/ break; } - flags |= rc->sense; + Flags |= rc->sense; - /* now parse version */ + /* now parse EVR */ v = ve; SKIPWHITE(v); ve = v; @@ -171,24 +171,24 @@ int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, } /*@-branchstate@*/ - if (flags & RPMSENSE_SENSEMASK) { + if (Flags & RPMSENSE_SENSEMASK) { if (*v == '\0' || ve == v) { rpmError(RPMERR_BADSPEC, _("line %d: Version required: %s\n"), spec->lineNum, spec->line); return RPMERR_BADSPEC; } - version = xmalloc((ve-v) + 1); - strncpy(version, v, (ve-v)); - version[ve-v] = '\0'; - re = ve; /* ==> next token after version string starts here */ + EVR = xmalloc((ve-v) + 1); + strncpy(EVR, v, (ve-v)); + EVR[ve-v] = '\0'; + re = ve; /* ==> next token after EVR string starts here */ } else - version = NULL; + EVR = NULL; /*@=branchstate@*/ - (void) addReqProv(spec, h, flags, req, version, index); + (void) addReqProv(spec, h, tagN, N, EVR, Flags, index); - req = _free(req); - version = _free(version); + N = _free(N); + EVR = _free(EVR); } /*@=boundsread@*/ diff --git a/build/parseScript.c b/build/parseScript.c index 64325e07e..5740cccdc 100644 --- a/build/parseScript.c +++ b/build/parseScript.c @@ -82,10 +82,10 @@ int parseScript(Spec spec, int parsePart) const char **progArgv = NULL; int progArgc; char *partname = NULL; - int reqtag = 0; - int tag = 0; + rpmTag reqtag = 0; + rpmTag tag = 0; int tagflags = 0; - int progtag = 0; + rpmTag progtag = 0; int flag = PART_SUBNAME; Package pkg; StringBuf sb = NULL; @@ -298,7 +298,8 @@ int parseScript(Spec spec, int parsePart) rc = RPMERR_BADSPEC; goto exit; } else { - (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0); + (void) addReqProv(spec, pkg->header, RPMTAG_REQUIRENAME, + progArgv[0], NULL, (tagflags | RPMSENSE_INTERP), 0); } /* Trigger script insertion is always delayed in order to */ diff --git a/build/parseSpec.c b/build/parseSpec.c index 3ec24731e..5f077cec9 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -152,7 +152,9 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip) ch = ' '; while (*from && ch != '\n') ch = *to++ = *from++; +/*@-mods@*/ spec->lbufPtr = to; +/*@=mods@*/ *to++ = '\0'; ofi->readPtr = from; @@ -161,33 +163,37 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip) switch (*p) { case '\\': switch (*(p+1)) { - case '\n': p++, nc = 1; break; - case '\0': break; - default: p++; break; + case '\n': p++, nc = 1; /*@innerbreak@*/ break; + case '\0': /*@innerbreak@*/ break; + default: p++; /*@innerbreak@*/ break; } - break; - case '\n': nc = 0; break; + /*@switchbreak@*/ break; + case '\n': nc = 0; /*@switchbreak@*/ break; case '%': switch (*(p+1)) { - case '{': p++, bc++; break; - case '(': p++, pc++; break; - case '%': p++; break; + case '{': p++, bc++; /*@innerbreak@*/ break; + case '(': p++, pc++; /*@innerbreak@*/ break; + case '%': p++; /*@innerbreak@*/ break; } - break; - case '{': if (bc > 0) bc++; break; - case '}': if (bc > 0) bc--; break; - case '(': if (pc > 0) pc++; break; - case ')': if (pc > 0) pc--; break; + /*@switchbreak@*/ break; + case '{': if (bc > 0) bc++; /*@switchbreak@*/ break; + case '}': if (bc > 0) bc--; /*@switchbreak@*/ break; + case '(': if (pc > 0) pc++; /*@switchbreak@*/ break; + case ')': if (pc > 0) pc--; /*@switchbreak@*/ break; } } /* If it doesn't, ask for one more line. We need a better * error code for this. */ if (pc || bc || nc ) { +/*@-observertrans -readonlytrans@*/ spec->nextline = ""; +/*@=observertrans =readonlytrans@*/ return RPMERR_UNMATCHEDIF; } +/*@-mods@*/ spec->lbufPtr = spec->lbuf; +/*@=mods@*/ /* Don't expand macros (eg. %define) in false branch of %if clause */ if (spec->readStack->reading && diff --git a/build/reqprov.c b/build/reqprov.c index 4c7249ba9..0178b1573 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -8,8 +8,8 @@ #include "rpmbuild.h" #include "debug.h" -int addReqProv(/*@unused@*/ Spec spec, Header h, - rpmsenseFlags depFlags, const char *depName, const char *depEVR, +int addReqProv(/*@unused@*/ Spec spec, Header h, /*@unused@*/ rpmTag tagN, + const char * N, const char * EVR, rpmsenseFlags Flags, int index) { HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -24,42 +24,42 @@ int addReqProv(/*@unused@*/ Spec spec, Header h, rpmsenseFlags extra = RPMSENSE_ANY; int xx; - if (depFlags & RPMSENSE_PROVIDES) { + if (Flags & RPMSENSE_PROVIDES) { nametag = RPMTAG_PROVIDENAME; versiontag = RPMTAG_PROVIDEVERSION; flagtag = RPMTAG_PROVIDEFLAGS; - extra = depFlags & RPMSENSE_FIND_PROVIDES; - } else if (depFlags & RPMSENSE_OBSOLETES) { + extra = Flags & RPMSENSE_FIND_PROVIDES; + } else if (Flags & RPMSENSE_OBSOLETES) { nametag = RPMTAG_OBSOLETENAME; versiontag = RPMTAG_OBSOLETEVERSION; flagtag = RPMTAG_OBSOLETEFLAGS; - } else if (depFlags & RPMSENSE_CONFLICTS) { + } else if (Flags & RPMSENSE_CONFLICTS) { nametag = RPMTAG_CONFLICTNAME; versiontag = RPMTAG_CONFLICTVERSION; flagtag = RPMTAG_CONFLICTFLAGS; - } else if (depFlags & RPMSENSE_PREREQ) { + } else if (Flags & RPMSENSE_PREREQ) { nametag = RPMTAG_REQUIRENAME; versiontag = RPMTAG_REQUIREVERSION; flagtag = RPMTAG_REQUIREFLAGS; - extra = depFlags & _ALL_REQUIRES_MASK; - } else if (depFlags & RPMSENSE_TRIGGER) { + extra = Flags & _ALL_REQUIRES_MASK; + } else if (Flags & RPMSENSE_TRIGGER) { nametag = RPMTAG_TRIGGERNAME; versiontag = RPMTAG_TRIGGERVERSION; flagtag = RPMTAG_TRIGGERFLAGS; indextag = RPMTAG_TRIGGERINDEX; - extra = depFlags & RPMSENSE_TRIGGER; + extra = Flags & RPMSENSE_TRIGGER; } else { nametag = RPMTAG_REQUIRENAME; versiontag = RPMTAG_REQUIREVERSION; flagtag = RPMTAG_REQUIREFLAGS; - extra = depFlags & _ALL_REQUIRES_MASK; + extra = Flags & _ALL_REQUIRES_MASK; } - depFlags = (depFlags & RPMSENSE_SENSEMASK) | extra; + Flags = (Flags & RPMSENSE_SENSEMASK) | extra; /*@-branchstate@*/ - if (depEVR == NULL) - depEVR = ""; + if (EVR == NULL) + EVR = ""; /*@=branchstate@*/ /* Check for duplicate dependencies. */ @@ -80,10 +80,10 @@ int addReqProv(/*@unused@*/ Spec spec, Header h, /*@-boundsread@*/ while (len > 0) { len--; - if (strcmp(names[len], depName)) + if (strcmp(names[len], N)) continue; if (flagtag && versions != NULL && - (strcmp(versions[len], depEVR) || flags[len] != depFlags)) + (strcmp(versions[len], EVR) || flags[len] != Flags)) continue; if (indextag && indexes != NULL && indexes[len] != index) continue; @@ -101,12 +101,12 @@ int addReqProv(/*@unused@*/ Spec spec, Header h, } /* Add this dependency. */ - xx = headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1); + xx = headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &N, 1); if (flagtag) { xx = headerAddOrAppendEntry(h, versiontag, - RPM_STRING_ARRAY_TYPE, &depEVR, 1); + RPM_STRING_ARRAY_TYPE, &EVR, 1); xx = headerAddOrAppendEntry(h, flagtag, - RPM_INT32_TYPE, &depFlags, 1); + RPM_INT32_TYPE, &Flags, 1); } if (indextag) xx = headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1); @@ -122,7 +122,7 @@ int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) (void) stpcpy( stpcpy( stpcpy(reqname, "rpmlib("), feature), ")"); /* XXX 1st arg is unused */ - return addReqProv(NULL, h, RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL), - reqname, featureEVR, 0); + return addReqProv(NULL, h, RPMTAG_REQUIRENAME, reqname, featureEVR, + RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL), 0); } /*@=boundswrite@*/ diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 66d670064..31fc66c12 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -308,8 +308,8 @@ int parsePrep(Spec spec) * @param tagflags dependency flags already known from context * @return 0 on success, RPMERR_BADSPEC on failure */ -int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index, - rpmsenseFlags tagflags) +int parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN, + int index, rpmsenseFlags tagflags) /*@globals rpmGlobalMacroContext, h_errno @*/ /*@modifies rpmGlobalMacroContext @*/; @@ -409,15 +409,16 @@ Package freePackage(/*@only@*/ /*@null@*/ Package pkg) * Add dependency to header, filtering duplicates. * @param spec spec file control structure * @param h header - * @param depFlags (e.g. Requires: foo < 0:1.2-3, both "Requires:" and "<") - * @param depName (e.g. Requires: foo < 0:1.2-3, "foo") - * @param depEVR (e.g. Requires: foo < 0:1.2-3, "0:1.2-3") + * @param tagN tag, identifies type of dependency + * @param N (e.g. Requires: foo < 0:1.2-3, "foo") + * @param EVR (e.g. Requires: foo < 0:1.2-3, "0:1.2-3") + * @param Flags (e.g. Requires: foo < 0:1.2-3, both "Requires:" and "<") * @param index (0 always) * @return 0 always */ -int addReqProv(/*@unused@*/Spec spec, Header h, - rpmsenseFlags depFlags, const char * depName, - const char * depEVR, int index) +int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN, + const char * N, const char * EVR, rpmsenseFlags Flags, + int index) /*@modifies h @*/; /** \ingroup rpmbuild diff --git a/build/rpmspec.h b/build/rpmspec.h index 57367862b..763bd2cbf 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -107,6 +107,7 @@ struct Spec_s { /*@owned@*/ struct OpenFileInfo * fileStack; char lbuf[10*BUFSIZ]; +/*@dependent@*/ char *lbufPtr; char nextpeekc; /*@dependent@*/ |