[PATCH 0/2] virDir* related cleanups

*** BLURB HERE *** Michal Prívozník (2): syntax-check: s/VIR_DIR_CLOSE/g_autoptr(DIR)/ virfile: Update example use of virDirRead() build-aux/syntax-check.mk | 2 +- src/util/virfile.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.31.1

We have a syntax-check rule that forbids explicit closedir(). However, the error message suggest using VIR_DIR_CLOSE() which was removed a few releases ago (v6.10.0-rc1~389). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- build-aux/syntax-check.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index eda89f40ad..256f9f695a 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -472,7 +472,7 @@ sc_prohibit_gethostname: sc_prohibit_readdir: @prohibit='\b(read|close|open)dir *\(' \ exclude='exempt from syntax-check' \ - halt='use virDirOpen, virDirRead and VIR_DIR_CLOSE' \ + halt='use virDirOpen, virDirRead and g_autoptr(DIR)' \ $(_sc_search_regexp) sc_prohibit_gettext_noop: -- 2.31.1

We have an example in virDirRead() documentation on how to use the function. In there, the directory structure is plain DIR, but that won't work anymore. Switch over to g_autoptr(DIR) which is what we use now. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 4f98b011be..723e1ca6e5 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2889,9 +2889,9 @@ virDirOpenQuiet(DIR **dirp, const char *name) * @name: if non-NULL, the name related to @dirp for use in error reporting * * Wrapper around readdir. Typical usage: + * g_autoptr(DIR) dir = NULL; * struct dirent *ent; * int rc; - * DIR *dir; * if (virDirOpen(&dir, name) < 0) * goto error; * while ((rc = virDirRead(dir, &ent, name)) > 0) -- 2.31.1
participants (2)
-
Michal Privoznik
-
Peter Krempa