This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
__alloc_dir nit: const
- From: Jim Meyering <jim at meyering dot net>
- To: libc-alpha at sources dot redhat dot com
- Date: Sat, 12 Nov 2005 13:26:33 +0100
- Subject: __alloc_dir nit: const
__alloc_dir doesn't write through its *statp pointer parameter,
so it should be const. Here's a patch:
2005-11-12 Jim Meyering <jim@meyering.net>
* sysdeps/unix/opendir.c (__alloc_dir): Declare *statp parameter
to be const.
* include/dirent.h (__alloc_dir): Likewise.
Index: sysdeps/unix/opendir.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/opendir.c,v
retrieving revision 1.40
diff -u -p -r1.40 opendir.c
--- sysdeps/unix/opendir.c 14 Oct 2005 21:04:33 -0000 1.40
+++ sysdeps/unix/opendir.c 12 Nov 2005 12:23:21 -0000
@@ -139,7 +139,7 @@ weak_alias (__opendir, opendir)
DIR *
internal_function
-__alloc_dir (int fd, bool close_fd, struct stat64 *statp)
+__alloc_dir (int fd, bool close_fd, const struct stat64 *statp)
{
if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
goto lose;
Index: include/dirent.h
===================================================================
RCS file: /cvs/glibc/libc/include/dirent.h,v
retrieving revision 1.12
diff -u -p -r1.12 dirent.h
--- include/dirent.h 16 Oct 2005 08:34:04 -0000 1.12
+++ include/dirent.h 12 Nov 2005 12:23:21 -0000
@@ -25,6 +25,6 @@ extern int __alphasort64 (const void *a,
__attribute_pure__;
extern int __versionsort64 (const void *a, const void *b)
__attribute_pure__;
-extern DIR *__alloc_dir (int fd, bool close_fd, struct stat64 *statp)
+extern DIR *__alloc_dir (int fd, bool close_fd, const struct stat64 *statp)
internal_function;
#endif