From 7761bd3bb6c56a375ad8d027c20d020aaa33e2d8 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 11 Apr 2019 13:11:53 +0200 Subject: lib/fileutils: add xreaddir() Remove duplicate code and keep only one implementation in include/fileutils.h. Signed-off-by: Karel Zak --- lib/path.c | 15 --------------- lib/sysfs.c | 15 --------------- 2 files changed, 30 deletions(-) (limited to 'lib') diff --git a/lib/path.c b/lib/path.c index a9c47f2a1..00152f54c 100644 --- a/lib/path.c +++ b/lib/path.c @@ -910,21 +910,6 @@ int ul_path_writef_u64(struct path_cxt *pc, uint64_t num, const char *path, ...) } -static struct dirent *xreaddir(DIR *dp) -{ - struct dirent *d; - - while ((d = readdir(dp))) { - if (!strcmp(d->d_name, ".") || - !strcmp(d->d_name, "..")) - continue; - - /* blacklist here? */ - break; - } - return d; -} - int ul_path_count_dirents(struct path_cxt *pc, const char *path) { DIR *dir; diff --git a/lib/sysfs.c b/lib/sysfs.c index 6916c2584..9e336adcf 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -200,21 +200,6 @@ char *sysfs_blkdev_get_name(struct path_cxt *pc, char *buf, size_t bufsiz) return buf; } -static struct dirent *xreaddir(DIR *dp) -{ - struct dirent *d; - - while ((d = readdir(dp))) { - if (!strcmp(d->d_name, ".") || - !strcmp(d->d_name, "..")) - continue; - - /* blacklist here? */ - break; - } - return d; -} - int sysfs_blkdev_is_partition_dirent(DIR *dir, struct dirent *d, const char *parent_name) { char path[NAME_MAX + 6 + 1]; -- cgit v1.2.3-55-g7522