* lib/getusershell.c: Test GNULIB_GETUSERSHELL_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* modules/getusershell (Depends-on): Add unlocked-io-internal.
* doc/multithread.texi: Document GNULIB_GETUSERSHELL_SINGLE_THREAD.
+2021-03-06 Bruno Haible <bruno@clisp.org>
+
+ getusershell: Optimize stdio accesses when possible.
+ * lib/getusershell.c: Test GNULIB_GETUSERSHELL_SINGLE_THREAD instead of
+ USE_UNLOCKED_IO.
+ * modules/getusershell (Depends-on): Add unlocked-io-internal.
+ * doc/multithread.texi: Document GNULIB_GETUSERSHELL_SINGLE_THREAD.
+
2021-03-06 Bruno Haible <bruno@clisp.org>
unlocked-io-internal: New module.
your package are single-threaded and won't change the locale after it has
been initialized. This macro optimizes the functions @code{mbrtowc} and
@code{wcwidth}.
+@item
+You may define the C macro @code{GNULIB_GETUSERSHELL_SINGLE_THREAD}, if all the
+programs in your package invoke the functions @code{setusershell},
+@code{getusershell}, @code{endusershell} only from a single thread.
@end itemize
#include "stdio--.h"
#include "xalloc.h"
-#if USE_UNLOCKED_IO
+#if GNULIB_GETUSERSHELL_SINGLE_THREAD
# include "unlocked-io.h"
#endif
Depends-on:
unistd
extensions
-fopen-safer [test $HAVE_GETUSERSHELL = 0]
-xalloc [test $HAVE_GETUSERSHELL = 0]
+fopen-safer [test $HAVE_GETUSERSHELL = 0]
+unlocked-io-internal [test $HAVE_GETUSERSHELL = 0]
+xalloc [test $HAVE_GETUSERSHELL = 0]
configure.ac:
gl_FUNC_GETUSERSHELL