summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-04-16 22:13:18 +0000
committerjbj <devnull@localhost>2003-04-16 22:13:18 +0000
commitf7aaeb11df0bdbdffd6916ca083d0d8be4afb253 (patch)
tree853570d599566450a065ab5cd9f91bf39c71f1a3 /build
parent27785211ad035c1f5e36628771ca4f4b8cd017f5 (diff)
downloadlibrpm-tizen-f7aaeb11df0bdbdffd6916ca083d0d8be4afb253.tar.gz
librpm-tizen-f7aaeb11df0bdbdffd6916ca083d0d8be4afb253.tar.bz2
librpm-tizen-f7aaeb11df0bdbdffd6916ca083d0d8be4afb253.zip
- permit secondary tag match patterns with RPMQV_ALL.
CVS patchset: 6754 CVS date: 2003/04/16 22:13:18
Diffstat (limited to 'build')
-rw-r--r--build/expression.c18
-rw-r--r--build/files.c32
-rw-r--r--build/parseDescription.c34
-rw-r--r--build/rpmbuild.h5
4 files changed, 37 insertions, 52 deletions
diff --git a/build/expression.c b/build/expression.c
index 5ba366984..84400d41f 100644
--- a/build/expression.c
+++ b/build/expression.c
@@ -101,11 +101,14 @@ static void valueDump(const char *msg, Value v, FILE *fp)
* Parser state.
*/
typedef struct _parseState {
- /*@owned@*/ char *str; /*!< expression string */
- /*@dependent@*/ char *p; /*!< current position in expression string */
- int nextToken; /*!< current lookahead token */
- Value tokenValue; /*!< valid when TOK_INTEGER or TOK_STRING */
- Spec spec; /*!< spec file that we are parsing inside of */
+/*@owned@*/
+ char *str; /*!< expression string */
+/*@dependent@*/
+ char *p; /*!< current position in expression string */
+ int nextToken; /*!< current lookahead token */
+/*@relnull@*/
+ Value tokenValue; /*!< valid when TOK_INTEGER or TOK_STRING */
+ Spec spec; /*!< spec file that we are parsing inside of */
} *ParseState;
@@ -320,6 +323,7 @@ static int rdToken(ParseState state)
}
/*@=boundswrite@*/
+/*@null@*/
static Value doLogical(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
@@ -328,6 +332,7 @@ static Value doLogical(ParseState state)
/**
* @param state expression parser state
*/
+/*@null@*/
static Value doPrimary(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
@@ -409,6 +414,7 @@ static Value doPrimary(ParseState state)
/**
* @param state expression parser state
*/
+/*@null@*/
static Value doMultiplyDivide(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
@@ -464,6 +470,7 @@ static Value doMultiplyDivide(ParseState state)
* @param state expression parser state
*/
/*@-boundswrite@*/
+/*@null@*/
static Value doAddSubtract(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
@@ -528,6 +535,7 @@ static Value doAddSubtract(ParseState state)
/**
* @param state expression parser state
*/
+/*@null@*/
static Value doRelational(ParseState state)
/*@globals rpmGlobalMacroContext @*/
/*@modifies state->nextToken, state->p, state->tokenValue,
diff --git a/build/files.c b/build/files.c
index 64764c31f..bb3f5c412 100644
--- a/build/files.c
+++ b/build/files.c
@@ -207,43 +207,27 @@ static void dumpAttrRec(const char * msg, AttrRec ar)
}
#endif
-/* strtokWithQuotes() modified from glibc strtok() */
-/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If
- not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
/**
+ * @param s
+ * @param delim
*/
/*@-boundswrite@*/
-static char *strtokWithQuotes(char *s, char *delim)
+/*@null@*/
+static char *strtokWithQuotes(/*@null@*/ char *s, char *delim)
/*@modifies *s @*/
{
static char *olds = NULL;
char *token;
- if (s == NULL) {
+ if (s == NULL)
s = olds;
- }
+ if (s == NULL)
+ return NULL;
/* Skip leading delimiters */
s += strspn(s, delim);
- if (*s == '\0') {
+ if (*s == '\0')
return NULL;
- }
/* Find the end of the token. */
token = s;
diff --git a/build/parseDescription.c b/build/parseDescription.c
index bd0b37301..e76666b36 100644
--- a/build/parseDescription.c
+++ b/build/parseDescription.c
@@ -27,8 +27,10 @@ extern int noLang;
};
int parseDescription(Spec spec)
+ /*@globals name, lang @*/
+ /*@modifies name, lang @*/
{
- int nextPart;
+ int nextPart = RPMERR_BADSPEC; /* assume error */
StringBuf sb;
int flag = PART_SUBNAME;
Package pkg;
@@ -38,10 +40,8 @@ int parseDescription(Spec spec)
poptContext optCon = NULL;
spectag t = NULL;
- /*@-mods@*/
name = NULL;
lang = RPMBUILD_DEFAULT_LANG;
- /*@=mods@*/
if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {
rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %%description: %s\n"),
@@ -61,32 +61,24 @@ int parseDescription(Spec spec)
spec->lineNum,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
spec->line);
- argv = _free(argv);
- optCon = poptFreeContext(optCon);
- return RPMERR_BADSPEC;
+ goto exit;
}
if (poptPeekArg(optCon)) {
- /*@-mods@*/
if (name == NULL)
name = poptGetArg(optCon);
- /*@=mods@*/
if (poptPeekArg(optCon)) {
rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"),
spec->lineNum,
spec->line);
- argv = _free(argv);
- optCon = poptFreeContext(optCon);
- return RPMERR_BADSPEC;
+ goto exit;
}
}
if (lookupPackage(spec, name, flag, &pkg)) {
rpmError(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"),
spec->lineNum, spec->line);
- argv = _free(argv);
- optCon = poptFreeContext(optCon);
- return RPMERR_BADSPEC;
+ goto exit;
}
@@ -96,9 +88,7 @@ int parseDescription(Spec spec)
if (headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
rpmError(RPMERR_BADSPEC, _("line %d: Second description\n"),
spec->lineNum);
- argv = _free(argv);
- optCon = poptFreeContext(optCon);
- return RPMERR_BADSPEC;
+ goto exit;
}
#endif
@@ -110,18 +100,20 @@ int parseDescription(Spec spec)
nextPart = PART_NONE;
} else {
if (rc) {
- return rc;
+ nextPart = RPMERR_BADSPEC;
+ goto exit;
}
while (! (nextPart = isPart(spec->line))) {
appendLineStringBuf(sb, spec->line);
if (t) t->t_nlines++;
if ((rc =
- readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
+ readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
nextPart = PART_NONE;
break;
}
if (rc) {
- return rc;
+ nextPart = RPMERR_BADSPEC;
+ goto exit;
}
}
}
@@ -134,8 +126,8 @@ int parseDescription(Spec spec)
sb = freeStringBuf(sb);
+exit:
argv = _free(argv);
optCon = poptFreeContext(optCon);
-
return nextPart;
}
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index 9a224e3ca..b4070f46d 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -328,7 +328,7 @@ int parseExpressionBoolean(Spec spec, const char * expr)
* @param expr expression to parse
* @return
*/
-/*@unused@*/
+/*@unused@*/ /*@null@*/
char * parseExpressionString(Spec spec, const char * expr)
/*@globals rpmGlobalMacroContext @*/
/*@modifies rpmGlobalMacroContext @*/;
@@ -343,7 +343,8 @@ char * parseExpressionString(Spec spec, const char * expr)
* @param test don't execute scripts or package if testing
* @return 0 on success, RPMERR_SCRIPT on failure
*/
-int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
+int doScript(Spec spec, int what, /*@null@*/ const char * name,
+ /*@null@*/ StringBuf sb, int test)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies spec->macros,