diff --git a/rpmio/macro.c b/rpmio/macro.c index 32eb6ecbf..527ee8007 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -10,7 +10,7 @@ #endif #define iseol(_c) ((_c) == '\n' || (_c) == '\r') -#define STREQ(_t, _f, _fn) ((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn))) +#define STREQ(_t, _f, _fn) ((_fn) == (sizeof(_t)-1) && rstreqn((_t), (_f), (_fn))) #define MACROBUFSIZ (BUFSIZ * 2) diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c index bb99d418f..cb36ebe25 100644 --- a/rpmio/rpmfileutil.c +++ b/rpmio/rpmfileutil.c @@ -696,8 +696,7 @@ int rpmFileHasSuffix(const char *path, const char *suffix) { size_t plen = strlen(path); size_t slen = strlen(suffix); - return (plen >= slen && - strcmp(path+plen-slen, suffix) == 0); + return (plen >= slen && rstreq(path+plen-slen, suffix)); } char * rpmGetCwd(void) diff --git a/rpmio/rpmhook.c b/rpmio/rpmhook.c index bece9da04..1928df0c9 100644 --- a/rpmio/rpmhook.c +++ b/rpmio/rpmhook.c @@ -97,7 +97,7 @@ static int rpmhookTableFindBucket(rpmhookTable *table, const char *name) ret = hash % (*table)->size; bucket = &(*table)->bucket[ret]; while (bucket->name && - (bucket->hash != hash || strcmp(bucket->name, name) != 0)) { + (bucket->hash != hash || !rstreq(bucket->name, name))) { /* Collision resolution based on Python's perturb scheme. */ ret = ((ret << 2) + ret + perturb + 1) % (*table)->size; perturb >>= 5; diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index eb5d62726..577210ef9 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -286,7 +286,7 @@ int pgpValTok(pgpValTbl vs, const char * s, const char * se) { do { size_t vlen = strlen(vs->str); - if (vlen <= (se-s) && !strncmp(s, vs->str, vlen)) + if (vlen <= (se-s) && rstreqn(s, vs->str, vlen)) break; } while ((++vs)->val != -1); return vs->val; @@ -1436,7 +1436,7 @@ pgpArmor pgpReadPkts(const char * fn, uint8_t ** pkt, size_t * pktlen) goto exit; } -#define TOKEQ(_s, _tok) (!strncmp((_s), (_tok), sizeof(_tok)-1)) +#define TOKEQ(_s, _tok) (rstreqn((_s), (_tok), sizeof(_tok)-1)) for (t = (char *)b; t && *t; t = te) { if ((te = strchr(t, '\n')) == NULL) @@ -1498,8 +1498,7 @@ pgpArmor pgpReadPkts(const char * fn, uint8_t ** pkt, size_t * pktlen) if (armortype == NULL) /* XXX can't happen */ continue; - rc = strncmp(t, armortype, strlen(armortype)); - if (rc) + if (!rstreqn(t, armortype, strlen(armortype)) continue; t += strlen(armortype); diff --git a/rpmio/url.c b/rpmio/url.c index 316e850f2..f20be1a83 100644 --- a/rpmio/url.c +++ b/rpmio/url.c @@ -81,11 +81,11 @@ urltype urlIsURL(const char * url) if (url && *url) { for (us = urlstrings; us->leadin != NULL; us++) { - if (strncmp(url, us->leadin, strlen(us->leadin))) + if (!rstreqn(url, us->leadin, strlen(us->leadin))) continue; return us->ret; } - if (strcmp(url, "-") == 0) + if (rstreq(url, "-")) return URL_IS_DASH; }