Replace equal/not equal uses of str[n]cmp() with rstreq[n] in header code

This commit is contained in:
Panu Matilainen 2009-08-31 12:43:02 +03:00
parent 4ef65c9a42
commit 746070ebe1
5 changed files with 13 additions and 13 deletions

View File

@ -621,7 +621,7 @@ void *rpmHeaderFormatFuncByName(const char *fmt)
void *func = NULL;
for (ext = rpmHeaderFormats; ext->name != NULL; ext++) {
if (!strcmp(ext->name, fmt)) {
if (rstreq(ext->name, fmt)) {
func = ext->func;
break;
}

View File

@ -1231,25 +1231,25 @@ static int headerMatchLocale(const char *td, const char *l, const char *le)
const char *fe;
/* First try a complete match. */
if (strlen(td) == (le-l) && !strncmp(td, l, (le - l)))
if (strlen(td) == (le-l) && rstreqn(td, l, (le - l)))
return 1;
/* Next, try stripping optional dialect and matching. */
for (fe = l; fe < le && *fe != '@'; fe++)
{};
if (fe < le && !strncmp(td, l, (fe - l)))
if (fe < le && rstreqn(td, l, (fe - l)))
return 1;
/* Next, try stripping optional codeset and matching. */
for (fe = l; fe < le && *fe != '.'; fe++)
{};
if (fe < le && !strncmp(td, l, (fe - l)))
if (fe < le && rstreqn(td, l, (fe - l)))
return 1;
/* Finally, try stripping optional country code and matching. */
for (fe = l; fe < le && *fe != '_'; fe++)
{};
if (fe < le && !strncmp(td, l, (fe - l)))
if (fe < le && rstreqn(td, l, (fe - l)))
return 2;
return 0;
@ -1664,7 +1664,7 @@ int headerAddI18NString(Header h, rpmTag tag, const char * string,
{ const char * l = table->data;
for (langNum = 0; langNum < table->info.count; langNum++) {
if (!strcmp(l, lang)) break;
if (rstreq(l, lang)) break;
l += strlen(l) + 1;
}
}

View File

@ -235,12 +235,12 @@ static int findTag(headerSprintfArgs hsa, sprintfToken token, const char * name)
stag->fmt = NULL;
stag->tag = -1;
if (!strcmp(tagname, "*")) {
if (rstreq(tagname, "*")) {
stag->tag = -2;
goto bingo;
}
if (strncmp("RPMTAG_", tagname, sizeof("RPMTAG_")-1) == 0) {
if (rstreqn("RPMTAG_", tagname, sizeof("RPMTAG_")-1)) {
tagname += sizeof("RPMTAG");
}
@ -760,7 +760,7 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token,
spft = token->u.array.format;
isxml = (spft->type == PTOK_TAG && spft->u.tag.type != NULL &&
!strcmp(spft->u.tag.type, "xml"));
rstreq(spft->u.tag.type, "xml"));
if (isxml) {
const char * tagN = rpmTagGetName(spft->u.tag.tag);
@ -853,7 +853,7 @@ char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg)
(hsa.format->type == PTOK_ARRAY
? &hsa.format->u.array.format->u.tag :
NULL));
isxml = (tag != NULL && tag->tag == -2 && tag->type != NULL && !strcmp(tag->type, "xml"));
isxml = (tag != NULL && tag->tag == -2 && tag->type != NULL && rstreq(tag->type, "xml"));
if (isxml) {
need = sizeof("<rpmHeader>\n") - 1;

View File

@ -790,11 +790,11 @@ rpmRC headerCheckPayloadFormat(Header h) {
if (!payloadfmt)
return RPMRC_OK;
if (payloadfmt && strncmp(payloadfmt, "cpio", strlen("cpio")) == 0) {
if (payloadfmt && rstreq(payloadfmt, "cpio")) {
rc = RPMRC_OK;
} else {
char *nevra = headerGetNEVRA(h, NULL);
if (payloadfmt && strncmp(payloadfmt, "drpm", strlen("drpm")) == 0) {
if (payloadfmt && rstreq(payloadfmt, "drpm")) {
rpmlog(RPMLOG_ERR,
_("%s is a Delta RPM and cannot be directly installed\n"),
nevra);

View File

@ -781,7 +781,7 @@ verifySHA1Digest(rpmtd sigtd, DIGEST_CTX sha1ctx, char **msg)
(void) rpmDigestFinal(ctx, (void **)&SHA1, NULL, 1);
if (SHA1 == NULL || strlen(SHA1) != strlen(sig) || strcmp(SHA1, sig)) {
if (SHA1 == NULL || strlen(SHA1) != strlen(sig) || !rstreq(SHA1, sig)) {
rasprintf(msg, "%s %s Expected(%s) != (%s)\n", title,
rpmSigString(res), sig, SHA1 ? SHA1 : "(nil)");
} else {