aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-21 13:23:14 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-21 13:23:14 +0000
commitbf66fbc8e2380717c1fab860cfc60c78582839dd (patch)
tree3ab3dd4df901851ff7f4345708592118766ba4aa /e2fsprogs
parent6910741067913d131d931b1e6424d3b8ed43e64f (diff)
downloadbusybox-bf66fbc8e2380717c1fab860cfc60c78582839dd.tar.gz
introduce LONE_CHAR (optimized strcmp with one-char string)
Diffstat (limited to 'e2fsprogs')
-rw-r--r--e2fsprogs/blkid/devname.c4
-rw-r--r--e2fsprogs/chattr.c7
-rw-r--r--e2fsprogs/ext2fs/ismounted.c2
-rw-r--r--e2fsprogs/fsck.c4
4 files changed, 9 insertions, 8 deletions
diff --git a/e2fsprogs/blkid/devname.c b/e2fsprogs/blkid/devname.c
index d69000be7..3d11734d5 100644
--- a/e2fsprogs/blkid/devname.c
+++ b/e2fsprogs/blkid/devname.c
@@ -189,7 +189,7 @@ static void lvm_probe_all(blkid_cache cache)
struct dirent *lv_iter;
vg_name = vg_iter->d_name;
- if (!strcmp(vg_name, ".") || !strcmp(vg_name, ".."))
+ if (LONE_CHAR(vg_name, '.') || !strcmp(vg_name, ".."))
continue;
vdirname = xmalloc(vg_len + strlen(vg_name) + 8);
sprintf(vdirname, "%s/%s/LVs", VG_DIR, vg_name);
@@ -203,7 +203,7 @@ static void lvm_probe_all(blkid_cache cache)
char *lv_name, *lvm_device;
lv_name = lv_iter->d_name;
- if (!strcmp(lv_name, ".") || !strcmp(lv_name, ".."))
+ if (LONE_CHAR(lv_name, '.') || !strcmp(lv_name, ".."))
continue;
lvm_device = xmalloc(vg_len + strlen(vg_name) +
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c
index 4c341627e..4848e1e1a 100644
--- a/e2fsprogs/chattr.c
+++ b/e2fsprogs/chattr.c
@@ -157,9 +157,10 @@ skip_setflags:
static int chattr_dir_proc(const char *dir_name, struct dirent *de,
void *private EXT2FS_ATTR((unused)))
{
- /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/
- if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \
- (de->d_name[1] == '.' && de->d_name[2] == '\0'))) {
+ /*if (strcmp(de->d_name, ".") || strcmp(de->d_name, "..")) {*/
+ if (de->d_name[0] == '.'
+ && (!de->d_name[1] || (de->d_name[1] == '.' && !de->d_name[2]))
+ ) {
char *path = concat_subpath_file(dir_name, de->d_name);
if (path) {
change_attributes(path);
diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c
index cace7715c..d943f1185 100644
--- a/e2fsprogs/ext2fs/ismounted.c
+++ b/e2fsprogs/ext2fs/ismounted.c
@@ -144,7 +144,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
* read/write, since if the root is mounted read/only, the
* contents of /etc/mtab may not be accurate.
*/
- if (!strcmp(mnt->mnt_dir, "/")) {
+ if (LONE_CHAR(mnt->mnt_dir, '/')) {
is_root:
#define TEST_FILE "/.ismount-test-file"
*mount_flags |= EXT2_MF_ISROOT;
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 3b01c1021..da66250f1 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -1080,7 +1080,7 @@ static int check_all(void)
*/
if (!parallel_root) {
for (fs = filesys_info; fs; fs = fs->next) {
- if (!strcmp(fs->mountpt, "/"))
+ if (LONE_CHAR(fs->mountpt, '/'))
break;
}
if (fs) {
@@ -1099,7 +1099,7 @@ static int check_all(void)
*/
if (skip_root)
for (fs = filesys_info; fs; fs = fs->next)
- if (!strcmp(fs->mountpt, "/"))
+ if (LONE_CHAR(fs->mountpt, '/'))
fs->flags |= FLAG_DONE;
while (not_done_yet) {