[Patch] replace readdir() by g_dir_read_name()

Albrecht Dreß <[email protected]>
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Hi all,

running cppcheck on Balsa/s master sources, I got reports about readdir() not being thread-safe (“portability warnings”).  Although there seems to be some confusion about this (see the glibc man page of readdir vs. IEEE 1003.1-2017), I think the better approach is to use the glib functions which also support other platforms like Windows cleanly (NB: the glib implementation uses readdir() for POSIX systems…).

The attached patch replaces readdir() and friends by the glib functions, and also refactors the affected functions in libbalsa/folder-scanners.c a little bit as to avoid “continue” statements which (IMHO) make the code harder to read.

Opinions?

Cheers,
Albrecht.

---
Patch details:
- libbalsa/folder-scanners.c: replace opendir/readdir/closedir by g_dir_*, and refactor functions libbalsa_scanner_mdir() and libbalsa_scanner_local_dir_helper
- libbalsa/mailbox_imap.c: replace opendir/readdir/closedir by g_dir_*

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
replace_readdir_by_g_dir.diff.bz2 (application/x-bzip, 2.2 KB) - not displayed
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlwRa60ACgkQTKlvDmfn
2fi+Lwf/aQmvq7MQ2+yJHFsMOUEKvPF1DcQEd7hTZuufoiKwIhS983Y7J6HJXNAp
9bLIsqMwhdxoinWCfWaliOm5Ut0U2rLM6LXu5mmVSqBhgIxJ3FM24n8Amiq3mSD5
fXGlPPhxPbcGHMr6tFuHiOlnVvUnJgaMNNhhP9dWIIHfY5Pcvjjk4kGsscslWRLX
zxXpYfHhOQKvq1+6I34ehRCknuKhZ1ajaBmychFm6tJEpEhO+AmxIqek9UYQLH3v
b56MXmybIhLBnhgfhxMwdfs0TcQVbgphvoCRT2j5M6O0Wg69bxYskNOSf0ZfYfWQ
MHaTJAv/DgNyHn/kXAqzqN6IOTMmcQ==
=cuuA
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.