summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-08-31 12:29:56 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-08-31 12:29:56 +0300
commit4ef65c9a4218f9b354b00708ee2126fb1b7bec74 (patch)
tree48adea6ba921d715af83d2e52a4bef38e6bbc87d /lib
parent1cd1eba2ab619afd17228e326dda0a1b1b4c9a2f (diff)
downloadrpm-4ef65c9a4218f9b354b00708ee2126fb1b7bec74.tar.gz
rpm-4ef65c9a4218f9b354b00708ee2126fb1b7bec74.tar.bz2
rpm-4ef65c9a4218f9b354b00708ee2126fb1b7bec74.zip
Replace equal/not equal uses of str[n]cmp() with rstreq[n] in misc helpers
Diffstat (limited to 'lib')
-rw-r--r--lib/fs.c2
-rw-r--r--lib/manifest.c2
-rw-r--r--lib/misc.c13
-rw-r--r--lib/rpmvercmp.c2
4 files changed, 10 insertions, 9 deletions
diff --git a/lib/fs.c b/lib/fs.c
index cb9011f2f..e16a929dc 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -316,7 +316,7 @@ int rpmGetFilesystemUsage(const char ** fileList, rpm_loff_t * fssizes,
strcpy(buf, sourceDir);
}
- if (strcmp(lastDir, buf)) {
+ if (!rstreq(lastDir, buf)) {
strcpy(dirName, buf);
chptr = dirName + strlen(dirName) - 1;
while (stat(dirName, &sb)) {
diff --git a/lib/manifest.c b/lib/manifest.c
index 06405c952..9ca0c90ee 100644
--- a/lib/manifest.c
+++ b/lib/manifest.c
@@ -95,7 +95,7 @@ rpmRC rpmReadPackageManifest(FD_t fd, int * argcPtr, char *** argvPtr)
if (*s == '\0') continue;
/* Sanity checks: skip obviously binary lines and dash (for stdin) */
- if (*s < 32 || strcmp(s, "-") == 0) {
+ if (*s < 32 || rstreq(s, "-")) {
rpmrc = RPMRC_NOTFOUND;
goto exit;
}
diff --git a/lib/misc.c b/lib/misc.c
index 692a64999..3d7fc1463 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -8,6 +8,7 @@
const char * const RPMVERSION = VERSION;
#include <rpm/rpmlog.h>
+#include <rpm/rpmstring.h>
#include "lib/misc.h"
@@ -32,14 +33,14 @@ static char * lastUname = NULL;
if (!thisUname) {
lastUnameLen = 0;
return -1;
- } else if (strcmp(thisUname, "root") == 0) {
+ } else if (rstreq(thisUname, "root")) {
*uid = 0;
return 0;
}
thisUnameLen = strlen(thisUname);
if (lastUname == NULL || thisUnameLen != lastUnameLen ||
- strcmp(thisUname, lastUname) != 0)
+ !rstreq(thisUname, lastUname))
{
if (lastUnameAlloced < thisUnameLen + 1) {
lastUnameAlloced = thisUnameLen + 10;
@@ -75,14 +76,14 @@ static char * lastGname = NULL;
if (thisGname == NULL) {
lastGnameLen = 0;
return -1;
- } else if (strcmp(thisGname, "root") == 0) {
+ } else if (rstreq(thisGname, "root")) {
*gid = 0;
return 0;
}
thisGnameLen = strlen(thisGname);
if (lastGname == NULL || thisGnameLen != lastGnameLen ||
- strcmp(thisGname, lastGname) != 0)
+ !rstreq(thisGname, lastGname))
{
if (lastGnameAlloced < thisGnameLen + 1) {
lastGnameAlloced = thisGnameLen + 10;
@@ -97,11 +98,11 @@ static char * lastGname = NULL;
grent = getgrnam(thisGname);
if (grent == NULL) {
/* XXX The filesystem package needs group/lock w/o getgrnam. */
- if (strcmp(thisGname, "lock") == 0) {
+ if (rstreq(thisGname, "lock")) {
*gid = lastGid = 54;
return 0;
} else
- if (strcmp(thisGname, "mail") == 0) {
+ if (rstreq(thisGname, "mail")) {
*gid = lastGid = 12;
return 0;
} else
diff --git a/lib/rpmvercmp.c b/lib/rpmvercmp.c
index 0cdcc6866..65dafee31 100644
--- a/lib/rpmvercmp.c
+++ b/lib/rpmvercmp.c
@@ -23,7 +23,7 @@ int rpmvercmp(const char * a, const char * b)
int isnum;
/* easy comparison to see if versions are identical */
- if (!strcmp(a, b)) return 0;
+ if (rstreq(a, b)) return 0;
strcpy(str1, a);
strcpy(str2, b);