introduce LONE_CHAR (optimized strcmp with one-char string)
This commit is contained in:
@@ -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) +
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user