From: Nicholas Nethercote Date: Wed, 20 May 2009 04:22:42 +0000 (+0000) Subject: DARWIN sync: add some 'const' attributes. X-Git-Tag: svn/VALGRIND_3_5_0~646 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=99b76e50c74e7695dfcedc6762988499590935bd;p=thirdparty%2Fvalgrind.git DARWIN sync: add some 'const' attributes. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10022 --- diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 0a28224e14..ee15c66b24 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -274,7 +274,7 @@ Long VG_(fsize) ( Int fd ) return (res == -1) ? (-1LL) : buf.size; } -Bool VG_(is_dir) ( HChar* f ) +Bool VG_(is_dir) ( const HChar* f ) { struct vg_stat buf; SysRes res = VG_(stat)(f, &buf); @@ -305,13 +305,13 @@ Int VG_(fcntl) ( Int fd, Int cmd, Int arg ) return sr_isError(res) ? -1 : sr_Res(res); } -Int VG_(rename) ( Char* old_name, Char* new_name ) +Int VG_(rename) ( const Char* old_name, const Char* new_name ) { SysRes res = VG_(do_syscall2)(__NR_rename, (UWord)old_name, (UWord)new_name); return sr_isError(res) ? (-1) : 0; } -Int VG_(unlink) ( Char* file_name ) +Int VG_(unlink) ( const Char* file_name ) { SysRes res = VG_(do_syscall1)(__NR_unlink, (UWord)file_name); return sr_isError(res) ? (-1) : 0; @@ -384,7 +384,7 @@ Bool VG_(get_startup_wd) ( Char* buf, SizeT size ) return True; } -Int VG_(readlink) (Char* path, Char* buf, UInt bufsiz) +Int VG_(readlink) (const Char* path, Char* buf, UInt bufsiz) { SysRes res; /* res = readlink( path, buf, bufsiz ); */ @@ -406,7 +406,7 @@ Int VG_(getdents) (Int fd, struct vki_dirent *dirp, UInt count) /* Check accessibility of a file. Returns zero for access granted, nonzero otherwise. */ -Int VG_(access) ( HChar* path, Bool irusr, Bool iwusr, Bool ixusr ) +Int VG_(access) ( const HChar* path, Bool irusr, Bool iwusr, Bool ixusr ) { # if defined(VGO_linux) /* Very annoyingly, I cannot find any definition for R_OK et al in @@ -452,7 +452,7 @@ Int VG_(access) ( HChar* path, Bool irusr, Bool iwusr, Bool ixusr ) */ /* returns: 0 = success, non-0 is failure */ Int VG_(check_executable)(/*OUT*/Bool* is_setuid, - HChar* f, Bool allow_setuid) + const HChar* f, Bool allow_setuid) { struct vg_stat st; SysRes res = VG_(stat)(f, &st); diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h index 4ff074f821..0807778991 100644 --- a/coregrind/pub_core_libcfile.h +++ b/coregrind/pub_core_libcfile.h @@ -50,7 +50,7 @@ extern Bool VG_(resolve_filename) ( Int fd, HChar* buf, Int n_buf ); extern Long VG_(fsize) ( Int fd ); /* Is the file a directory? */ -extern Bool VG_(is_dir) ( HChar* f ); +extern Bool VG_(is_dir) ( const HChar* f ); /* Default destination port to be used in logging over a network, if none specified. */ @@ -68,11 +68,12 @@ extern Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen ); extern Int VG_(getsockopt) ( Int sd, Int level, Int optname, void *optval, Int *optlen ); -extern Int VG_(access) ( HChar* path, Bool irusr, Bool iwusr, Bool ixusr ); +extern Int VG_(access) ( const HChar* path, Bool irusr, Bool iwusr, + Bool ixusr ); /* Is the file executable? Returns: 0 = success, non-0 is failure */ extern Int VG_(check_executable)(/*OUT*/Bool* is_setuid, - HChar* f, Bool allow_setuid); + const HChar* f, Bool allow_setuid); /* Note this moves (or at least, is believed to move) the file pointer on Linux and AIX5 but doesn't on Darwin. This inconsistency should diff --git a/include/pub_tool_libcfile.h b/include/pub_tool_libcfile.h index ad1fd04dc3..916b431b5f 100644 --- a/include/pub_tool_libcfile.h +++ b/include/pub_tool_libcfile.h @@ -79,10 +79,10 @@ extern SysRes VG_(stat) ( const Char* file_name, struct vg_stat* buf ); extern Int VG_(fstat) ( Int fd, struct vg_stat* buf ); extern SysRes VG_(dup) ( Int oldfd ); extern SysRes VG_(dup2) ( Int oldfd, Int newfd ); -extern Int VG_(rename) ( Char* old_name, Char* new_name ); -extern Int VG_(unlink) ( Char* file_name ); +extern Int VG_(rename) ( const Char* old_name, const Char* new_name ); +extern Int VG_(unlink) ( const Char* file_name ); -extern Int VG_(readlink)( Char* path, Char* buf, UInt bufsize ); +extern Int VG_(readlink)( const Char* path, Char* buf, UInt bufsize ); extern Int VG_(getdents)( Int fd, struct vki_dirent *dirp, UInt count ); /* Copy the working directory at startup into buf[0 .. size-1], or return