summaryrefslogtreecommitdiff
path: root/build/expression.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-10-28 17:16:25 +0000
committerjbj <devnull@localhost>2000-10-28 17:16:25 +0000
commit3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19 (patch)
tree1a99ac1cf7e49d8ab1719d50f111d23fafc71470 /build/expression.c
parentb8f90f10cbb592d7ac15dccae503767f262cd719 (diff)
downloadlibrpm-tizen-3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19.tar.gz
librpm-tizen-3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19.tar.bz2
librpm-tizen-3ad99fcba52fcc5e8ab636d2f1760c945cdfbf19.zip
- add cscope/ctags (Rodrigo Barbosa<rodrigob@conectiva.com.br>).
- remove getMacroBody() from rpmio API. - hide libio lossage in prototype, not API. lclint annotations. CVS patchset: 4230 CVS date: 2000/10/28 17:16:25
Diffstat (limited to 'build/expression.c')
-rw-r--r--build/expression.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/build/expression.c b/build/expression.c
index 4bd9be7af..95ad308bc 100644
--- a/build/expression.c
+++ b/build/expression.c
@@ -49,13 +49,13 @@ static Value valueMakeInteger(int i)
return v;
}
-static Value valueMakeString(const char *s)
+static Value valueMakeString(/*@only@*/ const char *s)
{
Value v;
v = (Value) xmalloc(sizeof(struct _value));
v->type = VALUE_TYPE_STRING;
- v->data.s = xstrdup(s);
+ v->data.s = s;
return v;
}
@@ -269,7 +269,7 @@ static int rdToken(ParseState state)
p--;
token = TOK_IDENTIFIER;
- v = valueMakeString(temp);
+ v = valueMakeString( xstrdup(temp) );
} else if (*p == '\"') {
char temp[EXPRBUFSIZ], *t = temp;
@@ -279,10 +279,8 @@ static int rdToken(ParseState state)
*t++ = *p++;
*t++ = '\0';
- expandMacros(state->spec, state->spec->macros, temp, sizeof(temp));
-
token = TOK_STRING;
- v = valueMakeString(temp);
+ v = valueMakeString( rpmExpand(temp, NULL) );
} else {
rpmError(RPMERR_BADSPEC, _("parse error in expression"));
@@ -328,15 +326,8 @@ static Value doPrimary(ParseState state)
case TOK_IDENTIFIER: {
char *name = state->tokenValue->data.s;
- const char *body;
-
- body = getMacroBody(state->spec->macros, name);
- if (!body) {
- rpmError(RPMERR_BADSPEC, _("undefined identifier"));
- return NULL;
- }
- v = valueMakeString(body);
+ v = valueMakeString( rpmExpand(name, NULL) );
if (rdToken(state))
return NULL;
break;
@@ -472,12 +463,10 @@ static Value doAddSubtract(ParseState state)
}
copy = xmalloc(strlen(v1->data.s) + strlen(v2->data.s) + 1);
- strcpy(copy, v1->data.s);
- strcat(copy, v2->data.s);
+ (void) stpcpy( stpcpy(copy, v1->data.s), v2->data.s);
valueFree(v1);
v1 = valueMakeString(copy);
- free(copy);
}
}