aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-12-09 10:21:45 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:05:45 -0700
commitfd46a87b9e1d032863c41f54009e5e6386862f8b (patch)
treed9eb25525e6fa4f8fe4f0e7b9ed6a83c8572b23f /compat-mingw.c
parentMake "last_reg" be entry-point global rather than bb-global. (diff)
downloadsparse-fd46a87b9e1d032863c41f54009e5e6386862f8b.tar.gz
sparse-fd46a87b9e1d032863c41f54009e5e6386862f8b.tar.bz2
sparse-fd46a87b9e1d032863c41f54009e5e6386862f8b.zip
Remove stat-based file identity tests.
Replace it with a simple pathname comparison instead. The pathname check is not only portable (no need for any compatibility helper functions), but we can do it much earlier, and thus make the check much cheaper by avoiding three extra system calls when it triggers (open/fstat/close). And the pathname test seems to match all the cases anyway.
Diffstat (limited to 'compat-mingw.c')
-rw-r--r--compat-mingw.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/compat-mingw.c b/compat-mingw.c
index 66456c7..21ca51a 100644
--- a/compat-mingw.c
+++ b/compat-mingw.c
@@ -34,28 +34,4 @@ void blob_free(void *addr, unsigned long size)
long double string_to_ld(const char *nptr, char **endptr)
{
return strtod(nptr, endptr);
-}
-
-int identical_files(struct stream* s, struct stat *st, const char * name)
-{
- HANDLE file1 =CreateFile(s->name,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
- if(file1==INVALID_HANDLE_VALUE)
- return 0;
- HANDLE file2=CreateFile(name,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
- if(file2==INVALID_HANDLE_VALUE) {
- CloseHandle(file1);
- return 0;
- }
- BY_HANDLE_FILE_INFORMATION info1;
- BY_HANDLE_FILE_INFORMATION info2;
- int same=0;
- if(GetFileInformationByHandle(file1,&info1) && GetFileInformationByHandle(file2,&info2)){
- if(info1.nFileIndexLow==info2.nFileIndexLow &&
- info1.nFileIndexHigh==info2.nFileIndexHigh &&
- info1.dwVolumeSerialNumber==info2.dwVolumeSerialNumber)
- same=1;
- }
- CloseHandle(file1);
- CloseHandle(file2);
- return same;
-}
+}